public void ReadXml(XmlReader reader) { bool in_package = false, in_action = false; reader.MoveToNextAttribute(); if (reader.Name == "version") { version = reader.Value; } while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { if (!in_action && !in_package) { if (reader.Name == "packages") { in_package = true; updated_packages = new List <UpdatePackage>(); } else if (reader.Name == "actions") { in_action = true; update_actions = new List <UpdateAction>(); } } else if (in_package) { if (reader.Name == "package") { UpdatePackage pkg = new UpdatePackage(); XmlReader s = reader.ReadSubtree(); s.Read(); pkg.ReadXml(s); s.Close(); updated_packages.Add(pkg); } } else if (in_action) { if (reader.Name == "action") { UpdateAction action = new UpdateAction(); XmlReader s = reader.ReadSubtree(); s.Read(); action.ReadXml(s); s.Close(); update_actions.Add(action); } } } else if (reader.NodeType == XmlNodeType.EndElement) { if (reader.Name == "packages") { in_package = false; } else if (reader.Name == "actions") { in_action = false; } } } }