コード例 #1
0
        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));
                }
            }
        }
コード例 #2
0
        protected override void Run()
        {
            this.Description = Messages.AVAILABLE_UPDATES_SEARCHING;

            XmlDocument xdoc = FetchCheckForUpdatesXml(UpdateXmlUrl);

            // XenCenter Versions
            foreach (XmlNode versions in xdoc.GetElementsByTagName(XenCenterVersionsNode))
            {
                foreach (XmlNode version in versions.ChildNodes)
                {
                    string version_lang = "";
                    string name         = "";
                    bool   is_latest    = false;
                    string url          = "";
                    string timestamp    = "";

                    foreach (XmlAttribute attrib in version.Attributes)
                    {
                        if (attrib.Name == "value")
                        {
                            version_lang = 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;
                        }
                    }

                    XenCenterVersions.Add(new XenCenterVersion(version_lang, name, is_latest, url, timestamp));
                }
            }

            // Patches
            foreach (XmlNode versions in xdoc.GetElementsByTagName(PatchesNode))
            {
                foreach (XmlNode version in versions.ChildNodes)
                {
                    string uuid         = "";
                    string name         = "";
                    string description  = "";
                    string guidance     = "";
                    string patchVersion = "";
                    string url          = "";
                    string patchUrl     = "";
                    string timestamp    = "";
                    string priority     = "";

                    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 == "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;
                        }
                    }

                    XenServerPatches.Add(new XenServerPatch(uuid, name, description, guidance, patchVersion, url,
                                                            patchUrl, timestamp, priority));
                }
            }

            // XenServer Versions
            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(new Predicate <XenServerPatch>(delegate(XenServerPatch item) { return(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));
                }
            }
        }
コード例 #3
0
        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));
                }
            }
        }