public StateModule() { PersistState.Load(); PersistState.Instance.LastStartupTime = DateTime.Now; PersistState.Instance.LastApplicationPath = CoreParams.GameFolderPath; PersistState.Save(); }
/// <summary> /// Loads persistent state from the default file /// </summary> public static void Load() { Instance = CoreUtils.LoadExternalJson <PersistState>(Path); if (Instance == null) { Instance = new PersistState(); } }
//our first "migration": sets LastMigratedVersion if not already set private static void MigrateLastMigratedVersion(PersistState ps) { if (ps.LastMigratedVersion == null) { ps.LastMigratedVersion = CoreParams.GetCurrentVersion(); Debug.Log($"[PersistState] Migrated to {ps.LastMigratedVersion} ({nameof(MigrateLastMigratedVersion)})"); } }
/// <summary> /// Loads persistent state from the default file /// </summary> public static void Load() { Instance = CoreUtils.LoadExternalJson <PersistState>(Path); if (Instance == null) { Instance = new PersistState(); } else { Instance.IsFirstRun = false; } }
public override void Dispose() { PersistState.Instance.LastExitTime = DateTime.Now; PersistState.Save(); }
public override void Dispose() { PersistState.Save(); }
public StateModule() { PersistState.Load(); PersistState.Save(); }
/// <summary> /// Purges the current persistent state and commits this to the default file /// </summary> public static void Reset() { Instance = new PersistState(); Save(); }