public static void Postfix() { SettingsStruct settings = new SettingsStruct { filter = GameManager.GetCameraEffects().m_ActiveFilter }; Settings.Save(settings); }
internal static void Save(SettingsStruct settings) { if (jsonPath == null) { throw new InvalidOperationException("Init not called"); } string json = JSON.Dump(settings, EncodeOptions.NoTypeHints); File.WriteAllText(jsonPath, json, System.Text.Encoding.UTF8); }
internal static bool Load(out SettingsStruct settings) { if (jsonPath == null) { throw new InvalidOperationException("Init not called"); } if (!File.Exists(jsonPath)) { settings = default; return(false); } string json = File.ReadAllText(jsonPath, System.Text.Encoding.UTF8); settings = JSON.Load(json).Make <SettingsStruct>(); return(true); }