Example #1
0
 public static bool CheckForUpdate()
 {
     try
     {
         List <GitHubCommit> gits    = GitAccess.GetHeaderCommit();
         List <string>       gitshas = new List <string>();
         foreach (GitHubCommit git in gits)
         {
             gitshas.Add(git.Sha);
         }
         gitshas.Sort();
         List <string> shas = LocalData.LoadFileToList("SHAs");
         if (shas == null)
         {
             LocalData.SaveFile(gitshas, "SHAs");
             shas = LocalData.LoadFileToList("SHas");
         }
         shas?.Sort();
         if (!shas.SequenceEqual(gitshas))
         {
             LocalData.SaveFile(gitshas, "SHAs");
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception e)
     {
         MessageBox.Show("Can't check for new updates!\n" + e.ToString());
     }
     return(false);
 }
Example #2
0
 private void UpdateCheckerTimer_Tick(object sender, EventArgs e)
 {
     if (UpdateChecker.CheckForUpdate())
     {
         if (this.WindowState == FormWindowState.Normal)
         {
             SystemSounds.Hand.Play();
             MessageBox.Show("New updates available!");
         }
         else if (this.WindowState == FormWindowState.Minimized && notifyIcon1.Visible)
         {
             SystemSounds.Hand.Play();
             notifyIcon1.ShowBalloonTip(6000, "New update for YGOPro2 available!", "Click this to update!", ToolTipIcon.Info);
             notifyIcon1.BalloonTipClicked += UpdateButton_Click;
         }
     }
     LocalData.SaveFile(new List <string>()
     {
         DateTime.Now.ToLocalTime().ToString(), updateCheckerTimer.Interval.ToString()
     }, "donotdeletethis");
     nextUpdateTimer.Stop();
     nextUpdateTimer.Interval = updateCheckerTimer.Interval / 10;
     nextUpdateTimer.Start();
 }
Example #3
0
        private void YgoProPatcher_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (threadRunning)
            {
                threadRunning = false;
                while (downloads > 1 - throttleValue && (gitHubDownloadCheckbox.Checked || internetCheckbox.Checked))
                {
                    Status.Invoke(new Action(() => { Status.Text = "Canceling the download, please wait!"; Status.Update(); }));
                }
            }
            try
            {
                LocalData.SaveFile(new List <string> {
                    StartMinimizedCheckbox.Checked.ToString(), UpdateCheckerTimeNumeric.Value.ToString()
                }, "AutoStartSettings");

                LocalData.SaveFile(new List <string> {
                    YgoProLinksPath.Text, YgoPro2Path.Text
                }, "paths.txt");
            }
            catch
            {
            }
        }