diff --git a/GUI/Main.cs b/GUI/Main.cs index 5a43ec200e..b87f592c94 100644 --- a/GUI/Main.cs +++ b/GUI/Main.cs @@ -1143,7 +1143,7 @@ private void ModList_MouseDown(object sender, MouseEventArgs e) private void reinstallToolStripMenuItem_Click(object sender, EventArgs e) { - var module = ModInfoTabControl.SelectedModule; + GUIMod module = ModInfoTabControl.SelectedModule; if (module == null || !module.IsCKAN) return; @@ -1158,7 +1158,7 @@ private void reinstallToolStripMenuItem_Click(object sender, EventArgs e) // Build the list of changes, first the mod to remove: List toReinstall = new List() { - new ModChange(module, GUIModChangeType.Remove, null) + new ModChange(module, GUIModChangeType.Remove, null) }; // Then everything we need to re-install: HashSet goners = registry.FindReverseDependencies( @@ -1167,11 +1167,7 @@ private void reinstallToolStripMenuItem_Click(object sender, EventArgs e) foreach (string id in goners) { toReinstall.Add(new ModChange( - new GUIMod( - registry.LatestAvailable(id, versCrit, null), - registry, - versCrit - ), + mainModList.full_list_of_mod_rows[id]?.Tag as GUIMod, GUIModChangeType.Install, null )); diff --git a/GUI/MainModList.cs b/GUI/MainModList.cs index 8cfd6a3118..25fc79663b 100644 --- a/GUI/MainModList.cs +++ b/GUI/MainModList.cs @@ -186,7 +186,7 @@ private void _UpdateModsList(bool repo_updated, List mc) mainModList.Modules = new ReadOnlyCollection( mainModList.full_list_of_mod_rows.Values.Select(row => row.Tag as GUIMod).ToList()); - //TODO Consider using smart enum pattern so stuff like this is easier + //TODO Consider using smart enumeration pattern so stuff like this is easier FilterToolButton.DropDownItems[0].Text = String.Format("Compatible ({0})", mainModList.CountModsByFilter(GUIModFilter.Compatible)); FilterToolButton.DropDownItems[1].Text = String.Format("Installed ({0})", @@ -520,7 +520,7 @@ public IEnumerable ConstructModList(IEnumerable modules full_list_of_mod_rows.Remove(mod.Identifier); var item = new DataGridViewRow {Tag = mod}; - ModChange myChange = mc?.Find((ModChange ch) => ch.Mod.Identifier == mod.Identifier); + ModChange myChange = mc?.FindLast((ModChange ch) => ch.Mod.Identifier == mod.Identifier); var selecting = mod.IsInstallable() ? (DataGridViewCell) new DataGridViewCheckBoxCell() {