Table of Contents

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

T

The type of object being edited.

Inheritance
object
SerializingCommandManager<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

target T

The object being edited.

serializer IStructureSerializer

The serializer used to save the target.

path string

The path of the file the target was loaded from. null if none.

Properties

Serializer

The serializer used to save the Target.

public IStructureSerializer Serializer { get; }

Property Value

IStructureSerializer

Methods

Load(string, IStructureSerializer)

Loads an object from a file.

public static SerializingCommandManager<T> Load(string path, IStructureSerializer serializer)

Parameters

path string

The file to load from.

serializer IStructureSerializer

The serializer used to load and later save the object.

Returns

SerializingCommandManager<T>

Exceptions

IOException

A problem occurs while reading the file.

UnauthorizedAccessException

Read access to the file is not permitted.

Exception

The serializer failed to deserialize the file's content.

Save(string)

Saves the Target to an XML file

public override void Save(string path)

Parameters

path string

The file to save to.

Exceptions

IOException

A problem occurs while writing the file.

UnauthorizedAccessException

Write access to the file is not permitted.