Table of Contents

Class Model

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

Represents a model for a raw resource

public abstract class Model : IModel
Inheritance
Model
Implements
Derived
Inherited Members

Properties

ResourceName

Gets the name of this resource if it has one

public abstract 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

Decode(ResourceType, ReadOnlyMemory<byte>)

Decodes a resource of the specified type with the model GetModelType(ResourceType) gives for it

public static Model Decode(ResourceType type, ReadOnlyMemory<byte> data)

Parameters

type ResourceType
data ReadOnlyMemory<byte>

Returns

Model

Exceptions

NotSupportedException

No model decodes resources of the specified type

Encode()

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

public abstract ReadOnlyMemory<byte> Encode()

Returns

ReadOnlyMemory<byte>

GetModelType(ResourceType)

Gets the model that decodes every resource of the specified type, or null if there is none

public static Type? GetModelType(ResourceType type)

Parameters

type ResourceType

Returns

Type

Remarks

Models that apply only to some resources of a type, such as ModFileManifestModel for SnippetTuning, are not given.

GetName(ResourceType, Stream)

Gets the name of a resource from its raw data, if it has one

public static string? GetName(ResourceType type, Stream stream)

Parameters

type ResourceType
stream Stream

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(ResourceType, Stream, CancellationToken)

Gets the name of a resource from its raw data, if it has one

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

Parameters

type ResourceType
stream Stream
cancellationToken CancellationToken

Returns

Task<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>