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 GetData(IProgress <int> progress) { Thread.Sleep(100); labelGetting.Text = res_man.GetString("DownloadSForm_GettingServerData_Text", cul) + ". "; if (InternetCheck.ConnectToInternet() == true) { labelGetting.Text = res_man.GetString("DownloadSForm_GettingServerData_Text", cul) + ". . "; InternetCheck.CheckPageIsAliveAsync("https://sourceforge.net/projects/motobootlogomaker/files/"); labelGetting.Text = res_man.GetString("DownloadSForm_GettingServerData_Text", cul) + ". . . "; InternetCheck.CheckPageIsAliveAsync("https://www.androidfilehost.com/?w=files&flid=323184"); labelGetting.Text = res_man.GetString("DownloadSForm_GettingServerData_Text", cul) + ". "; LoadSFS(); labelGetting.Text = res_man.GetString("DownloadSForm_GettingServerData_Text", cul) + ". . "; cAppend(" "); LoadAFH(); labelGetting.Text = res_man.GetString("DownloadSForm_GettingServerData_Text", cul) + ". . . "; } else { labelGetting.Text = res_man.GetString("DownloadSForm_GettingServerData_Error_Uknown", cul); cAppend(res_man.GetString("DownloadSForm_InternetError", cul)); btnGoTo.Enabled = false; button1.Enabled = false; return; } }
public void OpenTelegram(string url) { if (InternetCheck.ConnectToInternet() == true) { Process.Start(url); } else { MessageBox.Show(res_man.GetString("MainForm_InternetCheck", cul), "Moto_Boot_Logo_Maker", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } }
public static void DebugWindwosInfo(string netframworkversion, string windowsver) { //Old folder //var path = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath.ToString(); //var newpath = path.Replace(@"\user.config", "").Trim(); //string filePath = newpath + @"\DebugLogs\WinInfo_" + Environment.UserName + ".txt"; /*if (!Directory.Exists(newpath + @"\DebugLogs")) * { * Directory.CreateDirectory(newpath + @"\DebugLogs"); * }*/ string filePath = exePath + @"\Logs\ToolInfo_" + Environment.UserName + ".txt"; using (FileStream fs = File.Create(filePath)) { } using (StreamWriter writer = new StreamWriter(filePath, true)) { writer.WriteLine("-----------------------------------------------------------------------------"); writer.WriteLine("File Generated Date: " + DateTime.Now.ToString()); writer.WriteLine("Username: "******"Computer Name: " + SystemInformation.ComputerName); writer.WriteLine("Tool Version: v" + Application.ProductVersion); writer.WriteLine("Tool Build Date: " + Utils.GetLinkerDateTime(Assembly.GetEntryAssembly(), null).ToString()); writer.WriteLine("Main Windows Culture: " + ci.Name.ToString()); writer.WriteLine(netframworkversion); writer.WriteLine(windowsver); if (InternetCheck.ConnectToInternet() == true) { IpInfo ipInfo = new IpInfo(); string info = new WebClient().DownloadString("http://ipinfo.io"); JavaScriptSerializer jsonObject = new JavaScriptSerializer(); ipInfo = jsonObject.Deserialize <IpInfo>(info); RegionInfo region = new RegionInfo(ipInfo.Country); writer.WriteLine("Country: " + region.EnglishName); } else { writer.WriteLine("Country: Can´t connect to IP... Waiting for internet connection..."); } } using (StreamReader sr = File.OpenText(filePath)) { while ((sr.ReadLine()).StartsWith("Windows:") && (sr.ReadLine()).StartsWith("NetFramework:")) { return; } } }
private void Download_Load(object sender, EventArgs e) { if (InternetCheck.ConnectToInternet() == true) { labelGetting.Text = res_man.GetString("DownloadSForm_GettingServerData", cul); startProgressAsync(); } else { labelGetting.Text = res_man.GetString("DownloadSForm_GettingServerData_Error", cul); return; } }
private void toolupdates(object sender, EventArgs e) { if (InternetCheck.ConnectToInternet() == true) { AutoUpdater.Start("https://raw.githubusercontent.com/Franco28/Moto_Boot_Logo_Maker/master/Windows/OTAS/updates.xml"); } else { AutoUpdater.CheckForUpdateEvent -= AutoUpdaterOnCheckForUpdateEvent; timer1.Stop(); cAppend(res_man.GetString("AboutForm_Updates", cul) + " " + res_man.GetString("AboutForm_DownloadUpdate_NetLost", cul)); return; } }
private void downloadSiteToolStripMenuItem_Click(object sender, EventArgs e) { if (InternetCheck.ConnectToInternet() == true) { var s = new DownloadS(); if (s.IsDisposed == false) { s.Show(); } else { s.Dispose(); } } }
private void ReadChangelog_Load(object sender, EventArgs e) { if (InternetCheck.ConnectToInternet() == true) { var webRequest = WebRequest.Create(@"https://raw.githubusercontent.com/Franco28/Moto_Boot_Logo_Maker/master/Tool/Setup/changelog.txt"); using (var response = webRequest.GetResponse()) using (var content = response.GetResponseStream()) using (var reader = new StreamReader(content)) { var strContent = reader.ReadToEnd(); richTextBox1.Text = strContent.ToString(); } } else { richTextBox1.Text = res_man.GetString("ChangelogForm_Error", cul); return; } }
public void ReadXMLFile() { var res_man = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); try { if (InternetCheck.ConnectToInternet() == true) { reader = new XmlTextReader(xmlUrl); reader.MoveToContent(); string elementName = ""; if ((reader.NodeType == XmlNodeType.Element) && (reader.Name == "item")) { while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { elementName = reader.Name; } else { if ((reader.NodeType == XmlNodeType.Text) && (reader.HasValue)) { switch (elementName) { case "filever": filever = reader.Value; oConfigMng.Config.FileVersion = filever; oConfigMng.SaveConfig(); break; case "url": url = reader.Value; oConfigMng.Config.FileURL = url; oConfigMng.SaveConfig(); break; case "filename": filename = reader.Value; oConfigMng.Config.FileName = filename; oConfigMng.SaveConfig(); break; } } } } } } else { MessageBox.Show(res_man.GetString("AboutForm_DownloadUpdate_NetLost", cul), "Moto_Boot_Logo_Maker", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { Logs.DebugErrorLogs(ex); MessageBox.Show(ex.ToString() + " " + Logs.GetClassName(ex) + " " + Logs.GetLineNumber(ex), ex.Source, MessageBoxButtons.OK, MessageBoxIcon.Warning); this.Close(); } finally { if (reader != null) { reader.Close(); } } }
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; } } }