Ejemplo n.º 1
0
        /// <summary>
        /// 将对象转换为其 XML 表示形式。
        /// </summary>
        /// <param name="writer">对象要序列化为的 <see cref="T:System.Xml.XmlWriter" /> 流。</param>
        public override void WriteXml(XmlWriter writer)
        {
            if (!string.IsNullOrEmpty(ModuleId))
            {
                writer.WriteAttributeString("moduleId", ModuleId);
            }

            writer.WriteAttributeString("type", Type);
            writer.WriteAttributeString("enumerator", ScopeIEnumerableInstance);

            if (BuildInstance)
            {
                writer.WriteAttributeString("isInstance", BuildInstance.ToString());
            }
            writer.WriteAttributeString("target", Target.ToString());

            writer.WriteStartElement("match");
            Match.WriteXml(writer);
            writer.WriteEndElement();

            writer.WriteStartElement("invoke");
            writer.WriteAttributeString("type", typeof(ModuleBuildStepElement).GetNoVersionTypeName());
            foreach (ModuleBuildStepElement step in Steps)
            {
                step.ObjectWriteXml(writer);
            }
            writer.WriteEndElement();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 将对象转换为其 XML 表示形式。
        /// </summary>
        /// <param name="writer">对象要序列化为的 <see cref="T:System.Xml.XmlWriter" /> 流。</param>
        public override void WriteXml(XmlWriter writer)
        {
            if (!string.IsNullOrEmpty(moduleDef))
            {
                writer.WriteAttributeString("moduleId", ModuleId);
            }

            if (!string.IsNullOrEmpty(Type))
            {
                writer.WriteAttributeString("type", Type);
            }

            if (BuildInstance)
            {
                writer.WriteAttributeString("isInstance", BuildInstance.ToString());
            }

            writer.WriteAttributeString("target", Target.ToString());

            foreach (ModuleBuildStepElement step in _innerSteps)
            {
                step.ObjectWriteXml(writer);
            }
        }