void ConvertStringIntegerCollection(string elementName, GlowStringIntegerCollection map, XmlWriter writer) { writer.WriteStartElement(elementName); foreach (var pair in map.EnumEntries) { writer.WriteStartElement("StringIntegerPair"); writer.WriteAttributeString("entryString", pair.EntryName); writer.WriteAttributeString("entryInteger", XmlConvert.ToString(pair.EntryInteger)); writer.WriteEndElement(); } writer.WriteEndElement(); }
GlowStringIntegerCollection ConvertStringIntegerCollection(BerTag tag, XElement xml) { var glow = new GlowStringIntegerCollection(tag); var glowEntries = from xmlChild in xml.Elements("StringIntegerPair") let name = xmlChild.Attribute("entryString").Value let value = XmlConvert.ToInt32(xmlChild.Attribute("entryInteger").Value) select new GlowStringIntegerPair(GlowTags.StringIntegerCollection.StringIntegerPair, name, value); foreach (var glowEntry in glowEntries) { glow.Insert(glowEntry); } return(glow); }
GlowStringIntegerCollection ConvertStringIntegerCollection(BerTag tag, XElement xml) { var glow = new GlowStringIntegerCollection(tag); var glowEntries = from xmlChild in xml.Elements("StringIntegerPair") let name = xmlChild.Attribute("entryString").Value let value = XmlConvert.ToInt32(xmlChild.Attribute("entryInteger").Value) select new GlowStringIntegerPair(GlowTags.StringIntegerCollection.StringIntegerPair, name, value); foreach(var glowEntry in glowEntries) glow.Insert(glowEntry); return glow; }