Beispiel #1
0
        internal void CheckPluginUpdates(string content, bool clear)
        {
            updatedplugins = false;
            XmlNodeList nodes = null;

            nodes = LoadVersionXml(content, nodes);


            if (clear)
            {
                list.Clear();
            }
            if (ulist == null)
            {
                return;
            }
            foreach (IUpdatablePlugin up in ulist)
            {
                UpdateInfo ui = up.GetUpdateInformation();
                list.Add(ui);
                LoadVersionInfo(nodes, ui);
                if (ui.HasUpdate)
                {
                    updatedplugins = true;
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Checks the update via RSS.
        /// </summary>
        /// <param name="uri">The URI.</param>
        private void CheckUpdateViaRss(Uri uri)
        {
            _updateList = new UpdateInfoList();
            XmlDocument doc = new XmlDocument();

            try {
                Stream strm = GetRssStream(uri);
                using ( strm ) {
                    doc.Load(strm);
                }
            } catch { throw; }
            XmlNamespaceManager nsm = CreateXmlNamespaceManager(doc);

            XmlNodeList updateInfoNodes = doc.SelectNodes(string.Format(Properties.Strings.UpdateInfoRootXPath, Properties.Strings.UpdateInfoNamespacePrefix), nsm);

            // Console.WriteLine ( "{0} Update info items found", updateInfoNodes.Count );

            foreach (XmlElement uie in updateInfoNodes)
            {
                try {
                    XmlParserContext xpc    = new XmlParserContext(doc.NameTable, nsm, string.Empty, XmlSpace.Preserve);
                    XmlTextReader    reader = new XmlTextReader(uie.OuterXml, XmlNodeType.Element, xpc);

                    XmlSerializer serializer = new XmlSerializer(typeof(UpdateInfo), nsm.LookupNamespace(Properties.Strings.UpdateInfoNamespacePrefix));
                    _updateList.Add(serializer.Deserialize(reader) as UpdateInfo);
                } catch (Exception ex) {
                    Console.WriteLine(ex.ToString());
                }
            }

            _updateList.Sort(new UpdateInfoVersionComparer());
            if (_updateList.Count > 0)
            {
                UpdateInfo _updateInfo = UpdateInfoList[UpdateInfoList.GetLatestVersion(  )];
                foreach (UpdateFile uf in _updateInfo.Files)
                {
                    if (uf.Version.CompareTo(this.Version) > 0)
                    {
                        _updatesAvailable = true;
                    }
                }
                if (_updatesAvailable || _updateInfo.Version.CompareTo(this.Version) > 0)
                {
                    OnUpdateAvailable(new UpdatesAvailableEventArgs(_updateInfo.Version));
                }
            }
        }