Class JsonFileProfileStore
- Namespace
- SurvivorsMaker.Presentation
- Assembly
- SurvivorsMaker.Presentation.dll
Profile progress (unlocks, records) as a SaveEnvelope JSON file. The saved run lives in its own
file (JsonFileRunStore): Load() returns no SavedRun and Save(ProfileState) ignores it.
A single-file profile written by earlier package versions (profile and run together) is imported once:
the original is kept beside it as *.v1.bak, the progress is rewritten here and the saved run is handed to
the linked run store. The backup preserves runs with an unmapped arena.
public sealed class JsonFileProfileStore : IProfileStore
- Inheritance
-
JsonFileProfileStore
- Implements
- Inherited Members
Constructors
JsonFileProfileStore(string, JsonFileRunStore, Func<IReadOnlyList<string>>)
Creates profile storage with optional routing for a run imported from the legacy combined save.
public JsonFileProfileStore(string path, JsonFileRunStore runs = null, Func<IReadOnlyList<string>> legacyArenaIds = null)
Parameters
pathstringNonempty profile file path.
runsJsonFileRunStoreDestination for an imported legacy run; null leaves it in the backup only.
legacyArenaIdsFunc<IReadOnlyList<string>>Stable arena ids in the order earlier saves indexed them (needed to import a legacy run).
Fields
LegacyBackupSuffix
public const string LegacyBackupSuffix = ".v1.bak"
Field Value
Properties
File
public JsonEnvelopeFile File { get; }
Property Value
LegacyBackupPath
Where the legacy file was backed up, or empty.
public string LegacyBackupPath { get; }
Property Value
LegacyImport
Set when a legacy file was imported this session.
public LegacySaveImport LegacyImport { get; }
Property Value
Path
public string Path { get; }
Property Value
Runs
The run store that receives a legacy saved run. Null keeps such a run in the backup only.
public JsonFileRunStore Runs { get; }
Property Value
Methods
Delete()
Deletes the profile file (unlocks and records). Options and backups are kept.
public void Delete()
Load()
public ProfileState Load()
Returns
Save(ProfileState)
public void Save(ProfileState profile)
Parameters
profileProfileState