Table of Contents

Class StringTableModel

Namespace
LlamaLogic.Packages.Models
Assembly
LlamaLogic.Packages.dll

Represents a StringTable resource (🔒)

public class StringTableModel : Model, IModel<StringTableModel>, IModel
Inheritance
StringTableModel
Implements
Inherited Members

Properties

Count

Gets the number of entries in the string table

public int Count { get; }

Property Value

int

this[uint]

Gets/sets the string associated with a keyHash

public string this[uint keyHash] { get; set; }

Parameters

keyHash uint

Property Value

string

KeyHashes

Gets the key hashes in the string table

public IReadOnlyList<uint> KeyHashes { get; }

Property Value

IReadOnlyList<uint>

ResourceName

Gets the name of this resource if it has one

public override string? ResourceName { get; }

Property Value

string

SupportedTypes

Gets a list of resource types that this model supports

public static ISet<ResourceType> SupportedTypes { get; }

Property Value

ISet<ResourceType>

Methods

AddNew(string)

Adds string to the string table, returning its key hash

public uint AddNew(string @string)

Parameters

string string

Returns

uint

Exceptions

ArgumentException

The key hash generated for string already existed in the string table

Decode(ReadOnlyMemory<byte>)

Decodes the resource in raw format to produce an operable model (🔄️🏃)

public static StringTableModel Decode(ReadOnlyMemory<byte> data)

Parameters

data ReadOnlyMemory<byte>

Returns

StringTableModel

Delete(uint)

Deletes the string associated with a keyHash, returning true if the key hash existed in the string table

public bool Delete(uint keyHash)

Parameters

keyHash uint

Returns

bool

Encode()

Encodes the resource model into raw format (🔄️🏃)

public override ReadOnlyMemory<byte> Encode()

Returns

ReadOnlyMemory<byte>

Get(uint)

Gets the string associated with a keyHash

public string Get(uint keyHash)

Parameters

keyHash uint

Returns

string

GetName(Stream)

Gets the name of a resource from its raw data, if it has one (🔄️💤)

public static string? GetName(Stream stream)

Parameters

stream Stream

Returns

string

GetNameAsync(Stream, CancellationToken)

Gets the name of a resource from its raw data, if it has one, asynchronously (🔄️💤)

public static Task<string?> GetNameAsync(Stream stream, CancellationToken cancellationToken = default)

Parameters

stream Stream
cancellationToken CancellationToken

Returns

Task<string>

Set(uint, string)

Sets the string associated with a keyHash, returning true if the key hash did not already exist in the string table

public bool Set(uint keyHash, string @string)

Parameters

keyHash uint
string string

Returns

bool