Beispiel #1
0
        public void AddConfig(SettingConfig config)
        {
            // Make sure another config with the new name does not already exist
            if (Settings.Count(x => string.Compare(x.Name, config.Name, true) == 0) > 0)
            {
                throw new Exception("A config with this name already exists");
            }

            Settings.Add(config);
            SaveConfigs();
        }
Beispiel #2
0
        public void DeleteConfig(SettingConfig config)
        {
            if (Settings.Contains(config))
            {
                if (Settings.Count <= 1)
                {
                    throw new Exception("Can not delete last config");
                }
            }
            Settings.Remove(config);
            if (ActiveConfig == config)
            {
                ActiveConfig = Settings.First();
            }

            SaveConfigs();
        }