Skip to content

Commit

Permalink
comments and refactoring mostly
Browse files Browse the repository at this point in the history
  • Loading branch information
politas committed Nov 10, 2017
1 parent 6f71d5d commit 0c78ced
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Core/ModuleInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1109,6 +1109,7 @@ public void Replace(IEnumerable<ModuleReplacement> replacements, NetAsyncModules
{
log.Debug("Using Replace method");
List<CkanModule> modsToInstall = new List<CkanModule>();
var modsToRemove = new List<string>();
foreach (ModuleReplacement repl in replacements)
{
modsToInstall.Add(repl.ReplaceWith);
Expand All @@ -1120,18 +1121,17 @@ public void Replace(IEnumerable<ModuleReplacement> 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<string>();


// 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))
{
Expand All @@ -1143,7 +1143,7 @@ public void Replace(IEnumerable<ModuleReplacement> 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
Expand All @@ -1154,7 +1154,7 @@ public void Replace(IEnumerable<ModuleReplacement> 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))
Expand All @@ -1179,7 +1179,7 @@ public void Replace(IEnumerable<ModuleReplacement> replacements, NetAsyncModules

AddRemove(
modsToInstall,
to_remove,
modsToRemove,
enforceConsistency
);
}
Expand Down
18 changes: 18 additions & 0 deletions GUI/MainModList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -550,11 +550,29 @@ public IEnumerable<DataGridViewRow> ConstructModList(IEnumerable<GUIMod> 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;
// }


/// <summary>
/// Returns a version string shorn of any leading epoch as delimited by a single colon
/// </summary>
Expand Down

0 comments on commit 0c78ced

Please sign in to comment.