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
streamMtStreamThe stream to deserialize from.
versionushortThe version of the object to deserialize.
dstTThe destination object to deserialize into.
modeSerializerModeThe mode to deserialize in.
Returns
- T
The deserialized object, or null if deserialization failed.
Type Parameters
TThe 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
streamMtStreamThe stream to deserialize from.
rootNamestringThe name of the root element of the XML document.
dstTThe destination object to deserialize into.
modeSerializerModeThe mode to deserialize in.
encodingSerializerEncodingThe encoding to use when deserializing.
Returns
- T
The deserialized object, or null if deserialization failed.
Type Parameters
TThe 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
dstMtStreamThe stream to serialize to.
srcMtObjectThe object to serialize.
versionushortThe version of the object to serialize.
modeSerializerModeThe 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
dstMtStreamThe stream to serialize to.
srcMtObjectThe object to serialize.
rootNamestringThe name of the root element of the XML document.
encodingSerializerEncodingThe encoding to use when serializing.