Table of Contents

Class KVObjectExtensions

Namespace
ValveResourceFormat.Serialization.KeyValues
Assembly
ValveResourceFormat.dll

Extension methods for KVObject.

public static class KVObjectExtensions

Inheritance

Inherited Members

Methods

GetArray<T>(KVObject, string, Func<KVObject, T>)

Gets an array from the key-value object and maps each element.

public static T[] GetArray<T>(this KVObject collection, string name, Func<KVObject, T> mapper)

Parameters

collection KVObject
name string
mapper Func<KVObject, T>

Returns

T[]

Type Parameters

T

GetArray(KVObject, string)

Gets an array of KVObjects from the key-value object.

public static KVObject[] GetArray(this KVObject collection, string name)

Parameters

collection KVObject
name string

Returns

KVObject[]

GetByteProperty(KVObject, string)

Gets a byte property from the key-value object.

public static byte GetByteProperty(this KVObject collection, string name)

Parameters

collection KVObject
name string

Returns

byte

GetDoubleProperty(KVObject, string)

Gets a double property from the key-value object.

public static double GetDoubleProperty(this KVObject collection, string name)

Parameters

collection KVObject
name string

Returns

double

GetEnumValue<TEnum>(KVObject, string, bool, string)

Gets an enum value from the key-value object.

public static TEnum GetEnumValue<TEnum>(this KVObject collection, string name, bool normalize = false, string stripExtension = "Flags") where TEnum : Enum

Parameters

collection KVObject
name string
normalize bool
stripExtension string

Returns

TEnum

Type Parameters

TEnum

GetFloatArray(KVObject, string)

Gets a float array from the key-value object.

public static float[] GetFloatArray(this KVObject collection, string name)

Parameters

collection KVObject
name string

Returns

float[]

GetFloatProperty(KVObject, string)

Gets a float property from the key-value object.

public static float GetFloatProperty(this KVObject collection, string name)

Parameters

collection KVObject
name string

Returns

float

GetInt32Property(KVObject, string)

Gets an Int32 property from the key-value object.

public static int GetInt32Property(this KVObject collection, string name)

Parameters

collection KVObject
name string

Returns

int

GetIntegerArray(KVObject, string)

Gets an integer array from the key-value object.

public static long[] GetIntegerArray(this KVObject collection, string name)

Parameters

collection KVObject
name string

Returns

long[]

GetIntegerProperty(KVObject, string)

Gets an integer property from the key-value object.

public static long GetIntegerProperty(this KVObject collection, string name)

Parameters

collection KVObject
name string

Returns

long

GetStringProperty(KVObject, string)

Gets a string property from the key-value object.

public static string GetStringProperty(this KVObject collection, string name)

Parameters

collection KVObject
name string

Returns

string

GetSubCollection(KVObject, string)

Gets a sub-collection from the key-value object.

public static KVObject GetSubCollection(this KVObject collection, string name)

Parameters

collection KVObject
name string

Returns

KVObject

GetUInt32Property(KVObject, string)

Gets a UInt32 property from the key-value object.

public static uint GetUInt32Property(this KVObject collection, string name)

Parameters

collection KVObject
name string

Returns

uint

GetUnsignedIntegerArray(KVObject, string)

Gets an unsigned integer array from the key-value object.

public static ulong[] GetUnsignedIntegerArray(this KVObject collection, string name)

Parameters

collection KVObject
name string

Returns

ulong[]

GetUnsignedIntegerProperty(KVObject, string)

Gets an unsigned integer property from the key-value object.

public static ulong GetUnsignedIntegerProperty(this KVObject collection, string name)

Parameters

collection KVObject
name string

Returns

ulong

IsNotBlobType(KVObject, string)

Determines whether the specified key contains an array (not a blob type).

public static bool IsNotBlobType(this KVObject collection, string key)

Parameters

collection KVObject
key string

Returns

bool

NormalizeEnumName<TEnum>(string, string)

Normalize C Style VALVE_ENUM_VALUE_1 to C# ValveEnum.Value1

public static string NormalizeEnumName<TEnum>(string name, string stripExtension = "") where TEnum : Enum

Parameters

name string
stripExtension string

Returns

string

Type Parameters

TEnum

ToMatrix4x4(KVObject[])

Converts an array of key-value objects to a Matrix4x4.

public static Matrix4x4 ToMatrix4x4(this KVObject[] array)

Parameters

array KVObject[]

Returns

Matrix4x4

ToMatrix4x4(KVObject)

Converts the key-value object to a Matrix4x4.

public static Matrix4x4 ToMatrix4x4(this KVObject array)

Parameters

array KVObject

Returns

Matrix4x4

ToQuaternion(KVObject)

Converts the key-value object to a Quaternion.

public static Quaternion ToQuaternion(this KVObject collection)

Parameters

collection KVObject

Returns

Quaternion

ToVector2(KVObject)

Converts the key-value object to a Vector2.

public static Vector2 ToVector2(this KVObject collection)

Parameters

collection KVObject

Returns

Vector2

ToVector3(KVObject)

Converts the key-value object to a Vector3.

public static Vector3 ToVector3(this KVObject collection)

Parameters

collection KVObject

Returns

Vector3

ToVector4(KVObject)

Converts the key-value object to a Vector4.

public static Vector4 ToVector4(this KVObject collection)

Parameters

collection KVObject

Returns

Vector4