Example #1
0
        /*=== overrides ===*/

        // Reload the global options.
        public override void Load()
        {
            string           file = Paths.GetGlobalOptionsFilename();
            GlobalOptionsSet os   = null;

            // Load the global options.
            XmlUtility.LoadXml(file, ref os);

            if (os == null)
            {
                this.Options = new List <OptionsElement>();
            }
            else
            {
                this.Options = os.Options;
            }

            // If the 'GlobalOptionsConfigurationName' configuration does not exist, add it.
            if (GetConfiguration(GlobalConfigurationName, GlobalPlatformName) == null)
            {
                OptionsElement oe = new OptionsElement();

                oe.Configuration = GlobalConfigurationName;
                oe.Platform      = GlobalPlatformName;

                AddConfiguration(oe);

                // Save the new global options.
                Save();
            }
        }
Example #2
0
        // Returns true if the specified configuration exists.
        public bool ConfigurationExists(string configuration, string platform)
        {
            OptionsElement oe = options.Find(
                delegate(OptionsElement x)
            {
                return(x.Configuration == configuration && x.Platform == platform);
            }
                );

            return(oe != null);
        }
Example #3
0
        /*=== utility ===*/

        // Gets a new configuration (if it doesn't already exist).
        public OptionsElement GetNewConfiguration(string configuration, string platform)
        {
            OptionsElement oe = GetConfiguration(configuration, platform);

            if (oe == null)
            {
                oe = new OptionsElement();

                oe.Configuration = configuration;
                oe.Platform      = platform;
                oe.Options.SetDefaults();

                AddConfiguration(oe);
            }

            return(oe);
        }
        /*=== utility ===*/

        // Call this to initialize settings.
        public virtual void Initialize(Project p)
        {
            project        = p;
            gOptions       = new Options(OptionsManager.GetGlobalOptions().GetGlobalConfiguration().Options);
            ProjectOptions = new ProjectOptionsSet(project);

            /*=== add the existing options ===*/

            List <OptionsElement> options = OptionsManager.GetProjectOptions(p).Options;

            foreach (OptionsElement oe in options)
            {
                OptionsElement newOE = new OptionsElement();
                newOE.Configuration = oe.Configuration;
                newOE.Platform      = oe.Platform;
                newOE.Options       = new Options(oe.Options);

                ProjectOptions.AddConfiguration(newOE);
            }
        }
Example #5
0
        /*=== overrides ===*/

        // Reload this project's options file.
        public override void Load()
        {
            if (project == null)
            {
                return;
            }

            string            file = Paths.GetProjectOptionsFilename(project);
            ProjectOptionsSet os   = null;

            // Load the project options.
            XmlUtility.LoadXml(file, ref os);

            if (os == null)
            {
                this.Options = new List <OptionsElement>();
            }
            else
            {
                this.Options = os.Options;
            }

            string activeConfiguration = ProjectUtility.GetActiveConfiguration(project);
            string activePlatform      = ProjectUtility.GetActivePlatform(project);

            if (GetConfiguration(activeConfiguration, activePlatform) == null)
            {
                OptionsElement oe = new OptionsElement();

                oe.Configuration = activeConfiguration;
                oe.Platform      = activePlatform;
                oe.Options.SetDefaults();

                AddConfiguration(oe);

                // Save the new project options.
                Save();
            }
        }
Example #6
0
        /*=== utility ===*/

        // Add a set of options for a particular configuration to the options set.
        public void AddConfiguration(OptionsElement optionsElement)
        {
            RemoveConfiguration(optionsElement.Configuration, optionsElement.Platform);
            options.Add(optionsElement);
        }