KernelAPI reference
Class FileSaveStorage
Namespace: MicroEngine.Core
Assembly: MicroEngine.Saves.dll
Guide: Saving data
One JSON file per slot in a directory (desktop and tests).
public sealed class FileSaveStorage : ISaveStorage, IStorageInheritance
Implements
Constructors
FileSaveStorage(string)
One JSON file per slot in a directory (desktop and tests).
public FileSaveStorage(string directory)Parameters
directory string
Properties
Location
The directory that holds the slot files.
public string Location { get; }Property Value
Methods
Delete(string)
Removes the slot; does nothing when it does not exist.
public void Delete(string slot)Parameters
slot string
Exists(string)
Whether the slot has data.
public bool Exists(string slot)Parameters
slot string
Returns
Read(string)
The slot’s text, or null when it does not exist.
public string? Read(string slot)Parameters
slot string
Returns
SetAside(string)
Renames <slot>.json to <slot>.corrupt.json, replacing an earlier copy; leaves the file in place if that fails.
public void SetAside(string slot)Parameters
slot string
Write(string, string)
Writes atomically (temp file + move).
public void Write(string slot, string text)Parameters
slot string
text string