Пример #1
0
        public static Version CheckForUpdates(out Version newVersionOut)
        {
            Logger.WriteLine("Checking for updates...");
            newVersionOut = null;

            const string versionXmlUrl = @"https://raw.githubusercontent.com/Epix37/Hearthstone-Deck-Tracker/master/Hearthstone%20Deck%20Tracker/Version.xml";

            var currentVersion = GetCurrentVersion();

            if (currentVersion != null)
            {
                try
                {
                    var xml = new WebClient {
                        Proxy = null
                    }.DownloadString(versionXmlUrl);

                    var newVersion = new Version(XmlManager <SerializableVersion> .LoadFromString(xml).ToString());

                    if (newVersion > currentVersion)
                    {
                        newVersionOut = newVersion;
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show("Error checking for new version.\n\n" + e.Message + "\n\n" + e.InnerException);
                }
            }

            return(currentVersion);
        }
Пример #2
0
        public static Version CheckForUpdates(out Version newVersionOut)
        {
            Logger.WriteLine("Checking for updates...", "Helper");
            newVersionOut = null;

            const string versionXmlUrl = @"https://raw.githubusercontent.com/Epix37/HDT-Data/master/live-version";

            var currentVersion = GetCurrentVersion();

            if (currentVersion != null)
            {
                try
                {
                    var xml =
                        new WebClient {
                        Proxy = null, CachePolicy = new RequestCachePolicy(RequestCacheLevel.Reload)
                    }.DownloadString(versionXmlUrl);

                    var newVersion = new Version(XmlManager <SerializableVersion> .LoadFromString(xml).ToString());

                    if (newVersion > currentVersion)
                    {
                        newVersionOut = newVersion;
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show("Error checking for new version.\n\n" + e.Message + "\n\n" + e.InnerException);
                }
            }

            return(currentVersion);
        }
        public static async Task <Version> CheckForUpdates()
        {
            Logger.WriteLine("Checking for updates...", "Helper");

            const string versionXmlUrl = @"https://raw.githubusercontent.com/Epix37/HDT-Data/master/live-version";

            var currentVersion = GetCurrentVersion();

            if (currentVersion != null)
            {
                try
                {
                    Logger.WriteLine("Current version: " + currentVersion, "Helper");
                    string xml;
                    using (var wc = new WebClient())
                        xml = await wc.DownloadStringTaskAsync(versionXmlUrl);

                    var newVersion = new Version(XmlManager <SerializableVersion> .LoadFromString(xml).ToString());
                    Logger.WriteLine("Latest version: " + newVersion, "Helper");

                    if (newVersion > currentVersion)
                    {
                        return(newVersion);
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show("Error checking for new version.\n\n" + e.Message + "\n\n" + e.InnerException);
                }
            }
            return(null);
        }
Пример #4
0
        public static void CheckForUpdates()
        {
            var versionXmlUrl =
                @"https://raw.githubusercontent.com/Epix37/Hearthstone-Deck-Tracker/master/Hearthstone%20Deck%20Tracker/Version.xml";

            var xml = new WebClient().DownloadString(versionXmlUrl);

            _xmlManager = new XmlManager <SerializableVersion>()
            {
                Type = typeof(SerializableVersion)
            };

            var currentVersion = new Version(_xmlManager.Load("Version.xml").ToString());
            var newVersion     = new Version(_xmlManager.LoadFromString(xml).ToString());

            if (newVersion > currentVersion)
            {
                var releaseDownloadUrl = @"https://github.com/Epix37/Hearthstone-Deck-Tracker/releases";
                if (
                    MessageBox.Show("New version available at: \n" + releaseDownloadUrl, "New version available!",
                                    MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                {
                    System.Diagnostics.Process.Start(releaseDownloadUrl);
                }
            }
        }
Пример #5
0
        public static void CheckForUpdates()
        {
            SerializableVersion version;

            _xmlManager = new XmlManager <SerializableVersion>()
            {
                Type = typeof(SerializableVersion)
            };

            try
            {
                version = _xmlManager.Load("Version.xml");
            }
            catch (Exception e)
            {
                MessageBox.Show(
                    e.Message + "\n\n" + e.InnerException + "\n\n If you don't know how to fix this, please verwrite Version.xml with the default file.", "Error loading Version.xml");
                return;
            }


            var versionXmlUrl =
                @"https://raw.githubusercontent.com/Epix37/Hearthstone-Deck-Tracker/master/Hearthstone%20Deck%20Tracker/Version.xml";

            var xml = new WebClient().DownloadString(versionXmlUrl);

            var currentVersion = new Version(version.ToString());
            var newVersion     = new Version(_xmlManager.LoadFromString(xml).ToString());

            if (newVersion > currentVersion)
            {
                var releaseDownloadUrl = @"https://github.com/Epix37/Hearthstone-Deck-Tracker/releases";
                if (
                    MessageBox.Show("New version available at: \n" + releaseDownloadUrl, "New version available!",
                                    MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                {
                    System.Diagnostics.Process.Start(releaseDownloadUrl);
                }
            }
        }
Пример #6
0
        public static async Task <Version> CheckForUpdates(bool beta)
        {
            var betaString = beta ? "BETA" : "LIVE";

            Log.Info("Checking for " + betaString + " updates...");

            var versionXmlUrl = beta
                                                                        ? @"https://raw.githubusercontent.com/Epix37/HDT-Data/master/beta-version"
                                                                        : @"https://raw.githubusercontent.com/Epix37/HDT-Data/master/live-version";

            var currentVersion = GetCurrentVersion();

            if (currentVersion == null)
            {
                return(null);
            }
            try
            {
                Log.Info("Current version: " + currentVersion);
                string xml;
                using (var wc = new WebClient())
                    xml = await wc.DownloadStringTaskAsync(versionXmlUrl);

                var newVersion = new Version(XmlManager <SerializableVersion> .LoadFromString(xml).ToString());
                Log.Info("Latest " + betaString + " version: " + newVersion);

                if (newVersion > currentVersion)
                {
                    return(newVersion);
                }
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
            return(null);
        }