Example #1
0
        public void AddPreset(GameOptionPreset preset)
        {
            LoadIniIfNotInitialized();

            presets[preset.ProfileName] = preset;
            WriteIni();
        }
Example #2
0
        private void LoadIni()
        {
            gameOptionPresetsIni = new IniFile(ProgramConstants.ClientUserFilesPath + IniFileName);
            presets = new Dictionary <string, GameOptionPreset>();

            IniSection presetsDefinitions = gameOptionPresetsIni.GetSection(PresetDefinitionsSectionName);

            if (presetsDefinitions == null)
            {
                return;
            }

            foreach (var kvp in presetsDefinitions.Keys)
            {
                if (!presets.ContainsKey(kvp.Value))
                {
                    IniSection presetSection = gameOptionPresetsIni.GetSection(kvp.Value);
                    if (presetSection == null)
                    {
                        continue;
                    }

                    var preset = new GameOptionPreset(kvp.Value);
                    preset.Read(presetSection);
                    presets[kvp.Value] = preset;
                }
            }
        }
Example #3
0
        public void AddPreset(GameOptionPreset preset)
        {
            if (gameOptionPresetsIni == null)
            {
                LoadIni();
            }

            presets[preset.ProfileName] = preset;
            WriteIni();
        }