namespace Mr.BrickAdventures.Progression.Adapters; /// /// Keeps the Profile in its own JSON file, beside the Playthrough files but written independently. /// public sealed class JsonProfileStore : IProfileStore { /// Versioned separately from Playthroughs — the two shapes drift at their own pace. private const int CurrentVersion = 1; private readonly string _path; public JsonProfileStore(string directory) => _path = Path.Combine(directory, "profile.json"); public void Save(Profile profile) => JsonFiles.WriteAtomic(_path, CurrentVersion, profile.Export()); public LoadResult Load() => JsonFiles.Read(_path, CurrentVersion, Profile.Restore); }