public static void Postfix()
            {
                SettingsStruct settings = new SettingsStruct {
                    filter = GameManager.GetCameraEffects().m_ActiveFilter
                };

                Settings.Save(settings);
            }
Exemple #2
0
        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);
        }
Exemple #3
0
        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);
        }