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); } }
/// <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); } }
public override bool HasDataContent(APGen gen) { return(gen.GetSectionInstance(this, false) != null || gen.GetSectionXml(this) != null); }
public override bool HasDataContent(APGen gen) { return gen.GetSectionInstance(this, false) != null || gen.GetSectionXml(this) != null; }