private void btnShortcut_Click(object sender, EventArgs e) { SaveFileDialog sfd = new SaveFileDialog(); sfd.DefaultExt = ".lnk"; sfd.FileName = Mashed.version.NAME() + ".lnk"; sfd.Filter = "Shortcut (*.lnk)|*.lnk"; sfd.ValidateNames = true; if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK && sfd.FileName != null) { WshShellClass wshShell = new WshShellClass(); try { IWshShortcut link = (IWshShortcut)(wshShell.CreateShortcut(sfd.FileName)); link.TargetPath = Util.GetExePath(); link.Arguments = "-fix"; link.Description = "Starts " + Mashed.version.NAME(); if (Mashed.checkExe()) { link.IconLocation = Util.GetExeDir() + "\\" + "icon" + cmbIcon.SelectedItem + ".ico"; } link.Save(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void btnInstall_Click(object sender, EventArgs e) { if (!Mashed.checkExe()) { return; } Mashed.setRegistryLanguage((Language)cmbLanguage.SelectedItem); Mashed.setRegistryInstallation(Util.GetMashedDir()); }
private void btnLaunch_Click(object sender, EventArgs e) { if (!Mashed.checkExe()) { return; } Process.Start(Util.GetMashedDir() + Mashed.version.LAUNCHER()); this.Close(); Application.Exit(); }
private void btnPatch_Click(object sender, EventArgs e) { if (!Mashed.checkExe()) { return; } if (SearchAndReplace.PatchLauncher(Util.GetMashedDir() + Mashed.version.LAUNCHER(), Mashed.version.NOCD_SEARCH(), Mashed.version.NOCD_REPLACE())) { MessageBox.Show("Launch.exe successfully patched.\r\nYou can now run " + Mashed.version.NAME() + " without CD using the original launcher.\r\n\r\nBackup created."); } else { MessageBox.Show("Launch.exe not patched.\r\nMaybe you already installed the patch.\r\n(You can delete the backup file Launch.exe.bak, if you want to try again.)"); } }
public frmMashed() { InitializeComponent(); setMashedVersion(); btnRunMashed.Text = Mashed.version.NAME(); cmbLanguage.SelectedIndexChanged -= new System.EventHandler(this.cmbLanguage_SelectedIndexChanged); cmbIcon.SelectedIndexChanged -= new System.EventHandler(this.cmbIcon_SelectedIndexChanged); cmbLanguage.Items.Add(new Language("English", "English", "ENG", 0)); cmbLanguage.Items.Add(new Language("Français", "French", "FRA", 1)); cmbLanguage.Items.Add(new Language("Deutsch", "German", "DEU", 2)); cmbLanguage.Items.Add(new Language("Español", "Spanish", "ESN", 3)); cmbLanguage.Items.Add(new Language("Italiano", "Italian", "ITA", 4)); cmbLanguage.SelectedIndex = Properties.Settings.Default.Language; if (Properties.Settings.Default.Path.Length == 0) { Properties.Settings.Default.Path = Util.GetExeDir() + "\\"; if (Mashed.checkExe()) { Properties.Settings.Default.Save(); } } txtPath.Text = Util.GetMashedDir(); txtPath.Text += Mashed.version.EXE(); for (int i = 0; i < Mashed.ICOS.Length; i++) { IconFile icon = Mashed.ICOS[i]; cmbIcon.Items.Add(icon); } if (Properties.Settings.Default.Icon.Length == 0) { Properties.Settings.Default.Icon = Mashed.ICO; } foreach (Object obj in cmbIcon.Items) { if (obj.Equals(new IconFile(Properties.Settings.Default.Icon))) { cmbIcon.SelectedItem = obj; } } loadICO(); setIntroState(); cmbLanguage.SelectedIndexChanged += new System.EventHandler(this.cmbLanguage_SelectedIndexChanged); cmbIcon.SelectedIndexChanged += new System.EventHandler(this.cmbIcon_SelectedIndexChanged); if (Util.IsAnAdministrator()) { this.grpLaunch.Enabled = true; this.grpSettings.Enabled = true; this.btnAccess.Visible = false; } else { Util.setUAC(btnAccess); } }