public void RenameEditorControlConfiguration(string configurationName, string newName) { if (string.IsNullOrWhiteSpace(configurationName)) { throw new ArgumentException("Editor configuration name cannot be null or whitespace.", "configurationName"); } if (string.IsNullOrWhiteSpace(newName)) { throw new ArgumentException("Editor configuration name cannot be null or whitespace.", "newName"); } if (!EditorControlConfigurations.ContainsKey(configurationName)) { throw new ArgumentException( string.Format("Editor configuration named {0} does not exist.", configurationName), "configurationName"); } bool resetCurrentlySelected = AppSettings.Settings.CurrentCompilerConfigurationName == configurationName; var old = EditorControlConfigurations[configurationName]; EditorControlConfigurations.Remove(configurationName); EditorControlConfigurations.Add(newName, old); if (resetCurrentlySelected) { AppSettings.Settings.CurrentEditorControlConfigurationName = newName; } }
public void AddEditorControlConfiguration(string configurationName) { if (string.IsNullOrWhiteSpace(configurationName)) { throw new ArgumentException("Editor configuration name cannot be null or whitespace.", "configurationName"); } if (EditorControlConfigurations.ContainsKey(configurationName)) { throw new ArgumentException( string.Format("Editor configuration named {0} already exist.", configurationName), "configurationName"); } EditorControlConfigurations.Add(configurationName, DefaultValueInitializer.Init(new EditorControlSettingsNode())); }
public void RemoveEditorControlConfiguration(string configurationName, string newCurrentConfiguration) { if (string.IsNullOrWhiteSpace(configurationName)) { throw new ArgumentException("Editor configuration name cannot be null or whitespace.", "configurationName"); } if (string.IsNullOrWhiteSpace(newCurrentConfiguration)) { throw new ArgumentException("Editor configuration name cannot be null or whitespace.", "newCurrentConfiguration"); } if (!EditorControlConfigurations.ContainsKey(configurationName)) { throw new ArgumentException( string.Format("Editor configuration named {0} does not exist.", configurationName), "configurationName"); } if (!EditorControlConfigurations.ContainsKey(newCurrentConfiguration)) { throw new ArgumentException( string.Format("Editor configuration named {0} does not exist.", newCurrentConfiguration), "newCurrentConfiguration"); } if (EditorControlConfigurations.Count == 1) { throw new InvalidOperationException( "There must be at least one editor configuration present in the " + "application settings, cannot remove the configuration as it is the only one present."); } EditorControlConfigurations.Remove(configurationName); CurrentEditorControlConfigurationName = newCurrentConfiguration; }