예제 #1
0
        private void updatechecker_DoWork(object sender, DoWorkEventArgs e)
        {
            string url      = "http://deathsnacks.tk/dota2/mist_update.txt";
            string response = Util.HTTPRequest(url);

            if (response != "")
            {
                var strings = response.Split('\n');
                if (strings.Length < 2)
                {
                    return;
                }
                string latestVer = strings[0];
                if (Properties.Settings.Default.SkipUpdate && Properties.Settings.Default.SkippedVersion != latestVer.Trim())
                {
                    Properties.Settings.Default.SkipUpdate = false;
                    Properties.Settings.Default.Save();
                    string[] changelog = strings.Skip(1).ToArray();
                    if (!string.IsNullOrEmpty(string.Join("\r\n", changelog)))
                    {
                        Updater updater = new Updater(latestVer, string.Join("\r\n", changelog), log);
                        updater.ShowDialog();
                        updater.Activate();
                    }
                }
                else if (!Properties.Settings.Default.SkipUpdate && latestVer.Trim() != Friends.mist_ver)
                {
                    string[] changelog = strings.Skip(1).ToArray();
                    if (!string.IsNullOrEmpty(string.Join("\r\n", changelog)))
                    {
                        Updater updater = new Updater(latestVer, string.Join("\r\n", changelog), log);
                        updater.ShowDialog();
                        updater.Activate();
                    }
                }
                else
                {
                }
            }
        }
예제 #2
0
파일: Friends.cs 프로젝트: notafraid90/Mist
        private void checkForUpdatesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string url      = "http://www.thectscommunity.com/dev/update_check.php";
            string response = Util.HTTPRequest(url);

            if (response != "")
            {
                string latestVer = Util.ParseBetween(response, "<version>", "</version>");
                if (latestVer != Friends.mist_ver)
                {
                    string[] changelog = Util.GetStringInBetween("<changelog>", "</changelog>", response, false, false);
                    if (!string.IsNullOrEmpty(changelog[0]))
                    {
                        Updater updater = new Updater(latestVer, changelog[0], bot.log);
                        updater.ShowDialog();
                        updater.Activate();
                    }
                }
                else
                {
                    MessageBox.Show("Congratulations, Mist is up-to-date! Thank you for using Mist :)",
                                    "Latest Version",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Information,
                                    MessageBoxDefaultButton.Button1);
                }
            }
            else
            {
                MessageBox.Show("Failed to connect to the update server! Please try again later.",
                                "Update Error",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error,
                                MessageBoxDefaultButton.Button1);
            }
        }
예제 #3
0
        private void updatechecker_DoWork(object sender, DoWorkEventArgs e)
        {
            string response = SteamTrade.SteamWeb.Fetch(Util.UpdateCheckUrl);
            if (response != "")
            {
                string latestVer = Util.ParseBetween(response, "<version>", "</version>");
                if (Properties.Settings.Default.SkipUpdate && Properties.Settings.Default.SkippedVersion != latestVer.Trim())
                {
                    Properties.Settings.Default.SkipUpdate = false;
                    Properties.Settings.Default.Save();
                    string[] changelog = Util.GetStringInBetween("<changelog>", "</changelog>", response, false, false);
                    if (!string.IsNullOrEmpty(changelog[0]))
                    {
                        Updater updater = new Updater(latestVer, changelog[0], log);
                        updater.ShowDialog();
                        updater.Activate();
                    }
                }
                else if (!Properties.Settings.Default.SkipUpdate && latestVer.Trim() != Friends.MistVersion)
                {
                    string[] changelog = Util.GetStringInBetween("<changelog>", "</changelog>", response, false, false);
                    if (!string.IsNullOrEmpty(changelog[0]))
                    {
                        Updater updater = new Updater(latestVer, changelog[0], log);
                        updater.ShowDialog();
                        updater.Activate();
                    }
                }
                else
                {

                }
            }
        }
예제 #4
0
 private void checkForUpdatesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     string response = SteamTrade.SteamWeb.Fetch(Util.UpdateCheckUrl);
     if (response != "")
     {
         string latestVer = Util.ParseBetween(response, "<version>", "</version>");
         if (latestVer != Friends.MistVersion)
         {
             string[] changelog = Util.GetStringInBetween("<changelog>", "</changelog>", response, false, false);
             if (!string.IsNullOrEmpty(changelog[0]))
             {
                 Updater updater = new Updater(latestVer, changelog[0], bot.log);
                 updater.ShowDialog();
                 updater.Activate();
             }
         }
         else
         {
             MetroFramework.MetroMessageBox.Show(this, "Congratulations, Mist is up-to-date! Thank you for using Mist :)",
                 "Latest Version",
                 MessageBoxButtons.OK,
                 MessageBoxIcon.Information,
                 MessageBoxDefaultButton.Button1);
         }
     }
     else
     {
         MetroFramework.MetroMessageBox.Show(this, "Failed to connect to the update server! Please try again later.",
                 "Update Error",
                 MessageBoxButtons.OK,
                 MessageBoxIcon.Error,
                 MessageBoxDefaultButton.Button1);
     }
 }
예제 #5
0
파일: Login.cs 프로젝트: notafraid90/Mist
        private void updatechecker_DoWork(object sender, DoWorkEventArgs e)
        {
            string url = "http://www.thectscommunity.com/dev/update_check.php";
            string response = Util.HTTPRequest(url);
            if (response != "")
            {
                string latestVer = Util.ParseBetween(response, "<version>", "</version>");
                if (Properties.Settings.Default.SkipUpdate && Properties.Settings.Default.SkippedVersion != latestVer.Trim())
                {
                    Properties.Settings.Default.SkipUpdate = false;
                    Properties.Settings.Default.Save();
                    string[] changelog = Util.GetStringInBetween("<changelog>", "</changelog>", response, false, false);
                    if (!string.IsNullOrEmpty(changelog[0]))
                    {
                        Updater updater = new Updater(latestVer, changelog[0], log);
                        updater.ShowDialog();
                        updater.Activate();
                    }
                }
                else if (!Properties.Settings.Default.SkipUpdate && latestVer.Trim() != Friends.mist_ver)
                {
                    string[] changelog = Util.GetStringInBetween("<changelog>", "</changelog>", response, false, false);
                    if (!string.IsNullOrEmpty(changelog[0]))
                    {
                        Updater updater = new Updater(latestVer, changelog[0], log);
                        updater.ShowDialog();
                        updater.Activate();
                    }
                }
                else
                {

                }
            }
        }
예제 #6
0
파일: Friends.cs 프로젝트: notafraid90/Mist
 private void checkForUpdatesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     string url = "http://www.thectscommunity.com/dev/update_check.php";
     string response = Util.HTTPRequest(url);
     if (response != "")
     {
         string latestVer = Util.ParseBetween(response, "<version>", "</version>");
         if (latestVer != Friends.mist_ver)
         {
             string[] changelog = Util.GetStringInBetween("<changelog>", "</changelog>", response, false, false);
             if (!string.IsNullOrEmpty(changelog[0]))
             {
                 Updater updater = new Updater(latestVer, changelog[0], bot.log);
                 updater.ShowDialog();
                 updater.Activate();
             }
         }
         else
         {
             MessageBox.Show("Congratulations, Mist is up-to-date! Thank you for using Mist :)",
                 "Latest Version",
                 MessageBoxButtons.OK,
                 MessageBoxIcon.Information,
                 MessageBoxDefaultButton.Button1);
         }
     }
     else
     {
         MessageBox.Show("Failed to connect to the update server! Please try again later.",
                 "Update Error",
                 MessageBoxButtons.OK,
                 MessageBoxIcon.Error,
                 MessageBoxDefaultButton.Button1);
     }
 }