Skip to main content

BasicSaveDataWrapper<TData>

A class in Root.Township, Alta.Saving.

Holds a basic save data object along with its serialized bits, so it is only serialized again after it changes.

Constructors​

MemberWhat it is
BasicSaveDataWrapper()Creates a BasicSaveDataWrapper with default values.

Fields​

4 private and internal fields
MemberWhat it is
private uint[] byteDataThe cached serialized bits.
private int bytesSize of the cached serialized data.
private TData dataBacking field for Data.
private bool isSerializedWhether byteData matches Data.

Properties​

MemberWhat it is
TData Data { get; set; }The save data. Setting it marks the cached bits stale.

Methods​

MemberWhat it is
BasicSaveDataWrapper<TData> Clone()Serializes if needed and returns a copy holding a pooled copy of the bits. The copy's Data is a fresh default object, not the read data.
void Dispose()Returns the cached bits array to the shared pool.
void MarkModified()Marks the cached bits stale, so the next write serializes Data again.
void ReadFrom(BinaryReader binary)Reads the version info and bits, then builds Data from them.
void WriteTo(BinaryWriter binary)Serializes Data if stale, then writes the latest version info and the bits.

Used in​

Members of other types that take, return or hold a BasicSaveDataWrapper&lt;TData>: