private void menuItemLoadPreset_Click(object sender, EventArgs e) { OneTimePresetHelp(); /* This might be useful but I'm worried that the user might mistake the prompt and end up overwriting the preset that they wanted to load * DialogResult saveModsResult = MessageBox.Show("Would you like to save your current mods as a Preset before loading a new Preset?", "Save current mods?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); * if (saveModsResult == DialogResult.Yes) SavePreset(); * else if (saveModsResult == DialogResult.Cancel) return; */ OpenFileDialog getPresetFile = new OpenFileDialog(); getPresetFile.Filter = "MGSV Preset File|*.MGSVPreset|All Files|*.*"; getPresetFile.Multiselect = true; DialogResult getPresetResult = getPresetFile.ShowDialog(); if (getPresetResult != DialogResult.OK) { return; } string presetPath = getPresetFile.FileName; Settings presetSettings = PresetManager.ReadSnakeBiteSettings(presetPath); bool success = false; try { if (!PresetManager.isPresetUpToDate(presetSettings)) { if (MessageBox.Show(string.Format("This Preset file is intended for Game Version {0}, but your current Game Version is {1}. Loading this preset will likely cause crashes, infinite loading screens or other significant problems in-game.", presetSettings.MGSVersion.AsVersion(), ModManager.GetMGSVersion()) + "\n\nAre you sure you want to load this preset?", "Preset Version Mismatch", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.Yes) { return; } } string modsToInstall = "This Preset will contain the following mods:\n"; if (presetSettings.ModEntries.Count != 0) { foreach (var mod in presetSettings.ModEntries) { modsToInstall += string.Format("\n{0}", mod.Name); } } else { modsToInstall += "\n[NONE]"; } if (MessageBox.Show(modsToInstall, "Install Preset", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } log.ClearPage(); SetVisiblePage(log); ProgressWindow.Show("Loading Preset", "Loading Preset, please wait...", new Action((MethodInvoker) delegate { success = PresetManager.LoadPreset(presetPath); }), log); } catch (Exception f) { MessageBox.Show("An error has occurred and the .MGSVPreset could not be loaded. Maybe the Preset file was packed improperly, or is being used by another program?\nException: " + f); success = false; } RefreshInstalledMods(true); if (success) { MessageBox.Show(string.Format("'{0}' Loaded", Path.GetFileName(presetPath)), "Preset Loaded", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void ProcessUninstallMod(ModEntry mod) { ProgressWindow.Show("Uninstalling Mod", String.Format("Uninstalling {0}, please wait...", mod.Name), new Action((MethodInvoker) delegate { ModManager.UninstallMod(mod); })); }