Example #1
0
        public void RenameCompilerConfiguration(string configurationName, string newName)
        {
            if (string.IsNullOrWhiteSpace(configurationName))
            {
                throw new ArgumentException("Compiler configuration name cannot be null or whitespace.",
                                            "configurationName");
            }

            if (string.IsNullOrWhiteSpace(newName))
            {
                throw new ArgumentException("Compiler configuration name cannot be null or whitespace.",
                                            "newName");
            }


            if (!CompilerConfigurations.ContainsKey(configurationName))
            {
                throw new ArgumentException(
                          string.Format("Compiler configuration named {0} does not exist.", configurationName),
                          "configurationName");
            }

            bool resetCurrentlySelected = AppSettings.Settings.CurrentCompilerConfigurationName == configurationName;

            var old = CompilerConfigurations[configurationName];

            CompilerConfigurations.Remove(configurationName);
            CompilerConfigurations.Add(newName, old);

            if (resetCurrentlySelected)
            {
                AppSettings.Settings.CurrentCompilerConfigurationName = newName;
            }
        }
Example #2
0
        public void AddCompilerConfiguration(string configurationName)
        {
            if (string.IsNullOrWhiteSpace(configurationName))
            {
                throw new ArgumentException("Compiler configuration name cannot be null or whitespace.",
                                            "configurationName");
            }

            if (CompilerConfigurations.ContainsKey(configurationName))
            {
                throw new ArgumentException(
                          string.Format("Compiler configuration named {0} already exist.", configurationName),
                          "configurationName");
            }


            CompilerConfigurations.Add(configurationName, DefaultValueInitializer.Init(new CompilerConfigurationNode()));
        }
Example #3
0
        public void RemoveCompilerConfiguration(string configurationName, string newCurrentConfiguration)
        {
            if (string.IsNullOrWhiteSpace(configurationName))
            {
                throw new ArgumentException("Compiler configuration name cannot be null or whitespace.",
                                            "configurationName");
            }

            if (string.IsNullOrWhiteSpace(newCurrentConfiguration))
            {
                throw new ArgumentException("Compiler configuration name cannot be null or whitespace.",
                                            "newCurrentConfiguration");
            }


            if (!CompilerConfigurations.ContainsKey(configurationName))
            {
                throw new ArgumentException(
                          string.Format("Compiler configuration named {0} does not exist.", configurationName),
                          "configurationName");
            }

            if (!CompilerConfigurations.ContainsKey(newCurrentConfiguration))
            {
                throw new ArgumentException(
                          string.Format("Compiler configuration named {0} does not exist.", newCurrentConfiguration),
                          "newCurrentConfiguration");
            }

            if (CompilerConfigurations.Count == 1)
            {
                throw new InvalidOperationException(
                          "There must be at least one compiler configuration present in the " +
                          "application settings, cannot remove the configuration as it is the only one present.");
            }


            CompilerConfigurations.Remove(configurationName);

            CurrentCompilerConfigurationName = newCurrentConfiguration;
        }