Class SerializingCommandManager<T>
- Namespace
- NanoByte.StructureEditor
- Assembly
- NanoByte.StructureEditor.dll
A command manager that loads and saves its target using an IStructureSerializer instead of always using XML.
public class SerializingCommandManager<T> : CommandManager<T>, ICommandManager<T>, ICommandExecutor where T : class
Type Parameters
TThe type of object being edited.
- Inheritance
-
objectSerializingCommandManager<T>
- Implements
- Inherited Members
Constructors
SerializingCommandManager(T, IStructureSerializer, string?)
A command manager that loads and saves its target using an IStructureSerializer instead of always using XML.
public SerializingCommandManager(T target, IStructureSerializer serializer, string? path = null)
Parameters
targetTThe object being edited.
serializerIStructureSerializerThe serializer used to save the
target.pathstringThe path of the file the
targetwas loaded from.nullif none.
Properties
Serializer
The serializer used to save the Target.
public IStructureSerializer Serializer { get; }
Property Value
Methods
Load(string, IStructureSerializer)
Loads an object from a file.
public static SerializingCommandManager<T> Load(string path, IStructureSerializer serializer)
Parameters
pathstringThe file to load from.
serializerIStructureSerializerThe serializer used to load and later save the object.
Returns
Exceptions
- IOException
A problem occurs while reading the file.
- UnauthorizedAccessException
Read access to the file is not permitted.
- Exception
The
serializerfailed to deserialize the file's content.
Save(string)
Saves the Target to an XML file
public override void Save(string path)
Parameters
pathstringThe file to save to.
Exceptions
- IOException
A problem occurs while writing the file.
- UnauthorizedAccessException
Write access to the file is not permitted.