Treat mods with missing files as upgradeable/reinstallable #4067
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Users supposedly sometimes install a mod in CKAN, then delete the files manually in GameData, then install depending mods in CKAN and complain that they don't work. We need to detect missing files and guide the user into restoring them.
It was suggested to create some kind of "clean-up" button, but I don't think users who expect to be able to delete CKAN-installed mods manually without causing problems would know to use something like that. We need something automatic and pro-active.
Problems
While working on the above, I discovered that (as expected) the major data model refactoring in #4023 broke a lot of things:
Causes
guiModule_PropertyChanged
, andModGrid.RefreshEdit
was freezing on Mono.GUIMod.SelectedMod
, there's no longer a way to represent reinstallation inGUIMod
.ModList.GetGUIMods
left manually installed mods to be handled by theregistry.CompatibleModules
check, which has no mechanism for settingGUIMod.HasUpdate
, which drives the checkboxModList.ResetHasUpdate
to re-run theCheckUpgradeable
logic and update the UI appropriately, but I think the usage of it got lost in the shuffle of rebasing and conflict resolution.Changes
Fixes Add a “clean GameData” button to the toolbar #4017.
guiModule_PropertyChanged
usesUtil.Invoke
to access GUI properties and only callsModGrid.RefreshEdit
on Windows. Some adjustments are also made toModGrid_CellValueChanged
to address a problem where multiple checkboxes on the Version tab could become checked if you tried to install historical versions.GUIMod.GetModChanges
, which uses it to add reinstallation actions to the changeset as appropriateregistry.CheckUpgradeable
section and haveGUIMod.HasUpdate
set appropriately. Some adjustments are also made to ensure the checkbox actually works when checked.ModList.ResetHasUpdate
is called when there are changes related to Held labels, which make the checkboxes appear and disappear appropriately, show/hide the upgrade column, and enable/disable the Upgrade all button.Other small stuff:
./build
on Linux was emitting a message about using the-m
parameter to MSBuild to enable parallelization. Now we do that.Now it's fixed by hiding and disposing the tray icon ourselves in the main form's
OnClosing
rather than lettingthis.components
handle it for us.Now this is removed. We can put it back if we decide to add actual functionality that needs it.
Now it's only in the dropdown.