示例#1
0
        public override void WriteData(APGen gen, XmlWriter writer)
        {
            string xml;

            APGenSection section = gen.GetSectionInstance(this, false);

            if (section != null)
            {
                xml = section.SerializeSection(Name);

                string externalDataXml = section.ExternalDataXml;
                string filePath        = gen.FileName;

                if (!String.IsNullOrEmpty(filePath) && !String.IsNullOrEmpty(externalDataXml))
                {
                    using (StreamWriter sw = new StreamWriter(filePath))
                    {
                        sw.Write(externalDataXml);
                    }
                }
            }
            else
            {
                xml = gen.GetSectionXml(this);
            }

            if (xml != null)
            {
                writer.WriteRaw(xml);
            }
        }
示例#2
0
 /// <summary>
 /// Get a section by name.
 /// </summary>
 /// <param name="name">The specified section name.</param>
 /// <returns>The section object.</returns>
 public APGenSection this[string name]
 {
     get
     {
         APGenSection section = BaseGet(name) as APGenSection;
         if (section == null)
         {
             SectionInfo sectionInfo = _group.Sections[name] as SectionInfo;
             if (sectionInfo == null)
             {
                 return(null);
             }
             section = _gen.GetSectionInstance(sectionInfo, true);
             if (section == null)
             {
                 return(null);
             }
             BaseSet(name, section);
         }
         return(section);
     }
 }
示例#3
0
		public override void WriteData(APGen gen, XmlWriter writer)
		{
			string xml;

			APGenSection section = gen.GetSectionInstance(this, false);

			if (section != null)
			{
				xml = section.SerializeSection(Name);

				string externalDataXml = section.ExternalDataXml;
				string filePath = gen.FileName;

				if (!String.IsNullOrEmpty(filePath) && !String.IsNullOrEmpty(externalDataXml))
				{
					using (StreamWriter sw = new StreamWriter(filePath))
					{
						sw.Write(externalDataXml);
					}
				}
			}
			else
			{
				xml = gen.GetSectionXml(this);
			}

			if (xml != null)
			{
				writer.WriteRaw(xml);
			}
		}
示例#4
0
 public override bool HasDataContent(APGen gen)
 {
     return(gen.GetSectionInstance(this, false) != null || gen.GetSectionXml(this) != null);
 }
示例#5
0
		public override bool HasDataContent(APGen gen)
		{
			return gen.GetSectionInstance(this, false) != null || gen.GetSectionXml(this) != null;
		}