private void GetXenServerPatches(XmlDocument xdoc) { if (!_checkForPatches) { return; } foreach (XmlNode versions in xdoc.GetElementsByTagName(PatchesNode)) { foreach (XmlNode version in versions.ChildNodes) { string uuid = ""; string name = ""; string description = ""; string guidance = ""; string guidance_mandatory = ""; string patchVersion = ""; string url = ""; string patchUrl = ""; string timestamp = ""; string priority = ""; string installationSize = ""; string downloadSize = ""; foreach (XmlAttribute attrib in version.Attributes) { if (attrib.Name == "uuid") { uuid = attrib.Value; } else if (attrib.Name == "name-label") { name = attrib.Value; } else if (attrib.Name == "name-description") { description = attrib.Value; } else if (attrib.Name == "after-apply-guidance") { guidance = attrib.Value; } else if (attrib.Name == "guidance-mandatory") { guidance_mandatory = attrib.Value; } else if (attrib.Name == "version") { patchVersion = attrib.Value; } else if (attrib.Name == "url") { url = attrib.Value; } else if (attrib.Name == "patch-url") { patchUrl = attrib.Value; } else if (attrib.Name == "timestamp") { timestamp = attrib.Value; } else if (attrib.Name == "priority") { priority = attrib.Value; } else if (attrib.Name == "installation-size") { installationSize = attrib.Value; } else if (attrib.Name == "download-size") { downloadSize = attrib.Value; } } var conflictingPatches = GetPatchDependencies(version, ConflictingPatchesNode, ConflictingPatchNode); var requiredPatches = GetPatchDependencies(version, RequiredPatchesNode, RequiredPatchNode); XenServerPatches.Add(new XenServerPatch(uuid, name, description, guidance, guidance_mandatory, patchVersion, url, patchUrl, timestamp, priority, installationSize, downloadSize, conflictingPatches, requiredPatches)); } } }
private void GetXenServerVersions(XmlDocument xdoc) { if (!_checkForServerVersion && !_checkForPatches) { return; } foreach (XmlNode versions in xdoc.GetElementsByTagName(XenServerVersionsNode)) { foreach (XmlNode version in versions.ChildNodes) { string version_oem = ""; string name = ""; bool is_latest = false; bool is_latest_cr = false; string url = ""; string timestamp = ""; string buildNumber = ""; string patchUuid = ""; bool presentAsUpdate = false; string minXcVersion = ""; foreach (XmlAttribute attrib in version.Attributes) { if (attrib.Name == "value") { version_oem = attrib.Value; } else if (attrib.Name == "name") { name = attrib.Value; } else if (attrib.Name == "latest") { is_latest = attrib.Value.ToUpperInvariant() == bool.TrueString.ToUpperInvariant(); } else if (attrib.Name == "latestcr") { is_latest_cr = attrib.Value.ToUpperInvariant() == bool.TrueString.ToUpperInvariant(); } else if (attrib.Name == "url") { url = attrib.Value; } else if (attrib.Name == "timestamp") { timestamp = attrib.Value; } else if (attrib.Name == "build-number") { buildNumber = attrib.Value; } else if (attrib.Name == "patch-uuid") { patchUuid = attrib.Value; } else if (attrib.Name == "present-as-update") { presentAsUpdate = attrib.Value.ToUpperInvariant() == bool.TrueString.ToUpperInvariant(); } else if (attrib.Name == "minimum-xc-version") { minXcVersion = attrib.Value; } } List <XenServerPatch> patches = new List <XenServerPatch>(); List <XenServerPatch> minimalPatches = null; //keep it null to indicate that there is no a minimalpatches tag foreach (XmlNode childnode in version.ChildNodes) { if (childnode.Name == "minimalpatches") { minimalPatches = new List <XenServerPatch>(); foreach (XmlNode minimalpatch in childnode.ChildNodes) { if (minimalpatch.Name != "patch") { continue; } XenServerPatch mp = XenServerPatches.Find(p => string.Equals(p.Uuid, minimalpatch.Attributes["uuid"].Value, StringComparison.OrdinalIgnoreCase)); if (mp == null) { continue; } minimalPatches.Add(mp); } } if (childnode.Name == "patch") { XenServerPatch patch = XenServerPatches.Find(item => string.Equals(item.Uuid, childnode.Attributes["uuid"].Value, StringComparison.OrdinalIgnoreCase)); if (patch == null) { continue; } patches.Add(patch); } } XenServerVersions.Add(new XenServerVersion(version_oem, name, is_latest, is_latest_cr, url, patches, minimalPatches, timestamp, buildNumber, patchUuid, presentAsUpdate, minXcVersion)); } } }
private void GetXenServerVersions(XmlDocument xdoc) { if (!_checkForServerVersion && !_checkForPatches) { return; } foreach (XmlNode versions in xdoc.GetElementsByTagName(XenServerVersionsNode)) { foreach (XmlNode version in versions.ChildNodes) { string version_oem = ""; string name = ""; bool is_latest = false; string url = ""; string timestamp = ""; string buildNumber = ""; foreach (XmlAttribute attrib in version.Attributes) { if (attrib.Name == "value") { version_oem = attrib.Value; } else if (attrib.Name == "name") { name = attrib.Value; } else if (attrib.Name == "latest") { is_latest = attrib.Value.ToUpperInvariant() == bool.TrueString.ToUpperInvariant(); } else if (attrib.Name == "url") { url = attrib.Value; } else if (attrib.Name == "timestamp") { timestamp = attrib.Value; } else if (attrib.Name == "build-number") { buildNumber = attrib.Value; } } List <XenServerPatch> patches = new List <XenServerPatch>(); foreach (XmlNode childnode in version.ChildNodes) { if (childnode.Name != "patch") { continue; } XenServerPatch patch = XenServerPatches.Find(item => item.Uuid == childnode.Attributes["uuid"].Value); if (patch == null) { continue; } patches.Add(patch); } XenServerVersions.Add(new XenServerVersion(version_oem, name, is_latest, url, patches, timestamp, buildNumber)); } } }