public ConfigModule() { Instance = this; ConfigState.Load(); ConfigState.Save(); }
public override void OnAllModulesLoaded() { ConfigState.Save(); ApplyConfiguration(); RegisterConfigPanel("GraphicsOptionsPanel", 1000, CoreUtils.LoadResource <GameObject>("UI/GraphicsOptionsPanel")); }
//our first "migration": sets LastMigratedVersion if not already set private static void MigrateLastMigratedVersion(ConfigState cs) { if (cs.LastMigratedVersion == null) { cs.LastMigratedVersion = CoreParams.GetCurrentVersion(); Debug.Log($"[ConfigState] Migrated to {cs.LastMigratedVersion} ({nameof(MigrateLastMigratedVersion)})"); } }
public ConfigModule() { Instance = this; RegisterConfigPanel("GraphicsOptionsPanel", 1000, CoreUtils.LoadResource <GameObject>("UI/GraphicsOptionsPanel")); ConfigState.Load(); ConfigState.Save(); }
public static void Load() { try { //backup the config file first try { if (File.Exists(Path)) { File.Copy(Path, System.IO.Path.Combine(CoreParams.PersistentDataPath, "config.backup.json"), true); } } catch (Exception) { } Instance = CoreUtils.LoadExternalJson <ConfigState>(Path); } catch (Exception e) { Debug.LogError("[Config] Failed to load config from file, using defaults"); Debug.LogException(e); try { if (File.Exists(Path)) { DebugUtils.TextWrite(File.ReadAllText(Path), "brokenconfig"); } } catch (Exception) { } } if (Instance == null) { Instance = new ConfigState(); } MigrateLastMigratedVersion(Instance); }
public override void OnAllModulesLoaded() { ConfigState.Save(); }
public override void OnAllModulesLoaded() { ConfigState.Save(); ApplyConfiguration(); }