// XML public override void Read(XmlReader reader) { Clear(); string name = null; while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: { name = reader.Name; break; } case XmlNodeType.Text: { switch (name) { case XmlTag.Name: { Name = reader.Value; break; } case XmlTag.Address: { Address = reader.Value; break; } case XmlTag.Port: { Port = int.Parse(reader.Value); break; } case XmlTag.Passphrase: { Passphrase = reader.Value; break; } } break; } case XmlNodeType.EndElement: { if (XmlRoot.Equals(reader.Name)) { return; } break; } } } }
// XML public override void Read(XmlReader reader) { Clear(); string name = null; Enabled = bool.Parse(reader.GetAttribute(XmlTag.Enabled)); while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: { name = reader.Name; if (RemoteRouterData.XmlRoot.Equals(name)) { Router.Read(reader); } break; } case XmlNodeType.Text: { switch (name) { case XmlTag.Id: { Id = reader.Value; break; } case XmlTag.Name: { Name = reader.Value; break; } case XmlTag.GroupImage: { GroupPath = reader.Value; break; } case XmlTag.DownloadFolder: { DownloadFolder = reader.Value; break; } case XmlTag.Folder: { FileData data = new FileData(reader.Value) { Shared = true }; AddFolder(data); break; } } break; } case XmlNodeType.EndElement: { if (XmlRoot.Equals(reader.Name)) { return; } break; } } } }