Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BuildStep"/> class with the
        /// specified name and working directory.
        /// </summary>
        /// <param name="name">
        /// A <see cref="System.String"/> containing the name of this build step.
        /// </param>
        /// <param name="workingDir">
        /// A <see cref="System.String"/> containing the working directory of this
        /// build step.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// If the <paramref name="name"/> is <see langword="null"/>.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// If the <paramref name="name"/> is empty.
        /// </exception>
        protected BuildStep(string name, string workingDir)
            : this(workingDir)
        {
            BuildExceptions.NotNullNotEmpty(name, "name");

            _name = name;
        }
Exemplo n.º 2
0
        public void BeginDirectories(BuildSettings settings)
        {
            BuildExceptions.NotNull(settings, "settings");

            this.BeginDirectories(settings.WorkingDirectory,
                                  settings.OutputDirectory);
        }
Exemplo n.º 3
0
        /// <summary>
        /// This writes the current state or attributes of this object,
        /// in the <c>XML</c> format, to the media or storage accessible by the given writer.
        /// </summary>
        /// <param name="writer">
        /// The <c>XML</c> writer with which the <c>XML</c> format of this object's state
        /// is written.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// If the <paramref name="reader"/> is <see langword="null"/>.
        /// </exception>
        public override void WriteXml(XmlWriter writer)
        {
            BuildExceptions.NotNull(writer, "writer");

            writer.WriteStartElement(TagName);  // start - loggingOptions
            writer.WriteAttributeString("type", "Logging");
            writer.WriteAttributeString("name", this.GetType().ToString());

            writer.WriteStartElement("propertyGroup");  // start - propertyGroup
            writer.WriteAttributeString("name", "General");
            writer.WritePropertyElement("Verbosity", _verbosity.ToString());
            writer.WritePropertyElement("UseFile", _useFile);
            writer.WritePropertyElement("KeepFile", _keepFile);
            writer.WritePropertyElement("FileName", _fileName);
            writer.WriteEndElement();                   // end - propertyGroup

            BuildDirectoryPath.WriteLocation(_outputPath, "location", writer);

            writer.WriteStartElement("loggers");  // start - loggers
            if (_loggers != null && _loggers.Count != 0)
            {
                for (int i = 0; i < _loggers.Count; i++)
                {
                    writer.WriteStartElement("logger"); // start - logger
                    writer.WriteAttributeString("name", _loggers[i]);
                    writer.WriteEndElement();           // end - logger
                }
            }
            writer.WriteEndElement();           // end - loggers

            writer.WriteEndElement();           // end - loggingOptions
        }
Exemplo n.º 4
0
        protected BuildGroupTocInfo(string name, string tocFile)
            : base(name)
        {
            BuildExceptions.NotNull(tocFile, "tocFile");

            _tocFile = tocFile;
        }
Exemplo n.º 5
0
        public bool Configure(BuildGroup group, XmlWriter writer)
        {
            BuildExceptions.NotNull(group, "group");
            BuildExceptions.NotNull(writer, "writer");

            // If not showing the logo and/or eliminating header feedback, then
            // there is nothing to configure...
            if (!_logoEnabled && _feedbackType != BuildFeedbackType.None)
            {
                return(true);
            }

            writer.WriteStartElement("header");  //start: header
            if (_feedbackType == BuildFeedbackType.None)
            {
                // If no feedback is requested, then remove it from the header...
                writer.WriteAttributeString("feedback", "False");
            }

            if (_logoEnabled && !String.IsNullOrEmpty(_logoImage))
            {
                string imagePath = Path.GetFullPath(_logoImage);
                if (File.Exists(imagePath))
                {
                    writer.WriteStartElement("logo");  //start: logo
                    if (_logoWidth > 0 && _logoHeight > 0)
                    {
                        writer.WriteAttributeString("width", _logoWidth.ToString());
                        writer.WriteAttributeString("height", _logoHeight.ToString());
                    }
                    if (_logoPadding >= 0)
                    {
                        writer.WriteAttributeString("padding", _logoPadding.ToString());
                    }

                    writer.WriteStartElement("image");  //start: image
                    writer.WriteAttributeString("path", imagePath);
                    writer.WriteAttributeString("altText", _logoText);
                    writer.WriteEndElement();           //end: image

                    if (!String.IsNullOrEmpty(_logoLink))
                    {
                        writer.WriteStartElement("link");   //start: link
                        writer.WriteAttributeString("uri", _logoLink);
                        writer.WriteEndElement();           //end: link
                    }

                    writer.WriteStartElement("position");   //start: position
                    writer.WriteAttributeString("placement", _logoPlacement.ToString());
                    writer.WriteAttributeString("alignment", _logoAlignment.ToString());
                    writer.WriteEndElement();          //end: position

                    writer.WriteEndElement();          //end: logo
                }
            }

            writer.WriteEndElement();            //end: header

            return(true);
        }
Exemplo n.º 6
0
        public void Initialize(BuildContext context)
        {
            BuildExceptions.NotNull(context, "context");

            _context       = context;
            _isInitialized = true;
        }
Exemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BuildDeployment"/> class
        /// with initial parameters copied from the specified instance of the
        /// specified <see cref="BuildDeployment"/> class, a copy constructor.
        /// </summary>
        /// <param name="source">
        /// An instance of the <see cref="BuildDeployment"/> 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 BuildDeployment(BuildDeployment source)
        {
            BuildExceptions.NotNull(source, "source");

            _isEnabled        = source._isEnabled;
            _includeSourceDir = source._includeSourceDir;
        }
Exemplo n.º 8
0
        protected BuildGroupContext(BuildGroup group)
            : this()
        {
            BuildExceptions.NotNull(group, "group");

            _group = group;
        }
Exemplo n.º 9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BuildKeyedList{T}"/> class
        /// with parameters copied from the specified instance of the
        /// <see cref="BuildKeyedList{T}"/> class, a copy constructor.
        /// </summary>
        /// <param name="source">
        /// An instance of the <see cref="BuildKeyedList{T}"/> 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 BuildKeyedList(BuildKeyedList <T> source)
        {
            BuildExceptions.NotNull(source, "source");

            _version  = source._version;
            _dicItems = source._dicItems;
        }
Exemplo n.º 10
0
        /// <summary>
        /// This replaces the element at the specified index.
        /// </summary>
        /// <param name="index">
        /// The zero-based index of the element to replace.
        /// </param>
        /// <param name="newItem">
        /// The new value for the element at the specified index.
        /// The value cannot be a <see langword="null"/>.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// If the <typeparamref name="newItem"/> is <see langword="null"/>.
        /// </exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// If the <paramref name="index"/> is less than zero
        /// <para>-or-</para>
        /// If the <paramref name="index"/> is greater than the total count.
        /// </exception>
        protected override void SetItem(int index, T newItem)
        {
            BuildExceptions.NotNull(newItem, "newItem");

            string itemName = newItem.Name;

            if (String.IsNullOrEmpty(itemName))
            {
                return;
            }

            _version++;

            T      replaced     = Items[index];
            string replacedName = replaced.Name;

            if (!String.Equals(replacedName, itemName,
                               StringComparison.OrdinalIgnoreCase))
            {
                _dicItems.Remove(replacedName); // remove the current first
            }

            base.SetItem(index, newItem);

            _dicItems[itemName] = index;

            if (Changed != null)
            {
                Changed(this, new BuildListEventArgs <T>(
                            BuildListChangeType.Replaced, replaced, newItem, index));
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BuildContent{T, U}"/>
        /// class with the specified list of items.
        /// </summary>
        /// <param name="itemList">
        /// An initial list of content items of the type, <see cref="BuildItem{T}"/>.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// If the <paramref name="itemList"/> is <see langword="null"/>.
        /// </exception>
        protected BuildContent(IList <T> itemList)
        {
            BuildExceptions.NotNull(itemList, "itemList");

            _listItems     = itemList;
            _isInitialized = null;
        }
Exemplo n.º 12
0
        /// <summary>
        /// Initializes this build step with the specified current build context
        /// of the build process. This prepares the build step for the task execution.
        /// </summary>
        /// <param name="context">
        /// An instance of the <see cref="BuildContext"/> class, specifying the current
        /// build context of the build process.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// If the <paramref name="context"/> is <see langword="null"/>.
        /// </exception>
        /// <seealso cref="BuildStep.IsInitialized"/>
        /// <seealso cref="BuildStep.Uninitialize()"/>
        public virtual void Initialize(BuildContext context)
        {
            BuildExceptions.NotNull(context, "context");

            _isInitialized = false;
            if (_beforeSteps != null && _beforeSteps.Enabled)
            {
                _beforeSteps.Initialize(context);

                if (!_beforeSteps.IsInitialized)
                {
                    return;
                }
            }

            if (_afterSteps != null && _afterSteps.Enabled)
            {
                _afterSteps.Initialize(context);

                if (!_afterSteps.IsInitialized)
                {
                    return;
                }
            }

            _context = context;
            if (_verbosity == BuildLoggerVerbosity.None)
            {
                _verbosity = _context.Settings.Logging.Verbosity;
            }

            _isInitialized = true;
        }
Exemplo n.º 13
0
        /// <summary>
        /// This writes the current state or attributes of this object,
        /// in the <c>XML</c> format, to the media or storage accessible by the given writer.
        /// </summary>
        /// <param name="writer">
        /// The <c>XML</c> writer with which the <c>XML</c> format of this object's state
        /// is written.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// If the <paramref name="reader"/> is <see langword="null"/>.
        /// </exception>
        public override void WriteXml(XmlWriter writer)
        {
            BuildExceptions.NotNull(writer, "writer");

            if (this.IsEmpty)
            {
                return;
            }

            // <topic id="" project="" file="">
            writer.WriteStartElement(TagName); // start: topic
            writer.WriteAttributeString("id", this.Name);
            if (_container != null)            // the container (or project) can be empty for root...
            {
                writer.WriteAttributeString("project", _container);
            }
            writer.WriteAttributeString("file", _source);

            if (_listTopics != null && _listTopics.Count != 0)
            {
                for (int i = 0; i < _listTopics.Count; i++)
                {
                    _listTopics[i].WriteXml(writer);
                }
            }

            writer.WriteEndElement();           // end: topic
        }
Exemplo n.º 14
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, String.Format(
                                 "The element name '{0}' does not match the expected '{1}'.",
                                 reader.Name, TagName));
                return;
            }

            string tempText = reader.GetAttribute("type");

            if (!String.IsNullOrEmpty(tempText))
            {
                _specialSdkType = BuildSpecialSdkType.Parse(tempText);
            }
            if (reader.IsEmptyElement)
            {
                return;
            }

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name.ToLower())
                    {
                    case "version":
                        _version = new Version(reader.ReadString());
                        break;

                    case "assemblyDir":
                        _assemblyDir = reader.ReadString();
                        break;

                    case "commentDir":
                        _commentDir = reader.ReadString();
                        break;
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement)
                {
                    if (String.Equals(reader.Name, TagName,
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        break;
                    }
                }
            }
        }
Exemplo n.º 15
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, String.Format(
                                 "The element name '{0}' does not match the expected '{1}'.",
                                 reader.Name, TagName));
                return;
            }

            if (reader.IsEmptyElement)
            {
                return;
            }

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    if (String.Equals(reader.Name, "propertyGroup",
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        this.ReadXmlGeneral(reader);
                    }
                    else if (String.Equals(reader.Name, "logger",
                                           StringComparison.OrdinalIgnoreCase))
                    {
                        string nodeText = reader.GetAttribute("name");

                        if (!String.IsNullOrEmpty(nodeText))
                        {
                            _loggers.Add(nodeText);
                        }
                    }
                    else if (String.Equals(reader.Name, "location",
                                           StringComparison.OrdinalIgnoreCase))
                    {
                        _outputPath = BuildDirectoryPath.ReadLocation(reader);
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement)
                {
                    if (String.Equals(reader.Name, TagName,
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        break;
                    }
                }
            }
        }
Exemplo n.º 16
0
        public BuildFramework(BuildFrameworkType type, string assemblyDir,
                              IList <string> commentDirs, Version version)
            : this(type, commentDirs, version)
        {
            BuildExceptions.NotNullNotEmpty(assemblyDir, "assemblyDir");

            _assemblyDir = assemblyDir;
        }
Exemplo n.º 17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BuildListEventArgs{T}"/>
        /// class with the given parameters.
        /// </summary>
        /// <param name="change">The type of the change.</param>
        /// <param name="item">The item affected by the change.</param>
        /// <param name="replacement">
        /// A replacement for the affected item, where available or applicable.
        /// </param>
        /// <param name="index">
        /// The zero-based index at which the change is occurring.
        /// </param>
        public BuildListEventArgs(BuildListChangeType change,
                                  T item, T replacement, int index, string name)
            : this(change, item, replacement, index)
        {
            BuildExceptions.NotNullNotEmpty(name, "name");

            _name = name;
        }
Exemplo n.º 18
0
        public virtual void Insert(int index, T item)
        {
            BuildExceptions.NotNull(item, "item");

            item.Content = this;

            _listItems.Insert(index, item);
        }
Exemplo n.º 19
0
        public virtual void Add(T item)
        {
            BuildExceptions.NotNull(item, "item");

            item.Content = this;

            _listItems.Add(item);
        }
Exemplo n.º 20
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BuildContent{T, U}"/>
        /// class with initial parameters copied from the specified instance of
        /// the specified <see cref="BuildContent{T, U}"/> class, a copy constructor.
        /// </summary>
        /// <param name="source">
        /// An instance of the <see cref="BuildContent{T, U}"/> 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 BuildContent(BuildContent <T, U> source)
        {
            BuildExceptions.NotNull(source, "source");

            _listItems     = source._listItems;
            _isModified    = source._isModified;
            _isInitialized = source._isInitialized;
        }
Exemplo n.º 21
0
        protected BuildGroupContext(BuildGroup group, string contextId)
            : this()
        {
            BuildExceptions.NotNull(group, "group");

            _group     = group;
            _contextId = contextId;
        }
Exemplo n.º 22
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ConceptualOptions"/> class
        /// with the specified group visitor name.
        /// </summary>
        /// <param name="visitorName">
        /// A <see cref="System.String"/> specifying the name of this group visitor.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// If the <paramref name="visitorName"/> is <see langword="null"/>.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// If the <paramref name="visitorName"/> is empty.
        /// </exception>
        protected BuildGroupVisitor(string visitorName)
        {
            BuildExceptions.NotNullNotEmpty(visitorName, "visitorName");

            _name            = visitorName;
            _isEnabled       = true;
            _continueOnError = true;
        }
Exemplo n.º 23
0
        /// <summary>
        /// This inserts an element into the <see cref="BuildKeyedList{T}">collection</see>
        /// at the specified index.
        /// </summary>
        /// <param name="index">
        /// The zero-based index at which item should be inserted.
        /// </param>
        /// <param name="newItem">
        /// The object to insert. The value cannot be a <see langword="null"/>.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// If the <typeparamref name="newItem"/> is <see langword="null"/>.
        /// </exception>
        /// <exception cref="ArgumentOutOfRangeException">
        /// If the <paramref name="index"/> is less than zero
        /// <para>-or-</para>
        /// If the <paramref name="index"/> is greater than the total count.
        /// </exception>
        protected override void InsertItem(int index, T newItem)
        {
            BuildExceptions.NotNull(newItem, "newItem");

            string itemName = newItem.Name;

            if (String.IsNullOrEmpty(itemName))
            {
                return;
            }
            int curIndex = -1;

            if (_dicItems.TryGetValue(itemName, out curIndex))
            {
                T replaced = Items[curIndex];
                base.SetItem(curIndex, newItem);

                _dicItems[itemName] = curIndex;

                if (Changed != null)
                {
                    Changed(this, new BuildListEventArgs <T>(
                                BuildListChangeType.Replaced, replaced, newItem, curIndex));
                }
            }
            else
            {
                if (_suspendIndex)
                {
                    base.InsertItem(index, newItem);
                }
                else
                {
                    if (index >= this.Count)
                    {
                        base.InsertItem(index, newItem);
                        _dicItems.Add(itemName, index);
                    }
                    else
                    {
                        base.InsertItem(index, newItem);

                        for (int i = index; i < this.Count; i++)
                        {
                            _dicItems[this[i].Name] = i;
                        }
                    }

                    _version++;

                    if (Changed != null)
                    {
                        Changed(this, new BuildListEventArgs <T>(
                                    BuildListChangeType.Added, newItem, null, index));
                    }
                }
            }
        }
Exemplo n.º 24
0
        /// <summary>
        /// This writes the current state or attributes of this object,
        /// in the <c>XML</c> format, to the media or storage accessible by the given writer.
        /// </summary>
        /// <param name="writer">
        /// The <c>XML</c> writer with which the <c>XML</c> format of this object's state
        /// is written.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// If the <paramref name="reader"/> is <see langword="null"/>.
        /// </exception>
        public override void WriteXml(XmlWriter writer)
        {
            BuildExceptions.NotNull(writer, "writer");

            writer.WriteStartElement(TagName);  // start - TagName
            writer.WriteAttributeString("version", _version.ToString(2));

            //  1. Documentation: Settings of the documentation
            writer.WriteComment(" 1. Documentation: Settings of the documentation ");
            if (_settings != null)
            {
                _settings.WriteXml(writer);
            }

            // 2. Documentation: Group sources of the documentation
            writer.WriteComment(" 2. Documentation: Group sources of the documentation ");
            writer.WriteStartElement("documentSources"); // start - documentSources
            if (_listSources != null && _listSources.Count != 0)
            {
                for (int i = 0; i < _listSources.Count; i++)
                {
                    _listSources[i].WriteXml(writer);
                }
            }
            writer.WriteEndElement();                    // end - documentSources

            // 3. Documentation: Groups of the documentation
            writer.WriteComment(" 3. Documentation: Groups of the documentation ");
            writer.WriteStartElement("documentGroups"); // start - documentGroups
            if (_listGroups != null && _listGroups.Count != 0)
            {
                BuildPathResolver resolver = BuildPathResolver.Resolver;
                Debug.Assert(resolver != null && resolver.Id == _documentId);

                for (int i = 0; i < _listGroups.Count; i++)
                {
                    BuildGroup group = _listGroups[i];

                    BuildFilePath filePath = group.ContentFile;
                    if (filePath != null && filePath.IsValid)
                    {
                        writer.WriteStartElement(BuildGroup.TagName);
                        writer.WriteAttributeString("type", group.GroupType.ToString());
                        writer.WriteAttributeString("source", resolver.ResolveRelative(filePath));
                        writer.WriteEndElement();

                        group.Save();
                    }
                    else
                    {
                        group.WriteXml(writer);
                    }
                }
            }
            writer.WriteEndElement();           // end - documentGroups

            writer.WriteEndElement();           // end - TagName
        }
Exemplo n.º 25
0
        public virtual void BeginGroups(IBuildNamedList <BuildGroup> groups,
                                        IBuildNamedList <BuildGroupContext> contexts)
        {
            BuildExceptions.NotNull(groups, "groups");
            BuildExceptions.NotNull(contexts, "contexts");

            _listGroups    = groups;
            _groupContexts = contexts;
        }
Exemplo n.º 26
0
        /// <summary>
        /// This writes the current state or attributes of this object,
        /// in the <c>XML</c> format, to the media or storage accessible by the given writer.
        /// </summary>
        /// <param name="writer">
        /// The <c>XML</c> writer with which the <c>XML</c> format of this object's state
        /// is written.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// If the <paramref name="reader"/> is <see langword="null"/>.
        /// </exception>
        public override void WriteXml(XmlWriter writer)
        {
            BuildExceptions.NotNull(writer, "writer");

            writer.WriteStartElement(TagName);  // start - styleOptions
            writer.WriteAttributeString("type", "Style");
            writer.WriteAttributeString("name", this.GetType().ToString());

            writer.WriteStartElement("propertyGroup");  // start - propertyGroup
            writer.WriteAttributeString("name", "General");
            writer.WritePropertyElement("StyleName", _styleName);
            writer.WritePropertyElement("StyleType", _styleType.ToString());
            writer.WriteEndElement();                   // end - propertyGroup

            BuildDirectoryPath.WriteLocation(_styleDir, "location", writer);
            BuildFilePath.WriteLocation(_stylePresentation, "presentation", writer);

            writer.WriteStartElement("contents");  // start - contents
            if (_scripts != null)
            {
                writer.WriteStartElement("content");
                writer.WriteAttributeString("type", "Scripts");
                _scripts.WriteXml(writer);
                writer.WriteEndElement();
            }
            if (_snippets != null)
            {
                writer.WriteStartElement("content");
                writer.WriteAttributeString("type", "Snippets");
                _snippets.WriteXml(writer);
                writer.WriteEndElement();
            }
            if (_styleSheets != null)
            {
                writer.WriteStartElement("content");
                writer.WriteAttributeString("type", "StyleSheets");
                _styleSheets.WriteXml(writer);
                writer.WriteEndElement();
            }
            if (_mathPackages != null)
            {
                writer.WriteStartElement("content");
                writer.WriteAttributeString("type", "Packages");
                _mathPackages.WriteXml(writer);
                writer.WriteEndElement();
            }
            if (_mathCommands != null)
            {
                writer.WriteStartElement("content");
                writer.WriteAttributeString("type", "Commands");
                _mathCommands.WriteXml(writer);
                writer.WriteEndElement();
            }
            writer.WriteEndElement();           // end - contents

            writer.WriteEndElement();           // end - styleOptions
        }
Exemplo n.º 27
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, String.Format(
                                 "The element name '{0}' does not match the expected '{1}'.",
                                 reader.Name, TagName));
                return;
            }

            if (reader.IsEmptyElement)
            {
                return;
            }

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

                    case "location":
                        _styleDir = BuildDirectoryPath.ReadLocation(reader);
                        break;

                    case "presentation":
                        _stylePresentation = BuildFilePath.ReadLocation(reader);
                        break;

                    case "contents":
                        this.ReadXmlContents(reader);
                        break;
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement)
                {
                    if (String.Equals(reader.Name, TagName,
                                      StringComparison.OrdinalIgnoreCase))
                    {
                        break;
                    }
                }
            }
        }
Exemplo n.º 28
0
        public virtual void Add(ICollection <BuildCredential> credentials)
        {
            BuildExceptions.NotNull(credentials, "credentials");

            foreach (BuildCredential credential in credentials)
            {
                this.Add(credential);
            }
        }
Exemplo n.º 29
0
        public virtual void Add(ICollection <T> items)
        {
            BuildExceptions.NotNull(items, "items");

            foreach (T item in items)
            {
                this.Add(item);
            }
        }
Exemplo n.º 30
0
        public void AddSources(IList <BuildGroupSource> sources)
        {
            BuildExceptions.NotNull(sources, "sources");

            for (int i = 0; i < sources.Count; i++)
            {
                this.AddSource(sources[i]);
            }
        }