Class KVDocumentExtensions
Namespace: ValveResourceFormat.Serialization.KeyValues
Assembly: ValveResourceFormat.dll
Extension methods for KV3 document serialization and creation.
public static class KVDocumentExtensionsInheritance
object ← KVDocumentExtensions
Methods
ParseKV3(Stream)
Parses a KeyValues3 file from the specified stream.
public static KVDocument ParseKV3(Stream stream)Parameters
stream Stream
Returns
KVDocument
ParseKV3(string)
Parses a KeyValues3 file from the specified filename.
public static KVDocument ParseKV3(string filename)Parameters
filename string
Returns
KVDocument
ToKV3Document(KVObject, KV3ID?)
Creates a KV3 document from a root KVObject with optional format.
public static KVDocument ToKV3Document(this KVObject root, KV3ID? format = null)Parameters
root KVObject
format KV3ID?
Returns
KVDocument
ToKV3String(KVDocument)
Serializes a KVDocument to KV3 text format.
public static string ToKV3String(this KVDocument doc)Parameters
doc KVDocument
Returns
string
ToKV3String(KVObject, KV3ID?)
Serializes a KVObject to KV3 text format with optional format.
public static string ToKV3String(this KVObject root, KV3ID? format = null)Parameters
root KVObject
format KV3ID?
Returns
string
TryParseKV3WithoutHeader(string, out KVObject, out string)
Parses KeyValues3 text that has no header, such as a block of keys kept in a value of its own.
public static bool TryParseKV3WithoutHeader(string text, out KVObject root, out string error)Parameters
text string
The text.
root KVObject
The root of the text, or an empty object when it cannot be parsed.
error string
Why the text cannot be parsed, or empty when it can.
Returns
bool
Whether the text was parsed.
WriteKV3Text(KVDocument, IndentedTextWriter)
Writes the KVDocument as KV3 text to an IndentedTextWriter.
public static void WriteKV3Text(this KVDocument doc, IndentedTextWriter writer)Parameters
doc KVDocument
writer IndentedTextWriter

