private void btn_down_Click(object sender, EventArgs e) { //Check to see if the folder(s) exists if (Directory.Exists(cd + "\\bin")) { } else { Directory.CreateDirectory(cd + "\\bin"); } if (Directory.Exists(cd + "\\data") == false) { Directory.CreateDirectory(cd + "\\data"); Directory.CreateDirectory(cd + "\\data\\profiles"); } else { } //Now, check for the files if (File.Exists(cd + "\\bin\\minecraft.jar") == false) { } //Grab Java Form java = new dev_get_java(); java.Show(); }
private void get_jre_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e) { if (is64Bit == true) { if (Properties.Settings.Default.dev_overide_arch == "1") { lbl_ver.Text = "Version: " + Application.ProductVersion + " | BETA BUILD | 32bit mode"; this.Text = "IronAxe Minecraft Launcher: Main "; if (Properties.Settings.Default.dev_download_res == "") { Form fm = new dev_get_java(); fm.Show(); } else { lbl_ver.Text = "Version: " + Application.ProductVersion + " | BETA BUILD | 32bit mode"; this.Text = "IronAxe Minecraft Launcher: Main "; } } else { this.Text = "IronAxe Minecraft Launcher: Main "; lbl_ver.Text = "Version: " + Application.ProductVersion + " | BETA BUILD | 64bit mode"; } } try { if (File.Exists(cd + "\\jPortable_8_Update_121.paf.exe")) { Process jv = new Process(); jv.StartInfo.FileName = cd + "\\jPortable_8_Update_121.paf.exe"; jv.StartInfo.Arguments = "/destination=" + cd + "\\bin\\"; jv.Start(); } else { Process jv = new Process(); jv.StartInfo.FileName = cd + "\\jPortable64_8_Update_121.paf.exe"; jv.StartInfo.Arguments = "/destination=" + cd + "\\bin\\"; jv.Start(); } } catch { } }
private void Main_Load(object sender, EventArgs e) { if (is64Bit == true) { if (Properties.Settings.Default.dev_overide_arch == "1") { lbl_ver.Text = "Version: " + Application.ProductVersion + " | BETA BUILD | 32bit mode"; this.Text = "IronAxe Minecraft Launcher: Main "; if (Properties.Settings.Default.dev_download_res == "") { Form fm = new dev_get_java(); fm.Show(); } else { lbl_ver.Text = "Version: " + Application.ProductVersion + " | BETA BUILD | 32bit mode"; this.Text = "IronAxe Minecraft Launcher: Main "; } } else { this.Text = "IronAxe Minecraft Launcher: Main "; lbl_ver.Text = "Version: " + Application.ProductVersion + " | BETA BUILD | 64bit mode"; } if (File.Exists(cd + "\\jPortable_8_Update_121.paf.exe")) { if (File.Exists(cd + "\\bin\\JRE_32.exe")) { File.Delete(cd + "\\bin\\JRE_32.exe"); File.Move(cd + "\\jPortable_8_Update_121.paf.exe", cd + "\\bin\\JRE_32.exe"); } else { File.Move(cd + "\\jPortable_8_Update_121.paf.exe", cd + "\\bin\\JRE_32.exe"); } } if (File.Exists(cd + "\\jPortable64_8_Update_121.paf.exe")) { if (File.Exists(cd + "\\bin\\JRE_64.exe")) { File.Delete(cd + "\\bin\\JRE_64.exe"); File.Move(cd + "\\jPortable64_8_Update_121.paf.exe", cd + "\\bin\\JRE_64.exe"); } else { File.Move(cd + "\\jPortable64_8_Update_121.paf.exe", cd + "\\bin\\JRE_64.exe"); } } if (File.Exists(cd + "\\upd_fin.exe")) { File.Delete(cd + "\\upd_fin.exe"); } if (File.Exists(cd + "\\Update_Info.ini")) { File.Delete(cd + "\\Update_Info.ini"); } if (File.Exists(cd + "\\upd_fin.exe")) { File.Delete(cd + "\\upd_fin.exe"); } if (File.Exists(cd + "\\Update_Info.ini")) { File.Delete(cd + "\\Update_Info.ini"); } try { if (Properties.Settings.Default.dev_auto_upd == "1") { if (is64Bit == true) { //Read latest update and convert to string WebRequest get_upd = WebRequest.Create("https://raw.githubusercontent.com/zoltx23/IronAxe/master/Common/Updates/Latest/Update_Info.ini"); WebResponse response = get_upd.GetResponse(); Stream dataStream = response.GetResponseStream(); StreamReader upd_rd = new StreamReader(dataStream); string upd_get = upd_rd.ReadToEnd(); //Get and read latest update info, then grab it WebClient get_info = new WebClient(); string cd = Application.StartupPath; lbl_ver.Text = "Downloading Update info..."; this.Refresh(); WebClient upd_dwld = new WebClient(); upd_dwld.DownloadProgressChanged += new DownloadProgressChangedEventHandler(upd_dwld_DownloadProgressChanged); upd_dwld.DownloadFileCompleted += new AsyncCompletedEventHandler(upd_dwld_DownloadFileCompleted); using (Stream upd = get_info.OpenRead("https://raw.githubusercontent.com/zoltx23/IronAxe/master/Common/Updates/Latest/Update_Info.ini")) { using (StreamReader reader = new StreamReader(upd)) { string rd_upd = null; rd_upd = reader.ReadToEnd(); if (rd_upd == Application.ProductVersion) { if (is64Bit == true) { if (Properties.Settings.Default.dev_overide_arch == "1") { lbl_ver.Text = "Version: " + Application.ProductVersion + " | BETA BUILD | 32bit mode"; this.Text = "IronAxe Minecraft Launcher: Main "; } else { this.Text = "IronAxe Minecraft Launcher: Main "; lbl_ver.Text = "Version: " + Application.ProductVersion + " | BETA BUILD | 64bit mode"; } return; } } else { DialogResult dr = MessageBox.Show("There's an Update available" + " (" + upd_get + ")" + "\r\nDo you wish to update?", "IronAxe: Update", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); switch (dr) { case System.Windows.Forms.DialogResult.Yes: lbl_ver.Text = "Downloading Update..."; this.Refresh(); upd_dwld.DownloadFile(new Uri("https://raw.githubusercontent.com/zoltx23/IronAxe/master/Common/Updates/Latest/Latest_32.exe"), cd + "\\IronAxe Minecraft Launcher_new.exe"); WebClient get_fin = new WebClient(); lbl_ver.Text = "Preparing update..."; this.Refresh(); get_fin.DownloadFile(new Uri("https://raw.githubusercontent.com/zoltx23/IronAxe/master/Common/Updates/upd_fin.exe"), cd + "\\upd_fin.exe"); Process.Start(cd + "\\upd_fin.exe"); Application.Exit(); break; case System.Windows.Forms.DialogResult.No: if (is64Bit == true) { if (Properties.Settings.Default.dev_overide_arch == "1") { lbl_ver.Text = "Version: " + Application.ProductVersion + " | BETA BUILD | 32bit mode"; this.Text = "IronAxe Minecraft Launcher: Main "; } else { this.Text = "IronAxe Minecraft Launcher: Main "; lbl_ver.Text = "Version: " + Application.ProductVersion + " | BETA BUILD | 64bit mode"; } } break; } } } } } else { if (Properties.Settings.Default.dev_auto_upd == "1") { //Read latest update and convert to string WebRequest request = WebRequest.Create("https://raw.githubusercontent.com/zoltx23/IronAxe/master/Common/Updates/Latest/Update_Info.ini"); WebResponse response = request.GetResponse(); Stream dataStream = response.GetResponseStream(); StreamReader upd_rd = new StreamReader(dataStream); string upd_get = upd_rd.ReadToEnd(); //Get and read latest update info, then grab it //But first delete old files, and continue. WebClient get_info = new WebClient(); string cd = Application.StartupPath; lbl_ver.Text = "Downloading Update info..."; this.Refresh(); WebClient upd_dwld = new WebClient(); upd_dwld.DownloadProgressChanged += new DownloadProgressChangedEventHandler(upd_dwld_DownloadProgressChanged); upd_dwld.DownloadFileCompleted += new AsyncCompletedEventHandler(upd_dwld_DownloadFileCompleted); using (Stream upd = get_info.OpenRead("https://raw.githubusercontent.com/zoltx23/IronAxe/master/Common/Updates/Latest/Update_Info.ini")) { using (StreamReader reader = new StreamReader(upd)) { string rd_upd = null; rd_upd = reader.ReadToEnd(); if (rd_upd == Application.ProductVersion) { if (is64Bit == true) { if (Properties.Settings.Default.dev_overide_arch == "1") { lbl_ver.Text = "Version: " + Application.ProductVersion + " | BETA BUILD | 32bit mode"; this.Text = "IronAxe Minecraft Launcher: Main "; } else { this.Text = "IronAxe Minecraft Launcher: Main "; lbl_ver.Text = "Version: " + Application.ProductVersion + " | BETA BUILD | 64bit mode"; } return; } } else { DialogResult dr = MessageBox.Show("There's an Update available" + " (" + upd_get + ")" + "\r\nDo you wish to update?", "IronAxe: Update", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); switch (dr) { case System.Windows.Forms.DialogResult.Yes: lbl_ver.Text = "Downloading Update..."; this.Refresh(); upd_dwld.DownloadFile(new Uri("https://raw.githubusercontent.com/zoltx23/IronAxe/master/Common/Updates/Latest/Latest_32.exe"), cd + "\\IronAxe Minecraft Launcher_new.exe"); WebClient get_fin = new WebClient(); lbl_ver.Text = "Preparing update..."; this.Refresh(); get_fin.DownloadFile(new Uri("https://raw.githubusercontent.com/zoltx23/IronAxe/master/Common/Updates/upd_fin.exe"), cd + "\\upd_fin.exe"); Process.Start(cd + "\\upd_fin.exe"); Application.Exit(); break; case System.Windows.Forms.DialogResult.No: if (is64Bit == true) { if (Properties.Settings.Default.dev_overide_arch == "1") { lbl_ver.Text = "Version: " + Application.ProductVersion + " | BETA BUILD | 32bit mode"; this.Text = "IronAxe Minecraft Launcher: Main "; } else { this.Text = "IronAxe Minecraft Launcher: Main "; lbl_ver.Text = "Version: " + Application.ProductVersion + " | BETA BUILD | 64bit mode"; } } break; } } } } } } } } catch { lbl_ver.Text = "Update error: Unable to connect."; this.Text = "IronAxe Minecraft Launcher: Main --UPDATE_ERROR "; MessageBox.Show("An error has occurred when attempting to update. \r\nPlease make sure you have an internet connection.", "dev_", MessageBoxButtons.OK, MessageBoxIcon.Error); lbl_ver.Text = "Version: " + Application.ProductVersion + " | BETA BUILD | 32bit mode"; this.Text = "IronAxe Minecraft Launcher: Main "; } } }