Table of Contents

Struct ResourceKey

Namespace
LlamaLogic.Packages
Assembly
LlamaLogic.Packages.dll

Represents the unique key of a resource within a DataBasePackedFile

public struct ResourceKey : IEquatable<ResourceKey>
Implements
Inherited Members
Extension Methods

Constructors

ResourceKey(ResourceType, uint, ulong)

Represents the unique key of a resource within a DataBasePackedFile

public ResourceKey(ResourceType type, uint group, ulong fullInstance)

Parameters

type ResourceType
group uint
fullInstance ulong

Fields

Empty

Represents the empty ResourceKey

public static readonly ResourceKey Empty

Field Value

ResourceKey

FullInstance

A value that uniquely identifies an individual resource within a given type and group

public readonly ulong FullInstance

Field Value

ulong

Group

A value used to group related resources together

public readonly uint Group

Field Value

uint

Remarks

In many cases, this value can be 0, especially for custom content. However, Maxis content and some specific modding scenarios might use different group values to organize resources. Group values help in categorizing resources that belong to a specific set or context.

Type

The type of resource indicated by the key

public readonly ResourceType Type

Field Value

ResourceType

Properties

FullInstanceHex

Gets the hex representation of FullInstance

public readonly string FullInstanceHex { get; }

Property Value

string

FullTgi

Gets the full TGI or TGI ID (type, group, and instance in hex format) of the resource key

public readonly string FullTgi { get; }

Property Value

string

GroupHex

Gets the hex representation of Group

public readonly string GroupHex { get; }

Property Value

string

Instance

Gets the low order bits of FullInstance

public readonly uint Instance { get; }

Property Value

uint

InstanceEx

Gets the high order bits of FullInstance

public readonly uint InstanceEx { get; }

Property Value

uint

InstanceExHex

Gets the hex representation of InstanceEx

public readonly string InstanceExHex { get; }

Property Value

string

InstanceHex

Gets the hex representation of Instance

public readonly string InstanceHex { get; }

Property Value

string

TypeHex

Gets the hex representation of Type

public readonly string TypeHex { get; }

Property Value

string

Methods

Deconstruct(out ResourceType, out uint, out ulong)

Deconstructs the key into its components

public readonly void Deconstruct(out ResourceType type, out uint group, out ulong fullInstance)

Parameters

type ResourceType

The Type

group uint

The Group

fullInstance ulong

The FullInstance

Equals(ResourceKey)

Indicates whether the current object is equal to another object of the same type.

public readonly bool Equals(ResourceKey other)

Parameters

other ResourceKey

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override readonly bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

public override readonly int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

Parse(string)

Parses a string into a ResourceKey

public static ResourceKey Parse(string s)

Parameters

s string

The string to parse

Returns

ResourceKey

Exceptions

FormatException

s is not in the correct format

Parse(string, IFormatProvider?)

Parses a string into a ResourceKey

public static ResourceKey Parse(string s, IFormatProvider? provider)

Parameters

s string

The string to parse

provider IFormatProvider

An object that provides culture-specific formatting information about s

Returns

ResourceKey

Exceptions

FormatException

s is not in the correct format

ToString()

Returns the fully qualified type name of this instance.

public override readonly string ToString()

Returns

string

The fully qualified type name.

TryParse(string?, out ResourceKey)

Tries to parse a string into a ResourceKey

public static bool TryParse(string? s, out ResourceKey result)

Parameters

s string

The string to parse

result ResourceKey

When this method returns, contains the result of successfully parsing s or an undefined value on failure

Returns

bool

TryParse(string?, IFormatProvider?, out ResourceKey)

Tries to parse a string into a ResourceKey

public static bool TryParse(string? s, IFormatProvider? provider, out ResourceKey result)

Parameters

s string

The string to parse

provider IFormatProvider

An object that provides culture-specific formatting information about s

result ResourceKey

When this method returns, contains the result of successfully parsing s or an undefined value on failure

Returns

bool

Operators

operator ==(ResourceKey, ResourceKey)

public static bool operator ==(ResourceKey left, ResourceKey right)

Parameters

left ResourceKey
right ResourceKey

Returns

bool

implicit operator ResourceKey(string)

Converts a string into a ResourceKey

public static implicit operator ResourceKey(string s)

Parameters

s string

The string to convert

Returns

ResourceKey

operator !=(ResourceKey, ResourceKey)

public static bool operator !=(ResourceKey left, ResourceKey right)

Parameters

left ResourceKey
right ResourceKey

Returns

bool