Class Model
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
SupportedTypes
Gets a list of resource types that this model supports
public static ISet<ResourceType> SupportedTypes { get; }
Property Value
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
typeResourceTypedataReadOnlyMemory<byte>
Returns
Exceptions
- NotSupportedException
No model decodes resources of the specified
type
Encode()
Encodes the resource model into raw format (🔄️🏃)
public abstract ReadOnlyMemory<byte> Encode()
Returns
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
typeResourceType
Returns
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
typeResourceTypestreamStream
Returns
GetName(Stream)
Gets the name of a resource from its raw data, if it has one (🔄️💤)
public static string? GetName(Stream stream)
Parameters
streamStream
Returns
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
typeResourceTypestreamStreamcancellationTokenCancellationToken
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
streamStreamcancellationTokenCancellationToken