void restart() { try { string updateurl = "https://dl.dropbox.com/u/22054429/RipLeech/build.txt"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(updateurl); WebResponse response = request.GetResponse(); System.IO.StreamReader sr = new System.IO.StreamReader(response.GetResponseStream(), System.Text.Encoding.GetEncoding("windows-1252")); string type = sr.ReadToEnd(); if (type != "1") { if (File.Exists(@"C:\Program Files\NiCoding\RipLeech\updater.exe")) { Process.Start(@"C:\Program Files\NiCoding\RipLeech\updater.exe"); // to start new instance of application Environment.Exit(0); //to turn off current app } else { updater upd = new updater(); upd.Show(); this.Close(); } } else { updater upd = new updater(); upd.Show(); this.Close(); } } catch { textBox1.Text = "Unable to get changelog at this time."; } }
private void getupdates() { try { string updateurl = null; if (RipLeech.Properties.Settings.Default.betaupdates == true) { updateurl = "https://dl.dropbox.com/u/22054429/RipLeech/RipLeech_beta_version.txt"; if (!File.Exists("beta.lock")) { File.Create("beta.lock"); } } else { updateurl = "https://dl.dropbox.com/u/22054429/RipLeech/RipLeech_version.txt"; } HttpWebRequest request = (HttpWebRequest)WebRequest.Create(updateurl); WebResponse response = request.GetResponse(); System.IO.StreamReader sr = new System.IO.StreamReader(response.GetResponseStream(), System.Text.Encoding.GetEncoding("windows-1252")); string update = sr.ReadToEnd(); int build = Convert.ToInt32(update); int thisbuild = RipLeech.Properties.Settings.Default.progvers; if (build > thisbuild) { label2.Visible = true; var result = MessageBox.Show("There is an update available for RipLeech! Would you like to download it now?", "Update Available", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (result == DialogResult.Yes) { if (File.Exists("updater.exe")) { Process.Start("updater.exe"); Environment.Exit(0); } else { updater updater = new updater(); updater.Show(); this.Dispose(false); } } else { Menu home = new Menu(); home.Show(); this.Dispose(false); } } else { label2.Visible = false; if (RipLeech.Properties.Settings.Default.flashnotinstalled == true) { /*updater flupdate = new updater(); * flupdate.Show();*/ } else { if (File.Exists(@"C:\Program Files\NiCoding\RipLeech\double.update")) { Process.Start(@"C:\Program Files\NiCoding\RipLeech\updater.exe"); Environment.Exit(0); } else { Menu home = new Menu(); home.Show(); this.Dispose(false); } } } } catch { MessageBox.Show("Unable to connect to update server! RipLeech will check for updates at next launch!"); label2.Visible = false; Menu home = new Menu(); home.Show(); this.Dispose(false); } }
private void getupdates() { try { string updateurl = null; if (RipLeech.Properties.Settings.Default.betaupdates == true) { updateurl = "https://dl.dropbox.com/u/22054429/RipLeech/RipLeech_beta_version.txt"; if (!File.Exists("beta.lock")) { File.Create("beta.lock"); } } else { updateurl = "https://dl.dropbox.com/u/22054429/RipLeech/RipLeech_version.txt"; } HttpWebRequest request = (HttpWebRequest)WebRequest.Create(updateurl); WebResponse response = request.GetResponse(); System.IO.StreamReader sr = new System.IO.StreamReader(response.GetResponseStream(), System.Text.Encoding.GetEncoding("windows-1252")); string update = sr.ReadToEnd(); int build = Convert.ToInt32(update); int thisbuild = RipLeech.Properties.Settings.Default.progvers; if (build > thisbuild) { label2.Visible = true; var result = MessageBox.Show("There is an update available for RipLeech! Would you like to download it now?", "Update Available", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (result == DialogResult.Yes) { if (File.Exists("updater.exe")) { Process.Start("updater.exe"); Environment.Exit(0); } else { updater updater = new updater(); updater.Show(); this.Dispose(false); } } else { Menu home = new Menu(); home.Show(); this.Dispose(false); } } else { label2.Visible = false; if (RipLeech.Properties.Settings.Default.flashnotinstalled == true) { /*updater flupdate = new updater(); flupdate.Show();*/ } else { if (File.Exists(@"C:\Program Files\NiCoding\RipLeech\double.update")) { Process.Start(@"C:\Program Files\NiCoding\RipLeech\updater.exe"); Environment.Exit(0); } else { Menu home = new Menu(); home.Show(); this.Dispose(false); } } } } catch { MessageBox.Show("Unable to connect to update server! RipLeech will check for updates at next launch!"); label2.Visible = false; Menu home = new Menu(); home.Show(); this.Dispose(false); } }