private void buttonAdd_Click(object sender, EventArgs e) //adds unique filenames to the list and refreshes list. { OpenFileDialog openModFile = new OpenFileDialog(); openModFile.Filter = "MGSV Mod Files|*.mgsv|All Files|*.*"; openModFile.Multiselect = true; DialogResult ofdResult = openModFile.ShowDialog(); if (ofdResult != DialogResult.OK) { return; } foreach (string filename in openModFile.FileNames) { bool skip = false; foreach (PreinstallEntry mod in Mods) { if (filename == mod.filename) { skip = true; break; } } if (skip) { continue; } PreinstallEntry newEntry = new PreinstallEntry(); newEntry.filename = filename; Mods.Add(newEntry); } this.refreshInstallList(); }
private void updateModDescription() //refreshes description panel with current index's metadata. { if (selectedIndex >= 0) { PreinstallEntry selectedMod = Mods[selectedIndex]; modDescription.ShowModInfo(selectedMod.modInfo); showConflictColors(); // updates the conflict visualization } }
public void ShowDialog(List <string> Filenames) { foreach (string file in Filenames) { PreinstallEntry mod = new PreinstallEntry(); mod.filename = file; Mods.Add(mod); } ShowDialog(); }
private void buttonDown_Click(object sender, EventArgs e) //moves the selected mod down one on the list. installs later. { if (selectedIndex < listInstallOrder.Items.Count - 1) { PreinstallEntry mod = Mods[selectedIndex]; listInstallOrder.Items[selectedIndex].Remove(); Mods.RemoveAt(selectedIndex); selectedIndex++; listInstallOrder.Items.Insert(selectedIndex, mod.modInfo.Name); Mods.Insert(selectedIndex, mod); listInstallOrder.Items[selectedIndex].Selected = true; } }
private void buttonUp_Click(object sender, EventArgs e) //moves the selected mod up one on the list. Installs earlier. { if (selectedIndex > 0) { PreinstallEntry mod = Mods[selectedIndex]; listInstallOrder.Items[selectedIndex].Remove(); Mods.RemoveAt(selectedIndex); selectedIndex--; listInstallOrder.Items.Insert(selectedIndex, mod.modInfo.Name); Mods.Insert(selectedIndex, mod); listInstallOrder.Items[selectedIndex].Selected = true; } }
private void labelVersionWarning_Click(object sender, EventArgs e) { PreinstallEntry selectedMod = Mods[selectedIndex]; var currentMGSVersion = ModManager.GetMGSVersion(); var modMGSVersion = selectedMod.modInfo.MGSVersion.AsVersion(); if (currentMGSVersion != modMGSVersion && modMGSVersion != new Version(0, 0, 0, 0)) { if (currentMGSVersion > modMGSVersion && modMGSVersion > new Version(0, 0, 0, 0)) { MessageBox.Show(String.Format("{0} appears to be for MGSV Version {1}.\n\nIt is recommended that you at least check for an updated version before installing.", selectedMod.modInfo.Name, modMGSVersion), "Game version mismatch", MessageBoxButtons.OK, MessageBoxIcon.Warning); } if (currentMGSVersion < modMGSVersion) { MessageBox.Show(String.Format("{0} is intended for MGSV version {1}, but your installation is version {2}. This mod may not be compatible with MGSV version {2}", selectedMod.modInfo.Name, modMGSVersion, currentMGSVersion), "Update recommended", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show(String.Format("This mod is up to date with the current MGSV version {0}", currentMGSVersion), "Mod is up to date", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void updateModDescription() //refreshes description panel with current index's metadata. { if (selectedIndex >= 0) { PreinstallEntry selectedMod = Mods[selectedIndex]; labelModName.Text = selectedMod.modInfo.Name; labelModAuthor.Text = "By " + selectedMod.modInfo.Author; labelModWebsite.Text = selectedMod.modInfo.Version; textModDescription.Text = selectedMod.modInfo.Description; if (ModManager.GetMGSVersion() != selectedMod.modInfo.MGSVersion.AsVersion() && selectedMod.modInfo.MGSVersion.AsVersion() != new Version(0, 0, 0, 0)) { labelVersionWarning.ForeColor = Color.Yellow; labelVersionWarning.BackColor = Color.Chocolate; labelVersionWarning.Text = "!"; } else { labelVersionWarning.ForeColor = Color.MediumSeaGreen; labelVersionWarning.BackColor = Color.Gainsboro; labelVersionWarning.Text = "✔"; } string conflictDescription; if (Mods[selectedIndex].ModConflicts.Count > 0) { conflictDescription = "\r\nThis mod conflicts with: \r\n\r\n"; foreach (string modname in selectedMod.ModConflicts) { conflictDescription += modname + "\r\n"; } } else { conflictDescription = "\r\nThis mod does not conflict with any other mods being installed."; } textConflictDescription.Text = conflictDescription; showConflictColors(); // updates the conflict visualization } }
private void AddNewPaths(string[] modFilePaths) { foreach (string filePath in modFilePaths) { bool skip = false; foreach (PreinstallEntry mod in Mods) { if (filePath == mod.filename) { skip = true; break; } } if (skip) { continue; } PreinstallEntry newEntry = new PreinstallEntry(); newEntry.filename = filePath; PreinstallManager.AddModsToXml(newEntry); PreinstallManager.GetConflicts(newEntry, Mods); Mods.Add(newEntry); } }