public void CheckForUpdates() { if (InternetCheck.ConnectToInternet() == true) { if (InternetCheck.CheckServerRed("https://raw.githubusercontent.com/Franco28/Moto_Boot_Logo_Maker/master/Windows/OTAS/updates.xml") == true) { MessageBox.Show(res_man.GetString("MainForm_Update_Server_Error", cul), "Moto_Boot_Logo_Maker", MessageBoxButtons.OK, MessageBoxIcon.Error); AutoUpdater.CheckForUpdateEvent -= AutoUpdaterOnCheckForUpdateEvent; timerupdates.Stop(); return; } timerupdates.Interval = (1 * 5 * 100); timerupdates.Tick += new EventHandler(toolupdates); MainForm SynchronizingObject = this; timerupdates.Start(); AvoidFlick(); } else { MessageBox.Show(res_man.GetString("MainForm_Update_ErrorUpdate", cul), "Moto_Boot_Logo_Maker", MessageBoxButtons.OK, MessageBoxIcon.Warning); AutoUpdater.CheckForUpdateEvent -= AutoUpdaterOnCheckForUpdateEvent; timerupdates.Stop(); return; } }
public void CheckForUpdates() { if (InternetCheck.ConnectToInternet() == true) { if (InternetCheck.CheckServerRed("https://raw.githubusercontent.com/Franco28/Moto_Boot_Logo_Maker/master/Windows/OTAS/updates.xml") == true) { cAppend(res_man.GetString("AboutForm_Updates", cul) + " " + res_man.GetString("AboutForm_DownloadUpdate_ServerDown", cul)); return; } else { AutoUpdater.CheckForUpdateEvent += AutoUpdaterOnCheckForUpdateEvent; timer1.Interval = (2 * 5 * 100); timer1.Tick += new EventHandler(toolupdates); AboutBox SynchronizingObject = this; timer1.Start(); } } else { AutoUpdater.CheckForUpdateEvent -= AutoUpdaterOnCheckForUpdateEvent; timer1.Stop(); cAppend(res_man.GetString("AboutForm_Updates", cul) + " " + res_man.GetString("AboutForm_DownloadUpdate_NetLost", cul)); return; } }
public void CallDownload() { this.Show(); var res_man = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); string urlAddress = oConfigMng.Config.FileURL; string location = exePath + @"\Files\" + oConfigMng.Config.FileName; webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed); webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgressChanged); Uri URL = urlAddress.StartsWith("https://", StringComparison.OrdinalIgnoreCase) ? new Uri(urlAddress) : new Uri(urlAddress); try { if (InternetCheck.ConnectToInternet() == true) { if (InternetCheck.CheckServerRed(oConfigMng.Config.FileURL) == true) { MessageBox.Show(res_man.GetString("AboutForm_DownloadUpdate_ServerDown", cul), "Moto_Boot_Logo_Maker - file updates", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Close(); } else { labelInformation.Text = res_man.GetString("ToolDownloadsForm_Label_Download", cul) + " " + oConfigMng.Config.FileName + "..."; this.Text = labelInformation.Text; sw.Start(); webClient.DownloadFileAsync(URL, location); } } else { DialogResult answer = MessageBox.Show(res_man.GetString("ToolDownloadsForm_Label_Download_Retry", cul), res_man.GetString("ToolDownloadsForm_Label_Download_Retry_Title", cul), MessageBoxButtons.YesNo, MessageBoxIcon.Warning); switch (answer) { case DialogResult.Yes: sw.Stop(); sw.Reset(); CallDownload(); break; case DialogResult.No: sw.Stop(); this.Close(); break; } } } catch (Exception er) { DialogResult answer = MessageBox.Show(res_man.GetString("ToolDownloadsForm_Label_Download_Uknown_Error", cul), er.Source, MessageBoxButtons.YesNo, MessageBoxIcon.Error); switch (answer) { case DialogResult.Yes: sw.Stop(); sw.Reset(); CallDownload(); break; case DialogResult.No: sw.Stop(); this.Close(); break; } } }