Table of Contents

Struct MtSerializer

Namespace
SharpPluginLoader.Core.IO
Assembly
SharpPluginLoader.Core.dll

Provides an interface for serializing and deserializing objects to and from binary and XML formats.

The binary serialization format is CAPCOM's proprietary XFS format, commonly used by .fsm files.

public readonly ref struct MtSerializer
Inherited Members

Constructors

MtSerializer()

Provides an interface for serializing and deserializing objects to and from binary and XML formats.

The binary serialization format is CAPCOM's proprietary XFS format, commonly used by .fsm files.

public MtSerializer()

Methods

DeserializeBinary<T>(MtStream, ushort, T, SerializerMode)

Deserializes an object from an XFS binary stream.

public T? DeserializeBinary<T>(MtStream stream, ushort version, T dst, SerializerMode mode = SerializerMode.State) where T : MtObject

Parameters

stream MtStream

The stream to deserialize from.

version ushort

The version of the object to deserialize.

dst T

The destination object to deserialize into.

mode SerializerMode

The mode to deserialize in.

Returns

T

The deserialized object, or null if deserialization failed.

Type Parameters

T

The type of the object to deserialize.

DeserializeXml<T>(MtStream, string, T, SerializerMode, SerializerEncoding)

Deserializes an object from an XML stream.

public T? DeserializeXml<T>(MtStream stream, string rootName, T dst, SerializerMode mode = SerializerMode.State, SerializerEncoding encoding = SerializerEncoding.Auto) where T : MtObject

Parameters

stream MtStream

The stream to deserialize from.

rootName string

The name of the root element of the XML document.

dst T

The destination object to deserialize into.

mode SerializerMode

The mode to deserialize in.

encoding SerializerEncoding

The encoding to use when deserializing.

Returns

T

The deserialized object, or null if deserialization failed.

Type Parameters

T

The type of the object to deserialize.

SerializeBinary(MtStream, MtObject, ushort, SerializerMode)

Serializes an object to a binary stream in XFS format.

public bool SerializeBinary(MtStream dst, MtObject src, ushort version, SerializerMode mode = SerializerMode.State)

Parameters

dst MtStream

The stream to serialize to.

src MtObject

The object to serialize.

version ushort

The version of the object to serialize.

mode SerializerMode

The mode to serialize in.

Returns

bool

true if serialization was successful, otherwise false.

SerializeXml(MtStream, MtObject, string, SerializerEncoding)

Serializes an object to an XML stream.

public bool SerializeXml(MtStream dst, MtObject src, string rootName, SerializerEncoding encoding = SerializerEncoding.Auto)

Parameters

dst MtStream

The stream to serialize to.

src MtObject

The object to serialize.

rootName string

The name of the root element of the XML document.

encoding SerializerEncoding

The encoding to use when serializing.

Returns

bool

true if serialization was successful, otherwise false.