Exemplo n.º 1
0
        bool CheckForComponentUpdate()
        {
            var updateAvailable  = false;
            var componentFactory = new SkyrimFactory();

            updateAvailable = componentFactory.CheckForUpdate();
            if (!updateAvailable)
            {
                try
                {
                    using (XmlReader reader = XmlReader.Create(componentFactory.XMLURL))
                    {
                        XmlDocument doc = new XmlDocument();
                        doc.Load(reader);
                        foreach (XmlNode updateNode in doc.DocumentElement.ChildNodes)
                        {
                            Update update = UpdateManager.Update.Parse(updateNode);
                            if (update.Version > componentFactory.Version)
                            {
                                updateAvailable = true;
                                break;
                            }
                        }
                    }
                }
                catch { }
            }

            if (updateAvailable)
            {
                btnOther.Enabled = false;
            }

            return(updateAvailable);
        }
Exemplo n.º 2
0
        bool DownloadPresetsFile(bool silentErrors = true)
        {
            var client = new WebClient();
            var url    = new SkyrimFactory().UpdateURL + "presets/" + PRESETS_FILE_NAME;

            try { client.DownloadFile(url, PRESETS_FILE_PATH); }
            catch (Exception e)
            {
                if (!silentErrors)
                {
                    MessageBox.Show("The download failed. Error message:\n" + e.Message, "Presets update failed",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                return(false);
            }
            finally { client.Dispose(); }

            return(true);
        }