public override void WriteGen(APGen gen, XmlWriter writer) { if (Name != null) { writer.WriteStartElement("sectionGroup"); writer.WriteAttributeString("name", Name); if (TypeName != null && TypeName != "" && TypeName != "Symber.Web.Compilation.Gen.APGenSectionGroup") { writer.WriteAttributeString("type", TypeName); } } else { writer.WriteStartElement("genSections"); } foreach (GenInfoCollection col in new object[] { Sections, Groups }) { foreach (string key in col) { GenInfo info = col[key]; if (info.HasDataContent(gen)) { info.WriteGen(gen, writer); } } } writer.WriteEndElement(); }
internal void WriteContent(XmlWriter writer, APGen gen, bool writeElement) { foreach (GenInfoCollection col in new object[] { Sections, Groups }) { foreach (string key in col) { GenInfo info = col[key]; if (info.HasDataContent(gen)) { info.WriteData(gen, writer); } } } }
public override bool HasDataContent(APGen gen) { foreach (GenInfoCollection col in new object[] { Sections, Groups }) { foreach (string key in col) { GenInfo info = col[key]; if (info.HasDataContent(gen)) { return(true); } } } return(false); }
public void AddChild(GenInfo data) { data.Parent = this; if (data is SectionInfo) { if (_sections == null) _sections = new GenInfoCollection(); _sections[data.Name] = data; } else { if (_groups == null) _groups = new GenInfoCollection(); _groups[data.Name] = data; } }
public void AddChild(GenInfo data) { data.Parent = this; if (data is SectionInfo) { if (_sections == null) { _sections = new GenInfoCollection(); } _sections[data.Name] = data; } else { if (_groups == null) { _groups = new GenInfoCollection(); } _groups[data.Name] = data; } }
public void ReadContent(XmlTextReader reader, APGen gen, bool root) { while (reader.NodeType != XmlNodeType.EndElement && reader.NodeType != XmlNodeType.None) { if (reader.NodeType != XmlNodeType.Element) { reader.Skip(); continue; } GenInfo data = GetGenInfo(reader, this); if (data != null) { data.ReadData(gen, reader); } else { ThrowException(APResource.GetString(APResource.APGen_UnrecognizedSection, reader.LocalName), reader); } } }
private GenInfo GetGenInfo(XmlReader reader, SectionGroupInfo current) { GenInfo data = null; if (current._sections != null) { data = current._sections[reader.LocalName]; } if (data != null) { return(data); } if (current._groups != null) { data = current._groups[reader.LocalName]; } if (data != null) { return(data); } if (current._groups == null) { return(null); } foreach (string key in current._groups.AllKeys) { data = GetGenInfo(reader, (SectionGroupInfo)current._groups[key]); if (data != null) { return(data); } } return(null); }
public override void ReadGen(APGen gen, string streamName, XmlTextReader reader) { StreamName = streamName; GenHost = gen.GenHost; if (reader.LocalName != "genSections") { while (reader.MoveToNextAttribute()) { if (reader.Name == "name") { Name = reader.Value; } else if (reader.Name == "type") { TypeName = reader.Value; Type = null; } else { ThrowException(APResource.GetString(APResource.APGen_UnrecognizedAttribute, ""), reader); } } if (Name == null) { ThrowException(APResource.GetString(APResource.APGen_MissingRequiredAttribute, "sectionGroup", "name"), reader); } } if (TypeName == null) { TypeName = typeof(APGenSectionGroup).FullName; } if (reader.IsEmptyElement) { reader.Skip(); return; } reader.ReadStartElement(); reader.MoveToContent(); while (reader.NodeType != XmlNodeType.EndElement) { if (reader.NodeType != XmlNodeType.Element) { reader.Skip(); continue; } string name = reader.LocalName; GenInfo info = null; if (name == "section") { info = new SectionInfo(); } else if (name == "sectionGroup") { info = new SectionGroupInfo(); } else { ThrowException(APResource.GetString(APResource.APGen_UnrecognizedElement, reader.Name), reader); } info.ReadGen(gen, streamName, reader); GenInfo actInfo = Groups[info.Name]; if (actInfo == null) { actInfo = Sections[info.Name]; } if (actInfo != null) { if (actInfo.GetType() != info.GetType()) { ThrowException(APResource.GetString(APResource.APGen_SectionNameAlreadyExists, info.Name), reader); } actInfo.StreamName = streamName; } else { AddChild(info); } } reader.ReadEndElement(); }
public void Add(string name, GenInfo genInfo) { BaseAdd(name, genInfo); }
internal void RemoveGenInfo(GenInfo genInfo) { _elementData.Remove(genInfo); }