C# Class Depressurizer.VdfFileNode

Show file Open project: Theo47/depressurizer Class Usage Examples

Public Properties

Property Type Description
NodeData Object
NodeType System.ValueType

Public Methods

Method Description
CleanTree ( ) : void

Removes any array nodes without any value-type children

ContainsKey ( string key ) : bool

Checks whether the given key exists within an array-type node

GetNodeAt ( string args, bool create = true, int index ) : VdfFileNode

Gets the node at the given address. May be used to build structure.

LoadFromBinary ( BinaryReader stream, long streamLength = -1 ) : VdfFileNode

Loads a FileNode from stream.

LoadFromText ( StreamReader stream, bool useFirstAsRoot = false ) : VdfFileNode

Loads a FileNode from stream.

MakeArray ( ) : void
ReadBin_SeekTo ( BinaryReader stream, byte str, long fileLength ) : void
RemoveSubnode ( string key ) : bool

Removes the subnode with the given key. Can only be called on array nodes.

SaveAsBinary ( BinaryWriter stream, string actualKey = null ) : void

Writes this FileNode and childs to a stream

SaveAsText ( StreamWriter stream, int indent ) : void

Writes this FileNode to a stream

VdfFileNode ( ) : System

Creates a new array-type node

VdfFileNode ( int value ) : System

Creates a new integer-type node

VdfFileNode ( string value ) : System

Creates a new string-type node

VdfFileNode ( ulong value ) : System

Creates a new UInt64-type node

this ( string key ) : VdfFileNode

Gets or sets the subnode with the given key. Can only be used with an array node. If the subnode does not exist, creates it as an array type.

Protected Methods

Method Description
IsEmpty ( ) : bool

Checks whether or not this node has any children

Private Methods

Method Description
ReadBin_GetStringToken ( BinaryReader reader, long streamLength = -1 ) : string

Reads from the specified stream until it reaches a string terminator (double quote with no escaping slash). The opening double quote should already be read, and the last one will be discarded.

ReadText_GetStringToken ( StreamReader stream ) : string

Reads a from the specified stream until it reaches a string terminator (double quote with no escaping slash). The opening double quote should already be read, and the last one will be discarded.

ReadText_SkipWhitespace ( StreamReader stream ) : void

Advances a stream until the next character is not whitespace

WriteBin_WriteArrayKey ( BinaryWriter writer, string arrayKey ) : void

Writes a array key to a stream, adding start/end bytes.

WriteBin_WriteEndByte ( BinaryWriter writer ) : void

Write an end byte to stream

WriteBin_WriteIntegerValue ( BinaryWriter writer, string key, int val ) : void
WriteBin_WriteStringValue ( BinaryWriter writer, string key, string val ) : void

Writes a pair o key and value to a stream, adding star/end and separator bytes

WriteText_WriteFormattedString ( StreamWriter stream, string s ) : void

Writes a string to a stream, adding start/end quotes and escaping any quotes within the string.

WriteText_WriteWhitespace ( StreamWriter stream, int indent ) : void

Writes the given number of tab characters to a stream

Method Details

CleanTree() public method

Removes any array nodes without any value-type children
public CleanTree ( ) : void
return void

ContainsKey() public method

Checks whether the given key exists within an array-type node
public ContainsKey ( string key ) : bool
key string The key to look for
return bool

GetNodeAt() public method

Gets the node at the given address. May be used to build structure.
public GetNodeAt ( string args, bool create = true, int index ) : VdfFileNode
args string An ordered list of keys, like a path
create bool If true, will create any nodes it does not find along the path.
index int Start index of the arg array
return VdfFileNode

IsEmpty() protected method

Checks whether or not this node has any children
protected IsEmpty ( ) : bool
return bool

LoadFromBinary() public static method

Loads a FileNode from stream.
public static LoadFromBinary ( BinaryReader stream, long streamLength = -1 ) : VdfFileNode
stream System.IO.BinaryReader Stream to load from
streamLength long
return VdfFileNode

LoadFromText() public static method

Loads a FileNode from stream.
public static LoadFromText ( StreamReader stream, bool useFirstAsRoot = false ) : VdfFileNode
stream System.IO.StreamReader Stream to load from
useFirstAsRoot bool
return VdfFileNode

MakeArray() public method

public MakeArray ( ) : void
return void

ReadBin_SeekTo() public static method

public static ReadBin_SeekTo ( BinaryReader stream, byte str, long fileLength ) : void
stream System.IO.BinaryReader
str byte
fileLength long
return void

RemoveSubnode() public method

Removes the subnode with the given key. Can only be called on array nodes.
public RemoveSubnode ( string key ) : bool
key string Key of the subnode to remove
return bool

SaveAsBinary() public method

Writes this FileNode and childs to a stream
public SaveAsBinary ( BinaryWriter stream, string actualKey = null ) : void
stream System.IO.BinaryWriter Stream to write to
actualKey string Name of node to write.
return void

SaveAsText() public method

Writes this FileNode to a stream
public SaveAsText ( StreamWriter stream, int indent ) : void
stream System.IO.StreamWriter Stream to write to
indent int Indentation level of each line.
return void

VdfFileNode() public method

Creates a new array-type node
public VdfFileNode ( ) : System
return System

VdfFileNode() public method

Creates a new integer-type node
public VdfFileNode ( int value ) : System
value int Value of the integer
return System

VdfFileNode() public method

Creates a new string-type node
public VdfFileNode ( string value ) : System
value string Value of the string
return System

VdfFileNode() public method

Creates a new UInt64-type node
public VdfFileNode ( ulong value ) : System
value ulong Value of the unsigned 64-bit integer
return System

this() public method

Gets or sets the subnode with the given key. Can only be used with an array node. If the subnode does not exist, creates it as an array type.
Thrown if used on a value node.
public this ( string key ) : VdfFileNode
key string Key to look for or set
return VdfFileNode

Property Details

NodeData public property

public Object NodeData
return Object

NodeType public property

public ValueType,System NodeType
return System.ValueType