public void WriteToSerializer(Core.SerializerBase Stream) { Stream.WriteElementStart("Languages"); Stream.WriteData("DefaultLanguage", DefaultLanguage); Stream.WriteData("Count", AvailableLanguages.Length); IEnumerator Iterator = AvailableLanguages.GetEnumerator(); string Node = "Lang"; while (Iterator.MoveNext()) { Stream.WriteElementStart(Node); Stream.WriteData("Name", (string)Iterator.Current); Stream.WriteElementEnd(Node); } Stream.WriteElementEnd("Languages"); }
public void ReadFromSerializer(Core.SerializerBase Stream) { int i = 0; string NodeGroup; int StartNodeLevel = 0, CurrNodeLevel = 0; do { NodeGroup = Stream.GetNodeName(); CurrNodeLevel = Stream.GetNodeLevel(); if (CurrNodeLevel < StartNodeLevel) { break; } if (Stream.GetNodeType() != Core.SerializerBase.NodeType.NodeEnd) { if (NodeGroup == "Languages") { DefaultLanguage = Stream.ReadAsString("DefaultLanguage"); AvailableLanguages = new string[Stream.ReadAsInt("Count")]; } if (NodeGroup == "Lang") { string s = Stream.ReadAsString("Name"); AvailableLanguages[i] = s; i++; } else if (NodeGroup == Core.SerializerXML.FieldName.SerializerDocName.ToString()) { if (NodeGroup != s_File) { throw new Exception(Core.SerializerXML.FieldName.SerializerDocName.ToString() + " unknown"); } } } } while (Stream.ReadNext()); }