Table of Contents

Class BinaryKV3

Namespace
ValveResourceFormat.ResourceTypes
Assembly
ValveResourceFormat.dll

Represents a binary KeyValues3 data block.

public class BinaryKV3 : Block

Inheritance

Derived

Inherited Members

Extension Methods

Constructors

BinaryKV3()

Initializes a new instance of the ValveResourceFormat.ResourceTypes.BinaryKV3 class with DATA block type.

public BinaryKV3()

BinaryKV3(BlockType)

Initializes a new instance of the ValveResourceFormat.ResourceTypes.BinaryKV3 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 ValveResourceFormat.ResourceTypes.BinaryKV3 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 = 55987030

Field Value

int

MAGIC1

Magic number for KV3 version 1.

public const int MAGIC1 = 1263940353

Field Value

int

MAGIC2

Magic number for KV3 version 2.

public const int MAGIC2 = 1263940354

Field Value

int

MAGIC3

Magic number for KV3 version 3.

public const int MAGIC3 = 1263940355

Field Value

int

MAGIC4

Magic number for KV3 version 4.

public const int MAGIC4 = 1263940356

Field Value

int

MAGIC5

Magic number for KV3 version 5.

public const int MAGIC5 = 1263940357

Field Value

int

Properties

Data

Gets the deserialized KeyValues3 data.

public KVObject Data { get; }

Property Value

KVObject

Encoding

Gets the encoding identifier for this KV3 data.

public KV3ID? Encoding { get; }

Property Value

KV3ID?

Format

Gets the format identifier for this KV3 data.

public KV3ID Format { get; }

Property Value

KV3ID

Type

Gets the block type.

public override BlockType Type { get; }

Property Value

BlockType

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

nint

Pointer to the text representation of the KV3 data.

GetKV3File()

Gets the KeyValues3 data as a KV3File object.

public KV3File GetKV3File()

Returns

KV3File

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

bool

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.