Class AnimationStateMachineModel
- Namespace
- LlamaLogic.Packages.Models.AnimationStateMachine
- Assembly
- LlamaLogic.Packages.dll
Represents a AnimationStateMachine resource (🔓)
public sealed class AnimationStateMachineModel : Model, IModel<AnimationStateMachineModel>, IModel
- Inheritance
-
AnimationStateMachineModel
- Implements
- Inherited Members
Remarks
Maxis ships animation state machines (which creators also know as ASMs or JAZZ) encoded either as a binary packed XML document (a DATA file) or as XML text.
Decode(ReadOnlyMemory<byte>) accepts both and presents the state machine as Document.
Encode() always produces XML text, written the way Maxis writes it.
Constructors
AnimationStateMachineModel(XDocument)
Initializes a new AnimationStateMachineModel for the specified document
public AnimationStateMachineModel(XDocument document)
Parameters
documentXDocumentThe state machine document
Properties
Document
Gets the state machine document
public XDocument Document { get; }
Property Value
ResourceName
Gets the name of the state machine (the name attribute of its root element), 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
Decode(ReadOnlyMemory<byte>)
Decodes the resource in raw format to produce an operable model (🔄️🏃)
public static AnimationStateMachineModel Decode(ReadOnlyMemory<byte> data)
Parameters
dataReadOnlyMemory<byte>
Returns
Exceptions
- InvalidDataException
The data is neither a well-formed binary nor a well-formed XML document
Encode()
Encodes the resource model into raw format (🔄️🏃)
public override ReadOnlyMemory<byte> Encode()
Returns
Exceptions
- InvalidOperationException
Document has no root element or contains a node that Maxis XML cannot express
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(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