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
this[uint]
Gets/sets the string associated with a keyHash
public string this[uint keyHash] { get; set; }
Parameters
keyHash
uint
Property Value
KeyHashes
Gets the key hashes in the string table
public IReadOnlyList<uint> KeyHashes { get; }
Property Value
ResourceName
Gets the name of this resource if it has one
public override string? ResourceName { get; }
Property Value
SupportedTypes
Gets a list of resource types that this model supports
public static ISet<ResourceType> SupportedTypes { get; }
Property Value
Methods
AddNew(string)
Adds string
to the string table, returning its key hash
public uint AddNew(string @string)
Parameters
string
string
Returns
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
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
Encode()
Encodes the resource model into raw format (🔄️🏃)
public override ReadOnlyMemory<byte> Encode()
Returns
Get(uint)
Gets the string associated with a keyHash
public string Get(uint keyHash)
Parameters
keyHash
uint
Returns
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
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
StreamcancellationToken
CancellationToken
Returns
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)