示例#1
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;
            }

            writer.WriteStartElement(TagName);  // start - TemplateItemGroup
            if (_frameworkType != TemplateFrameworkType.None)
            {
                writer.WriteAttributeString("FrameworkType", _frameworkType.ToString());
            }
            if (!String.IsNullOrEmpty(_condition))
            {
                writer.WriteAttributeString("Condition", _condition);
            }
            if (_properties != null && _properties.Count != 0)
            {
                foreach (KeyValuePair <string, string> pair in _properties)
                {
                    if (!String.IsNullOrEmpty(pair.Key) && !String.IsNullOrEmpty(pair.Value))
                    {
                        writer.WriteTextElement(pair.Key, pair.Value);
                    }
                }
            }
            writer.WriteEndElement();           // end - TemplateItemGroup
        }
示例#2
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;
            }

            writer.WriteStartElement(TagName);  // start - TemplateItemGroup
            if (_frameworkType != TemplateFrameworkType.None)
            {
                writer.WriteAttributeString("FrameworkType", _frameworkType.ToString());
            }
            if (!String.IsNullOrEmpty(_condition))
            {
                writer.WriteAttributeString("Condition", _condition);
            }
            if (_items != null && _items.Count != 0)
            {
                for (int i = 0; i < _items.Count; i++)
                {
                    _items[i].WriteXml(writer);
                }
            }
            writer.WriteEndElement();           // end - TemplateItemGroup
        }
示例#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");

            if (this.IsEmpty)
            {
                return;
            }

            writer.WriteStartElement(TagName);  // start - TemplateTargetFramework
            writer.WriteAttributeString("FrameworkType", _frameworkType.ToString());
            writer.WriteEndElement();           // end   - TemplateTargetFramework
        }