From 0c78ced4be35e64ec8f58c00588565dcccccf531 Mon Sep 17 00:00:00 2001 From: Myk Date: Fri, 10 Nov 2017 15:15:24 +1100 Subject: [PATCH] comments and refactoring mostly --- Core/ModuleInstaller.cs | 16 ++++++++-------- GUI/MainModList.cs | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/Core/ModuleInstaller.cs b/Core/ModuleInstaller.cs index e06bbfc33b..a91a3f822b 100644 --- a/Core/ModuleInstaller.cs +++ b/Core/ModuleInstaller.cs @@ -1109,6 +1109,7 @@ public void Replace(IEnumerable replacements, NetAsyncModules { log.Debug("Using Replace method"); List modsToInstall = new List(); + var modsToRemove = new List(); foreach (ModuleReplacement repl in replacements) { modsToInstall.Add(repl.ReplaceWith); @@ -1120,18 +1121,17 @@ public void Replace(IEnumerable replacements, NetAsyncModules // Our replacement involves removing the currently installed mods, then // adding everything that needs installing (which may involve new mods to // satisfy dependencies). - var to_remove = new List(); + // Let's discover what we need to do with each module! foreach (ModuleReplacement repl in replacements) { string ident = repl.ToReplace.identifier; - InstalledModule installed_mod = registry_manager.registry.InstalledModule(ident); - CkanModule ReplaceWith = repl.ReplaceWith; + InstalledModule installedMod = registry_manager.registry.InstalledModule(ident); - if (installed_mod == null) + if (installedMod == null) { - log.DebugFormat("Wait, {0} is not actually installed?", installed_mod.identifier); + log.DebugFormat("Wait, {0} is not actually installed?", installedMod.identifier); //Maybe ModuleNotInstalled ? if (registry_manager.registry.IsAutodetected(ident)) { @@ -1143,7 +1143,7 @@ public void Replace(IEnumerable replacements, NetAsyncModules else { // Obviously, we need to remove the mod we are replacing - to_remove.Add(repl.ToReplace.identifier); + modsToRemove.Add(repl.ToReplace.identifier); log.DebugFormat("Ok, we are removing {0}", repl.ToReplace.identifier); //Check whether our Replacement target is already installed @@ -1154,7 +1154,7 @@ public void Replace(IEnumerable replacements, NetAsyncModules { //Module already installed. We'll need to treat it as an upgrade. log.DebugFormat("It turns out {0} is already installed, we'll upgrade it.", installed_replacement.identifier); - to_remove.Add(installed_replacement.identifier); + modsToRemove.Add(installed_replacement.identifier); CkanModule installed = installed_replacement.Module; if (installed.version.IsEqualTo(repl.ReplaceWith.version)) @@ -1179,7 +1179,7 @@ public void Replace(IEnumerable replacements, NetAsyncModules AddRemove( modsToInstall, - to_remove, + modsToRemove, enforceConsistency ); } diff --git a/GUI/MainModList.cs b/GUI/MainModList.cs index bf0f535cd0..ac3028d14c 100644 --- a/GUI/MainModList.cs +++ b/GUI/MainModList.cs @@ -550,11 +550,29 @@ public IEnumerable ConstructModList(IEnumerable modules selecting.ReadOnly = !mod.IsInstallable(); updating.ReadOnly = !mod.IsInstallable() || !mod.HasUpdate; + // TODO1888 : Add ContextMenuStrip Property for context menu and OnMouseHover to show selected action and conflict info + + //ToolStripMenuItem ModRightClickMenu = new ToolStripMenuItem(); + full_list_of_mod_rows.Add(mod.Identifier, item); } return full_list_of_mod_rows.Values; } + //TODO1888 Define ModContextMenu + + //TODO1888 Setup OnMouseHover over the Update/Change column + //Not sure if this is the right place to add this definition, + // see https://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewrow.contextmenustrip(v=vs.110).aspx + // private DataGridViewCellEventArgs mouseLocation; + +// private void dataGridView_CellMouseEnter(object sender, +// DataGridViewCellEventArgs location) +// { +// mouseLocation = location; +// } + + /// /// Returns a version string shorn of any leading epoch as delimited by a single colon ///