Ejemplo n.º 1
0
        public static SoftwareRelease GetLatest()
        {
            SoftwareRelease latest = null;

            try
            {
                XmlTextReader reader = new XmlTextReader(versionXmlUrl);
                reader.MoveToContent();

                Version version = null;
                string  url     = null;

                string elementName = "";

                if ((reader.NodeType == XmlNodeType.Element) &&
                    (reader.Name == "ospy"))
                {
                    while (reader.Read())
                    {
                        if (reader.NodeType == XmlNodeType.Element)
                        {
                            elementName = reader.Name;
                        }
                        else if ((reader.NodeType == XmlNodeType.Text) &&
                                 (reader.HasValue))
                        {
                            switch (elementName)
                            {
                            case "version":
                                version = new Version(reader.Value);
                                break;

                            case "url":
                                url = reader.Value;
                                break;
                            }
                        }
                    }
                }

                reader.Close();

                if (version != null && url != null)
                {
                    latest = new SoftwareRelease(version, url);
                }
            }
            catch (Exception)
            {
            }

            return(latest);
        }
Ejemplo n.º 2
0
        public static SoftwareRelease GetLatest ()
        {
            SoftwareRelease latest = null;

            try
            {
                XmlTextReader reader = new XmlTextReader (versionXmlUrl);
                reader.MoveToContent ();

                Version version = null;
                string url = null;

                string elementName = "";

                if ((reader.NodeType == XmlNodeType.Element) &&
                    (reader.Name == "ospy"))
                {
                    while (reader.Read ())
                    {
                        if (reader.NodeType == XmlNodeType.Element)
                            elementName = reader.Name;
                        else if ((reader.NodeType == XmlNodeType.Text) &&
                            (reader.HasValue))
                        {
                            switch (elementName)
                            {
                                case "version":
                                    version = new Version (reader.Value);
                                    break;
                                case "url":
                                    url = reader.Value;
                                    break;
                            }
                        }
                    }
                }

                reader.Close ();

                if (version != null && url != null)
                {
                    latest = new SoftwareRelease (version, url);
                }
            }
            catch (Exception)
            {
            }

            return latest;
        }
Ejemplo n.º 3
0
        private void NotifyNewRelease (SoftwareRelease latest)
        {
            if (InvokeRequired)
            {
                Invoke (new NotifyNewReleaseHandler (NotifyNewRelease), latest);
                return;
            }

            swReleaseStatusLabel.Tag = latest.Url;
            swReleaseStatusLabel.Text = String.Format ("New version {0} available", latest.Version);
            swReleaseStatusLabel.Enabled = true;
        }