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
ResourceTypegroup
uintfullInstance
ulong
Fields
Empty
Represents the empty ResourceKey
public static readonly ResourceKey Empty
Field Value
FullInstance
A value that uniquely identifies an individual resource within a given type and group
public readonly ulong FullInstance
Field Value
Group
A value used to group related resources together
public readonly uint Group
Field Value
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
Properties
FullInstanceHex
Gets the hex representation of FullInstance
public readonly string FullInstanceHex { get; }
Property Value
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
GroupHex
Gets the hex representation of Group
public readonly string GroupHex { get; }
Property Value
Instance
Gets the low order bits of FullInstance
public readonly uint Instance { get; }
Property Value
InstanceEx
Gets the high order bits of FullInstance
public readonly uint InstanceEx { get; }
Property Value
InstanceExHex
Gets the hex representation of InstanceEx
public readonly string InstanceExHex { get; }
Property Value
InstanceHex
Gets the hex representation of Instance
public readonly string InstanceHex { get; }
Property Value
TypeHex
Gets the hex representation of Type
public readonly string TypeHex { get; }
Property Value
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
ResourceTypeThe Type
group
uintThe Group
fullInstance
ulongThe 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
ResourceKeyAn object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override readonly bool Equals(object? obj)
Parameters
obj
objectThe 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
stringThe string to parse
Returns
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
stringThe string to parse
provider
IFormatProviderAn object that provides culture-specific formatting information about
s
Returns
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
stringThe string to parse
result
ResourceKeyWhen this method returns, contains the result of successfully parsing
s
or an undefined value on failure
Returns
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
stringThe string to parse
provider
IFormatProviderAn object that provides culture-specific formatting information about
s
result
ResourceKeyWhen this method returns, contains the result of successfully parsing
s
or an undefined value on failure
Returns
Operators
operator ==(ResourceKey, ResourceKey)
public static bool operator ==(ResourceKey left, ResourceKey right)
Parameters
left
ResourceKeyright
ResourceKey
Returns
implicit operator ResourceKey(string)
Converts a string into a ResourceKey
public static implicit operator ResourceKey(string s)
Parameters
s
stringThe string to convert
Returns
operator !=(ResourceKey, ResourceKey)
public static bool operator !=(ResourceKey left, ResourceKey right)
Parameters
left
ResourceKeyright
ResourceKey