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

path string

Nonempty profile file path.

runs JsonFileRunStore

Destination for an imported legacy run; null leaves it in the backup only.

legacyArenaIds Func<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

string

Properties

File

public JsonEnvelopeFile File { get; }

Property Value

JsonEnvelopeFile

LegacyBackupPath

Where the legacy file was backed up, or empty.

public string LegacyBackupPath { get; }

Property Value

string

LegacyImport

Set when a legacy file was imported this session.

public LegacySaveImport LegacyImport { get; }

Property Value

LegacySaveImport

Path

public string Path { get; }

Property Value

string

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

JsonFileRunStore

Methods

Delete()

Deletes the profile file (unlocks and records). Options and backups are kept.

public void Delete()

Load()

public ProfileState Load()

Returns

ProfileState

Save(ProfileState)

public void Save(ProfileState profile)

Parameters

profile ProfileState