private void buttonContinue_Click(object sender, EventArgs e) // the listed mods are checked against installed mods/gamefiles for conflicts. { List <string> modFiles = new List <string>(); foreach (PreinstallEntry entry in Mods) { modFiles.Add(entry.filename); } PreinstallManager.FilterModValidity(modFiles); if (modFiles.Count == 0) { this.refreshInstallList(); return; } //no valid mods. no mods will be installed PreinstallManager.FilterModConflicts(modFiles); if (modFiles.Count == 0) { this.refreshInstallList(); return; } //remaining mods had conflicts, user chose to install none. string modsToInstall = ""; for (int i = 0; i < modFiles.Count; i++) { modsToInstall += "\n" + Tools.ReadMetaData(modFiles[i]).Name; } DialogResult confirmInstall = MessageBox.Show(String.Format("The following mods will be installed:\n" + modsToInstall), "SnakeBite", MessageBoxButtons.OKCancel); if (confirmInstall == DialogResult.OK) { ProgressWindow.Show("Installing Mod(s)", String.Format("Installing...\n\nNote:\nThe install time depends greatly on\nthe mod's contents, number of mods being installed\nand the mods that are already installed."), new Action((MethodInvoker) delegate { ModManager.InstallMod(modFiles); })); this.Close(); // the form closes upon installation. If the install is cancelled, the form remains open. } }
private void buttonContinue_Click(object sender, EventArgs e) // the listed mods are checked against installed mods/gamefiles for conflicts. { List <string> modFiles = new List <string>(); foreach (PreinstallEntry entry in Mods) { modFiles.Add(entry.filename); } log.ClearPage(); SetVisiblePage(log); ProgressWindow.Show("Checking Validity", "Checking mod validity...", new Action((MethodInvoker) delegate { PreinstallManager.FilterModValidity(modFiles); }), log); if (modFiles.Count == 0) { refreshInstallList(); return; } //no valid mods. no mods will be installed formLocation = Location; // to center the conflict window formSize = Size; ProgressWindow.Show("Checking Conflicts", "Checking for conflicts with installed mods...", new Action((MethodInvoker) delegate { PreinstallManager.FilterModConflicts(modFiles); }), log); if (modFiles.Count == 0) { refreshInstallList(); return; } //remaining mods had conflicts, user chose to install none. string modsToInstall = ""; for (int i = 0; i < modFiles.Count; i++) { modsToInstall += "\n" + Tools.ReadMetaData(modFiles[i]).Name; } DialogResult confirmInstall = MessageBox.Show(String.Format("The following mods will be installed:\n" + modsToInstall), "SnakeBite", MessageBoxButtons.OKCancel); if (confirmInstall == DialogResult.OK) { ProgressWindow.Show("Installing Mod(s)", "Installing, please wait...", new Action((MethodInvoker) delegate { InstallManager.InstallMods(modFiles); }), log); Close(); // the form closes upon installation. If the install is cancelled, the form remains open. } else { refreshInstallList(); } }