Esempio n. 1
0
        private void GetXenCenterVersions(XmlDocument xdoc)
        {
            if (!_checkForXenCenter)
            {
                return;
            }

            foreach (XmlNode versions in xdoc.GetElementsByTagName(XenCenterVersionsNode))
            {
                foreach (XmlNode version in versions.ChildNodes)
                {
                    string version_lang = "";
                    string name         = "";
                    bool   latest       = false;
                    bool   latest_cr    = 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")
                        {
                            latest = attrib.Value.ToUpperInvariant() == bool.TrueString.ToUpperInvariant();
                        }
                        else if (attrib.Name == "latestcr")
                        {
                            latest_cr = 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, latest, latest_cr, url, timestamp));
                }
            }
        }
Esempio n. 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));
                }
            }
        }