Skip to content

Latest commit

 

History

History
110 lines (85 loc) · 4.23 KB

README.md

File metadata and controls

110 lines (85 loc) · 4.23 KB

Build Status

VMFParser

.Net Library written in C#. Useful for generating or parsing in an existing VMF into a tree like structure. Tree can be written to a new VMF file.

API


namespace VMFParser

interface IVNode

  • Represents an entry in a VMF.
string Name (get)
  • Represents the title of a node.



class VBlock : IVNode

  • Represents a block containing other IVNodes in a VMF

In the following Example, Name = visgroup, and Body will contain a list of the VProperys

visgroup
{
  "name" "Tree_1"
  "visgroupid" "5"
  "color" "65 45 0"
}
string Name (get, private set)
  • Represents the title of the Body, it is the top-level text before the { }.
IList<IVNode> Body (get, private set)
  • Holds subnodes of this VBlock.
Constructor(string name, IList<IVNode> body(null))
  • Initializes a new instance of the VBlock class from its name and a list of IVNodes.
Constructor(string[] text)
  • Initializes a new instance of the VBlock class from VMF text.
string[] ToVMFStrings(bool useTabs(true))
  • Generates the VMF text representation of this block.
string ToString()
  • Returns base ToString with "(Name)" to help with debugging.



class VProperty : IVNode

  • Represents a single property name and value.

In the following example, Name = visgroupid, and the Value = 5

"visgroupid" "5"
string Name (get, private set)
  • Represents the title/name of the property.
string Value (get, set)
  • Holds the text value of this property.
Constructor(string name, string value)
  • Initializes a new instance of the VProperty class from the name and value of a property.
Constructor(string text)
  • Initializes a new instance of the VProperty class from vmf text line.
string ToVMFString()
  • Generates the VMF text representation of this Property.
string ToString()
  • Returns base ToString with "(Name)" to help with debugging.



class VMF

  • Represents the full contents of a VMF file, this is similar to a VBLock, but with no Name.
IList<IVNode> Body (get, private set)
  • Holds all the subnodes (IVNode) in a VMF
Constructor()
  • Initializes a new instance of the VMF class.
Constructor(IList<IVNode> body)
  • Initializes a new instance of the VMF class from a list of IVNodes.
Constructor(string[] text)
  • Initializes a new instance of the VMF class from the VMF text.
string[] ToVMFStrings()
  • Generates the VMF text from the body of IVNodes.