Class BinaryKV3
Namespace: ValveResourceFormat.ResourceTypes
Assembly: ValveResourceFormat.dll
Represents a binary KeyValues3 data block.
public class BinaryKV3 : BlockInheritance
Derived
AnimGraph, AnimationClip, SmartProp
Inherited Members
Block.Type, Block.Offset, Block.Size, Block.Resource, Block.Read(BinaryReader), Block.ToString(), Block.WriteText(IndentedTextWriter), Block.Serialize(Stream)
Extension Methods
ResourceDataExtensions.AsKeyValueCollection(Block)
Constructors
BinaryKV3()
Initializes a new instance of the class with DATA block type.
public BinaryKV3()BinaryKV3(BlockType)
Initializes a new instance of the class with the specified block type.
public BinaryKV3(BlockType type)Parameters
type BlockType
The block type.
BinaryKV3(KVObject, KV3ID, BlockType)
Initializes a new instance of the class with the specified data and format.
public BinaryKV3(KVObject data, KV3ID format, BlockType blockType = BlockType.Undefined)Parameters
data KVObject
The KeyValues3 data.
format KV3ID
The format identifier.
blockType BlockType
The block type.
Fields
MAGIC0
Magic number for VKV3 format.
public const int MAGIC0 = 55987030Field Value
MAGIC1
Magic number for KV3 version 1.
public const int MAGIC1 = 1263940353Field Value
MAGIC2
Magic number for KV3 version 2.
public const int MAGIC2 = 1263940354Field Value
MAGIC3
Magic number for KV3 version 3.
public const int MAGIC3 = 1263940355Field Value
MAGIC4
Magic number for KV3 version 4.
public const int MAGIC4 = 1263940356Field Value
MAGIC5
Magic number for KV3 version 5.
public const int MAGIC5 = 1263940357Field Value
Properties
Data
Gets the deserialized KeyValues3 data.
public KVObject Data { get; }Property Value
Encoding
Gets the encoding identifier for this KV3 data.
public KV3ID? Encoding { get; }Property Value
Format
Gets the format identifier for this KV3 data.
public KV3ID Format { get; }Property Value
Type
Gets the block type.
public override BlockType Type { get; }Property Value
Methods
ConvertBinaryKV3ToText(nint, int)
Converts binary KV3 data to text format. This method is exposed for unmanaged callers.
public static nint ConvertBinaryKV3ToText(nint dataPtr, int dataLength)Parameters
dataPtr nint
Pointer to the binary KV3 data.
dataLength int
Length of the binary data.
Returns
Pointer to the text representation of the KV3 data.
GetKV3File()
Gets the KeyValues3 data as a KV3File object.
public KV3File GetKV3File()Returns
A KV3File object containing the data and format.
IsBinaryKV3(uint)
Checks if the given magic number represents a binary KV3 format.
public static bool IsBinaryKV3(uint magic)Parameters
magic uint
The magic number to check.
Returns
True if the magic number is a valid binary KV3 format.
Read(BinaryReader)
Reads the block data from a binary reader.
public override void Read(BinaryReader reader)Parameters
reader BinaryReader
The binary reader to read from.
Serialize(Stream)
Writes the binary representation of the object to Stream.
public override void Serialize(Stream stream)Parameters
stream Stream
Stream.
WriteText(IndentedTextWriter)
Writes the correct text dump of the object to IndentedTextWriter.
public override void WriteText(IndentedTextWriter writer)Parameters
writer IndentedTextWriter
IndentedTextWriter.
Remarks
Converts the binary KV3 data to text format and writes it.

