Skip to content

Commit

Permalink
Get true mod status, use existing GUIMods
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Dec 30, 2017
1 parent 4c901af commit 65bc6a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
10 changes: 3 additions & 7 deletions GUI/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -1158,7 +1158,7 @@ private void reinstallToolStripMenuItem_Click(object sender, EventArgs e)
// Build the list of changes, first the mod to remove:
List<ModChange> toReinstall = new List<ModChange>()
{
new ModChange(module, GUIModChangeType.Remove, null)
new ModChange(module, GUIModChangeType.Remove, null)
};
// Then everything we need to re-install:
HashSet<string> goners = registry.FindReverseDependencies(
Expand All @@ -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
));
Expand Down
4 changes: 2 additions & 2 deletions GUI/MainModList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ private void _UpdateModsList(bool repo_updated, List<ModChange> mc)
mainModList.Modules = new ReadOnlyCollection<GUIMod>(
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})",
Expand Down Expand Up @@ -520,7 +520,7 @@ public IEnumerable<DataGridViewRow> ConstructModList(IEnumerable<GUIMod> 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() {
Expand Down

0 comments on commit 65bc6a6

Please sign in to comment.