Esempio n. 1
0
        public override BuildKeyedList <BuildComponentConfiguration> Clone()
        {
            BuildComponentConfigurationList clonedList =
                new BuildComponentConfigurationList(this);

            int itemCount = this.Count;

            for (int i = 0; i < itemCount; i++)
            {
                clonedList.Add(this[i].Clone());
            }

            return(clonedList);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="BuildEngineSettings"/> class
        /// with parameters copied from the specified instance of the
        /// <see cref="BuildEngineSettings"/> class, a copy constructor.
        /// </summary>
        /// <param name="source">
        /// An instance of the <see cref="BuildEngineSettings"/> class from which the
        /// initialization parameters or values will be copied.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// If the parameter <paramref name="source"/> is <see langword="null"/>.
        /// </exception>
        protected BuildEngineSettings(BuildEngineSettings source)
            : base(source)
        {
            _engineName = source._engineName;
            _engineType = source._engineType;
            _properties = source._properties;

            _sharedContent  = source._sharedContent;
            _includeContent = source._includeContent;

            _configurations                = source._configurations;
            _pluginConfigurations          = source._pluginConfigurations;
            _componentConfigurations       = source._componentConfigurations;
            _pluginComponentConfigurations = source._pluginComponentConfigurations;
        }
        /// <overloads>
        /// Initializes a new instance of the <see cref="BuildEngineSettings"/> class.
        /// </overloads>
        /// <summary>
        /// Initializes a new instance of the <see cref="BuildEngineSettings"/> class
        /// with the default parameters.
        /// </summary>
        /// <param name="name">
        /// The name uniquely identifying this engine settings.
        /// </param>
        /// <param name="engineType">
        /// The engine type implementing this settings.
        /// </param>
        protected BuildEngineSettings(string name, BuildEngineType engineType)
        {
            BuildExceptions.NotNullNotEmpty(name, "name");

            _engineName     = name;
            _engineType     = engineType;
            _properties     = new BuildProperties();
            _sharedContent  = new SharedContent(_engineType.ToString());
            _includeContent = new IncludeContent(_engineType.ToString());

            _configurations                = new BuildConfigurationList(_engineType);
            _pluginConfigurations          = new BuildConfigurationList(_engineType);
            _componentConfigurations       = new BuildComponentConfigurationList(_engineType);
            _pluginComponentConfigurations = new BuildComponentConfigurationList(_engineType);
        }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BuildComponentConfigurationList"/> class
 /// with parameters copied from the specified instance of the
 /// <see cref="BuildComponentConfigurationList"/> class, a copy constructor.
 /// </summary>
 /// <param name="source">
 /// An instance of the <see cref="BuildComponentConfigurationList"/> class from which the
 /// initialization parameters or values will be copied.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// If the parameter <paramref name="source"/> is <see langword="null"/>.
 /// </exception>
 public BuildComponentConfigurationList(BuildComponentConfigurationList source)
     : base(source)
 {
     _engineType = source._engineType;
 }
        private void ReadXmlComponentConfiguration(XmlReader reader)
        {
            string startElement = reader.Name;

            Debug.Assert(String.Equals(startElement, "componentConfigurations"));

            if (reader.IsEmptyElement)
            {
                return;
            }

            // Determine whether we are dealing with plugin or system configuration
            bool isPlugin = String.Equals(reader.GetAttribute("type"),
                                          "Plugin", StringComparison.OrdinalIgnoreCase);

            if (_componentConfigurations == null)
            {
                _componentConfigurations = new BuildComponentConfigurationList();
            }
            if (_pluginComponentConfigurations == null)
            {
                _pluginComponentConfigurations = new BuildComponentConfigurationList();
            }

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    if (String.Equals(reader.Name, BuildComponentConfiguration.TagName,
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        BuildComponentConfiguration componentConfiguration = null;

                        string tempText = reader.GetAttribute("name");
                        if (!String.IsNullOrEmpty(tempText))
                        {
                            if (isPlugin)
                            {
                                componentConfiguration = _pluginComponentConfigurations[tempText];
                            }
                            else
                            {
                                componentConfiguration = _componentConfigurations[tempText];
                            }

                            // If the configuration is not found, lets create it...
                            if (componentConfiguration == null)
                            {
                                componentConfiguration = this.OnCreateComponentConfiguration(
                                    tempText, isPlugin);
                                if (componentConfiguration != null)
                                {
                                    if (isPlugin)
                                    {
                                        _pluginComponentConfigurations.Add(componentConfiguration);
                                    }
                                    else
                                    {
                                        _componentConfigurations.Add(componentConfiguration);
                                    }
                                }
                            }
                        }

                        if (componentConfiguration == null)
                        {
                            if (isPlugin)
                            {
                                throw new BuildException(String.Format(
                                                             "The plugin component configuration '{0}' cannot be found.", tempText));
                            }
                            else
                            {
                                throw new BuildException(String.Format(
                                                             "The system component configuration '{0}' cannot be found.", tempText));
                            }
                        }
                        componentConfiguration.ReadXml(reader);
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement)
                {
                    if (String.Equals(reader.Name, startElement, StringComparison.OrdinalIgnoreCase))
                    {
                        break;
                    }
                }
            }
        }