private void MainForm_FormClosed(object sender, FormClosedEventArgs e) { if ((e.CloseReason == CloseReason.WindowsShutDown) || (e.CloseReason == CloseReason.UserClosing) || (e.CloseReason == CloseReason.TaskManagerClosing)) { TempFileCache.ClearCache(); Process.GetCurrentProcess().Kill(); } }
internal static void Install(string dirpath, string selectedVersion, bool legacy_install) { if (!legacy_install) { Install_Normal(dirpath, selectedVersion); } else { Install_Legacy(dirpath, selectedVersion); } TempFileCache.ClearCache(); }
internal static void Install(string dirpath, string selectedVersion, bool legacy_install, bool silent_install) { if (File.Exists(ManualZipPath) && selectedVersion.Equals("Manual Zip")) { Install_ManualZip(dirpath); } else if (legacy_install) { Install_Legacy(dirpath, selectedVersion); } else if (silent_install) { Install_Silent(dirpath, selectedVersion); } else { Install_Normal(dirpath, selectedVersion); } TempFileCache.ClearCache(); }
private void btnInstall_Click(object sender, EventArgs e) { cbVersions.Hide(); tbPath.Hide(); btnSelect.Hide(); btnInstall.Hide(); btnUninstall.Hide(); progressBar.Show(); lblProgressInfo.Show(); lblProgressPer.Show(); new Thread(() => { try { string dirpath = Path.GetDirectoryName(tbPath.Text); string selectedVersion = ((((string)cbVersions.Items[cbVersions.SelectedIndex]).StartsWith("Latest")) ? (string)cbVersions.Items[cbVersions.SelectedIndex + 1] : (string)cbVersions.Items[cbVersions.SelectedIndex]); bool legacy_install = (selectedVersion.Equals("v0.2.1") || selectedVersion.Equals("v0.2") || selectedVersion.Equals("v0.1.0")); Program.Install(dirpath, selectedVersion, legacy_install); Program.SetDisplayText("SUCCESS!"); MessageBox.Show("Installation Successful!", Program.Title, MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); Close(); Application.Exit(); } catch (Exception ex) { TempFileCache.ClearCache(); Program.SetDisplayText("ERROR!"); MessageBox.Show("Installation failed; upload the created log to #melonloader-support on discord", Program.Title); File.WriteAllText(Directory.GetCurrentDirectory() + $@"\MLInstaller_{DateTime.Now:yy-M-dd_HH-mm-ss.fff}.log", ex.ToString()); Close(); Application.Exit(); } }).Start(); }
private void btnUninstall_Click_1(object sender, EventArgs e) { cbVersions.Hide(); tbPath.Hide(); btnSelect.Hide(); btnInstall.Hide(); btnUninstall.Hide(); progressBar.Show(); lblProgressInfo.Show(); lblProgressPer.Show(); new Thread(() => { try { string dirpath = Path.GetDirectoryName(tbPath.Text); Program.Cleanup(dirpath); Program.SetDisplayText("SUCCESS!"); Program.SetPercentage(100); MessageBox.Show("Uninstall Successful!", Program.Title, MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); Close(); Application.Exit(); } catch (Exception ex) { TempFileCache.ClearCache(); Program.SetDisplayText("ERROR!"); MessageBox.Show("Uninstall failed; upload the created log to #melonloader-support on discord", Program.Title); File.WriteAllText(Directory.GetCurrentDirectory() + $@"\MLInstaller_{DateTime.Now:yy-M-dd_HH-mm-ss.fff}.log", ex.ToString()); Close(); Application.Exit(); } }).Start(); }
private void button2_Click(object sender, System.EventArgs e) { comboBox1.Visible = false; textBox1.Visible = false; button1.Visible = false; button2.Visible = false; progressBar1.Visible = true; label2.Visible = true; label3.Visible = true; new Thread(() => { try { string dirpath = Path.GetDirectoryName(textBox1.Text); string selectedVersion = (((comboBox1.SelectedIndex == 0) && (comboBox1.Items.Count > 1)) ? (string)comboBox1.Items[1] : (string)comboBox1.Items[comboBox1.SelectedIndex]); bool legacy_install = (selectedVersion.Equals("v0.2.1") || selectedVersion.Equals("v0.2") || selectedVersion.Equals("v0.1.0")); Program.Install(dirpath, selectedVersion, legacy_install); Program.SetDisplayText("SUCCESS!"); Program.SetPercentage(100); MessageBox.Show("Installation Successful!", Program.Title, MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly); Close(); Application.Exit(); } catch (Exception ex) { TempFileCache.ClearCache(); Program.SetDisplayText("ERROR!"); MessageBox.Show("Installation failed; copy this dialog (press Control+C) to #melonloader-support on discord\n" + ex, Program.Title); Close(); Application.Exit(); } }).Start(); }