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
MtStreamThe stream to deserialize from.
version
ushortThe version of the object to deserialize.
dst
TThe destination object to deserialize into.
mode
SerializerModeThe 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
MtStreamThe stream to deserialize from.
rootName
stringThe name of the root element of the XML document.
dst
TThe destination object to deserialize into.
mode
SerializerModeThe mode to deserialize in.
encoding
SerializerEncodingThe 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
MtStreamThe stream to serialize to.
src
MtObjectThe object to serialize.
version
ushortThe version of the object to serialize.
mode
SerializerModeThe mode to serialize in.
Returns
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
MtStreamThe stream to serialize to.
src
MtObjectThe object to serialize.
rootName
stringThe name of the root element of the XML document.
encoding
SerializerEncodingThe encoding to use when serializing.