private static bool ContainsDAPServer(XmlDocument doc, DapServerUri uri) { foreach (XmlAttribute oAttr in doc.SelectNodes("//dapcatalog/@url")) { if (new DapServerUri(oAttr.Value).ToString().Equals(uri.ToString())) { return(true); } } return(false); }
private static void AddDAPServer(XmlDocument doc, DapServerUri uri) { XmlElement oDAPRoot = doc.SelectSingleNode("/dappleview/servers/builderentry/builderdirectory[@specialcontainer=\"DAPServers\"]") as XmlElement; XmlElement oBuilderEntry = doc.CreateElement("builderentry"); oDAPRoot.AppendChild(oBuilderEntry); XmlElement oDapCatalog = doc.CreateElement("dapcatalog"); oDapCatalog.SetAttribute("url", uri.ToString()); oDapCatalog.SetAttribute("enabled", "true"); oBuilderEntry.AppendChild(oDapCatalog); }
private static void RemoveDAPServer(XmlDocument doc, DapServerUri uri) { foreach (XmlElement oDapCatalog in doc.SelectNodes("/dappleview/servers/builderentry/builderdirectory/builderentry/dapcatalog")) { if (new DapServerUri(oDapCatalog.GetAttribute("url")).ToString().Equals(uri.ToString())) { oDapCatalog.ParentNode.ParentNode.RemoveChild(oDapCatalog.ParentNode); } } }
private static void SetDAPServerEnabled(XmlDocument doc, DapServerUri uri, bool blValue) { foreach (XmlElement oDapCatalog in doc.SelectNodes("/dappleview/servers/builderentry/builderdirectory/builderentry/dapcatalog")) { if (new DapServerUri(oDapCatalog.GetAttribute("url")).ToString().Equals(uri.ToString())) { oDapCatalog.SetAttribute("enabled", blValue.ToString()); } } }