diff --git a/Core/ModuleInstaller.cs b/Core/ModuleInstaller.cs index f28479d411..3b2048af6b 100644 --- a/Core/ModuleInstaller.cs +++ b/Core/ModuleInstaller.cs @@ -1012,13 +1012,7 @@ public void AddRemove(IEnumerable add = null, IEnumerable re /// public void Upgrade(IEnumerable identifiers, IDownloader netAsyncDownloader, bool enforceConsistency = true) { - var options = new RelationshipResolverOptions(); - - // We do not wish to pull in any suggested or recommended mods. - options.with_recommends = false; - options.with_suggests = false; - - var resolver = new RelationshipResolver(identifiers.ToList(), null, options, registry_manager.registry, ksp.VersionCriteria()); + var resolver = new RelationshipResolver(identifiers.ToList(), null, RelationshipResolver.DependsOnlyOpts(), registry_manager.registry, ksp.VersionCriteria()); Upgrade(resolver.ModList(), netAsyncDownloader, enforceConsistency); } diff --git a/Core/Relationships/RelationshipResolver.cs b/Core/Relationships/RelationshipResolver.cs index c95377b0df..a0063fb24b 100644 --- a/Core/Relationships/RelationshipResolver.cs +++ b/Core/Relationships/RelationshipResolver.cs @@ -191,14 +191,25 @@ public RelationshipResolver(IEnumerable modulesToInstall, IEnumerabl // and the defaults in the class definition should do the right thing. public static RelationshipResolverOptions DefaultOpts() { - var opts = new RelationshipResolverOptions + return new RelationshipResolverOptions { - with_recommends = true, - with_suggests = false, + with_recommends = true, + with_suggests = false, with_all_suggests = false }; + } - return opts; + /// + /// Options to install without recommendations. + /// + public static RelationshipResolverOptions DependsOnlyOpts() + { + return new RelationshipResolverOptions + { + with_recommends = false, + with_suggests = false, + with_all_suggests = false + }; } /// diff --git a/GUI/Main.cs b/GUI/Main.cs index d0159900d2..97714986ff 100644 --- a/GUI/Main.cs +++ b/GUI/Main.cs @@ -155,11 +155,13 @@ private void ChangeSetUpdated() UpdateChangesDialog(ChangeSet.ToList(), installWorker); tabController.ShowTab("ChangesetTabPage", 1, false); ApplyToolButton.Enabled = true; + auditRecommendationsMenuItem.Enabled = false; } else { tabController.HideTab("ChangesetTabPage"); ApplyToolButton.Enabled = false; + auditRecommendationsMenuItem.Enabled = true; } } diff --git a/GUI/MainChangeset.cs b/GUI/MainChangeset.cs index e281870d14..754bbd9973 100644 --- a/GUI/MainChangeset.cs +++ b/GUI/MainChangeset.cs @@ -119,15 +119,13 @@ private void ConfirmChangesButton_Click(object sender, EventArgs e) menuStrip1.Enabled = false; RetryCurrentActionButton.Visible = false; - RelationshipResolverOptions install_ops = RelationshipResolver.DefaultOpts(); - install_ops.with_recommends = false; //Using the changeset passed in can cause issues with versions. // An example is Mechjeb for FAR at 25/06/2015 with a 1.0.2 install. // TODO Work out why this is. installWorker.RunWorkerAsync( new KeyValuePair, RelationshipResolverOptions>( mainModList.ComputeUserChangeSet().ToList(), - install_ops + RelationshipResolver.DependsOnlyOpts() ) ); } diff --git a/GUI/MainModList.cs b/GUI/MainModList.cs index 80c404e514..70290bcfd5 100644 --- a/GUI/MainModList.cs +++ b/GUI/MainModList.cs @@ -572,11 +572,6 @@ public async Task> ComputeChangeSetFromModList( { var modules_to_install = new HashSet(); var modules_to_remove = new HashSet(); - var options = new RelationshipResolverOptions - { - without_toomanyprovides_kraken = false, - with_recommends = false - }; foreach (var change in changeSet) { @@ -610,7 +605,8 @@ public async Task> ComputeChangeSetFromModList( new RelationshipResolver( modules_to_install, null, - options, registry, version); + RelationshipResolver.DependsOnlyOpts(), + registry, version); handled_all_too_many_provides = true; continue; } @@ -642,7 +638,7 @@ public async Task> ComputeChangeSetFromModList( var resolver = new RelationshipResolver( modules_to_install, changeSet.Where(change => change.ChangeType.Equals(GUIModChangeType.Remove)).Select(m => m.Mod.ToModule()), - options, registry, version); + RelationshipResolver.DependsOnlyOpts(), registry, version); changeSet.UnionWith( resolver.ModList() .Select(m => new ModChange(new GUIMod(m, registry, version), GUIModChangeType.Install, resolver.ReasonFor(m)))); diff --git a/GUI/MainRecommendations.cs b/GUI/MainRecommendations.cs index 9c99beeaf0..fcaf9a6694 100644 --- a/GUI/MainRecommendations.cs +++ b/GUI/MainRecommendations.cs @@ -114,14 +114,7 @@ HashSet toInstall { return mods.Where(kvp => CanInstall( registry, versionCriteria, - new RelationshipResolverOptions() - { - with_all_suggests = false, - with_recommends = false, - with_suggests = false, - without_enforce_consistency = false, - without_toomanyprovides_kraken = false - }, + RelationshipResolver.DependsOnlyOpts(), toInstall.ToList().Concat(new List() { kvp.Key }).ToList() )).ToDictionary( kvp => kvp.Key, @@ -336,7 +329,7 @@ private void AuditRecommendations(IRegistryQuerier registry, KspVersionCriteria GUIModChangeType.Install, null )).ToList(), - RelationshipResolver.DefaultOpts() + RelationshipResolver.DependsOnlyOpts() ) ); }