Пример #1
0
        public virtual void Uninitialize()
        {
            _logger      = null;
            _dicContents = null;

            _isInitialized = false;
        }
Пример #2
0
 public void ClearContents()
 {
     if (_dicContents != null)
     {
         _dicContents = new BuildProperties();
     }
 }
Пример #3
0
 public BuildTocContext(BuildTocContext source)
 {
     _properties    = source._properties;
     _isLoaded      = source._isLoaded;
     _isInitialized = source._isInitialized;
     _context       = source._context;
     _dicItems      = source._dicItems;
 }
Пример #4
0
        public void LoadContent(string contentFile)
        {
            if (_dicContents == null)
            {
                _dicContents = new BuildProperties();
            }

            LogMessage(BuildLoggerLevel.Info, String.Format(
                           "Loading shared content file '{0}'.", contentFile));

            XmlReader reader = null;

            try
            {
                reader = XmlReader.Create(contentFile);
                reader.MoveToContent();
                while (!reader.EOF)
                {
                    if ((reader.NodeType == XmlNodeType.Element) &&
                        (reader.Name == "item"))
                    {
                        string key   = reader.GetAttribute("id");
                        string value = reader.ReadInnerXml();
                        _dicContents[key] = value;
                    }
                    else
                    {
                        reader.Read();
                    }
                }
            }
            catch (IOException ex)
            {
                LogMessage(BuildLoggerLevel.Error, String.Format(
                               "The shared content file '{0}' could not be opened. The error message is: {1}",
                               contentFile, GetExceptionMessage(ex)));
            }
            catch (XmlException ex)
            {
                LogMessage(BuildLoggerLevel.Error, String.Format(
                               "The shared content file '{0}' is not well-formed. The error message is: {1}",
                               contentFile, GetExceptionMessage(ex)));
            }
            catch (XmlSchemaException ex)
            {
                LogMessage(BuildLoggerLevel.Error, String.Format(
                               "The shared content file '{0}' is not valid. The error message is: {1}",
                               contentFile, GetExceptionMessage(ex)));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                    reader = null;
                }
            }
        }
Пример #5
0
        public BuildTocContext()
        {
            _properties = new BuildProperties();

            _listItems     = new BuildKeyedList <BuildGroupTocInfo>();
            _relatedTopics = new BuildKeyedList <BuildTopicTocInfo>();

            _dicItems = _listItems.Dictionary;
        }
Пример #6
0
        public BuildProperties Clone()
        {
            BuildProperties properties = new BuildProperties(_dictionary.Comparer);

            Dictionary <string, string> dictionary = properties._dictionary;

            foreach (KeyValuePair <string, string> pair in _dictionary)
            {
                dictionary[pair.Key] = String.Copy(pair.Value);
            }

            return(properties);
        }
Пример #7
0
        /// <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;
        }
Пример #8
0
        /// <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);
        }
Пример #9
0
        public void AddContentItem(string itemName, string itemValue)
        {
            BuildExceptions.NotNullNotEmpty(itemName, "itemName");

            if (itemValue == null)
            {
                itemValue = String.Empty;
            }

            if (_dicContents == null)
            {
                _dicContents = new BuildProperties();
            }

            _dicContents[itemName] = itemValue;
        }
Пример #10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="system"></param>
        public BuildContext(BuildSystem system, BuildType type)
        {
            _buildType   = type;
            _buildState  = BuildState.None;
            _buildSystem = system;
            _properties  = new BuildProperties();
            _objects     = new BuildDictionary <object>();

            _targetPlatform      = String.Empty;
            _targetConfiguration = String.Empty;

            _tocContext   = new BuildTocContext();
            _buildOutputs = new List <BuildTuple <BuildFormatType, string> >();

            // Reset to the default properties
            this.Reset();
        }
Пример #11
0
 private BuildGroupContext()
 {
     _properties = new BuildProperties();
     _objects    = new BuildDictionary<object>();
 }
Пример #12
0
        /// <summary>
        /// This reads and sets its state or attributes stored in a <c>XML</c> format
        /// with the given reader.
        /// </summary>
        /// <param name="reader">
        /// The reader with which the <c>XML</c> attributes of this object are accessed.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// If the <paramref name="reader"/> is <see langword="null"/>.
        /// </exception>
        public override void ReadXml(XmlReader reader)
        {
            BuildExceptions.NotNull(reader, "reader");

            Debug.Assert(reader.NodeType == XmlNodeType.Element);
            if (reader.NodeType != XmlNodeType.Element)
            {
                return;
            }

            if (!String.Equals(reader.Name, TagName,
                               StringComparison.OrdinalIgnoreCase))
            {
                Debug.Assert(false, "The processing of the engine settings ReadXml is not valid");
                return;
            }
            string tempText = reader.GetAttribute("name");

            if (!String.IsNullOrEmpty(tempText))
            {
                _engineName = tempText;
            }
            tempText = reader.GetAttribute("type");
            if (!String.IsNullOrEmpty(tempText))
            {
                _engineType = (BuildEngineType)Enum.Parse(
                    typeof(BuildEngineType), tempText, true);
            }

            if (reader.IsEmptyElement)
            {
                return;
            }

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name.ToLower())
                    {
                    case "propertygroup":
                        this.OnReadXml(reader);
                        break;

                    case "propertybag":
                        if (_properties == null)
                        {
                            _properties = new BuildProperties();
                        }
                        _properties.ReadXml(reader);
                        break;

                    case "contents":
                        this.ReadXmlContents(reader);
                        break;

                    case "configurations":
                        this.ReadXmlConfiguration(reader);
                        break;

                    case "componentconfigurations":
                        this.ReadXmlComponentConfiguration(reader);
                        break;
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement)
                {
                    if (String.Equals(reader.Name, TagName,
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        break;
                    }
                }
            }
        }
Пример #13
0
 /// <overloads>
 /// Initializes a new instance of the <see cref="BuildStep"/> class.
 /// </overloads>
 /// <summary>
 /// Initializes a new instance of the <see cref="BuildStep"/> class
 /// to the default properties or values.
 /// </summary>
 protected BuildStep()
 {
     _isEnabled   = true;
     _logTimeSpan = true;
     _properties  = new BuildProperties();
 }