Exemplo n.º 1
0
        private async Task UpdateChangeSetAndConflicts(IRegistryQuerier registry)
        {
            IEnumerable <ModChange>     full_change_set = null;
            Dictionary <GUIMod, string> new_conflicts   = null;

            bool too_many_provides_thrown = false;
            var  user_change_set          = mainModList.ComputeUserChangeSet();

            try
            {
                var module_installer = ModuleInstaller.GetInstance(CurrentInstance, GUI.user);
                full_change_set = await mainModList.ComputeChangeSetFromModList(registry, user_change_set, module_installer, CurrentInstance.VersionCriteria());
            }
            catch (InconsistentKraken k)
            {
                // Need to be recomputed due to ComputeChangeSetFromModList possibly changing it with too many provides handling.
                AddStatusMessage(k.ShortDescription);
                user_change_set = mainModList.ComputeUserChangeSet();
                new_conflicts   = MainModList.ComputeConflictsFromModList(registry, user_change_set, CurrentInstance.VersionCriteria());
                full_change_set = null;
            }
            catch (TooManyModsProvideKraken)
            {
                // Can be thrown by ComputeChangeSetFromModList if the user cancels out of it.
                // We can just rerun it as the ModInfoTabControl has been removed.
                too_many_provides_thrown = true;
            }
            catch (DependencyNotSatisfiedKraken k)
            {
                GUI.user.RaiseError(
                    "{0} depends on {1}, which is not compatible with the currently installed version of KSP",
                    k.parent,
                    k.module
                    );

                // Uncheck the box
                MarkModForInstall(k.parent.identifier, true);
            }

            if (too_many_provides_thrown)
            {
                await UpdateChangeSetAndConflicts(registry);

                new_conflicts   = Conflicts;
                full_change_set = ChangeSet;
            }

            last_mod_to_have_install_toggled.Clear();
            Conflicts = new_conflicts;
            ChangeSet = full_change_set;
        }
Exemplo n.º 2
0
        private async Task UpdateChangeSetAndConflicts(IRegistryQuerier registry)
        {
            IEnumerable <ModChange>     full_change_set = null;
            Dictionary <GUIMod, string> new_conflicts   = null;

            bool too_many_provides_thrown = false;
            var  user_change_set          = mainModList.ComputeUserChangeSet();

            try
            {
                var module_installer = ModuleInstaller.GetInstance(CurrentInstance, GUI.user);
                full_change_set =
                    await mainModList.ComputeChangeSetFromModList(registry, user_change_set, module_installer,
                                                                  CurrentInstance.VersionCriteria());
            }
            catch (InconsistentKraken)
            {
                //Need to be recomputed due to ComputeChangeSetFromModList possibly changing it with too many provides handling.
                user_change_set = mainModList.ComputeUserChangeSet();
                new_conflicts   = MainModList.ComputeConflictsFromModList(registry, user_change_set, CurrentInstance.VersionCriteria());
                full_change_set = null;
            }
            catch (TooManyModsProvideKraken)
            {
                //Can be thrown by ComputeChangeSetFromModList if the user cancels out of it.
                //We can just rerun it as the ModInfoTabControl has been removed.
                too_many_provides_thrown = true;
            }
            if (too_many_provides_thrown)
            {
                await UpdateChangeSetAndConflicts(registry);

                new_conflicts   = Conflicts;
                full_change_set = ChangeSet;
            }
            last_mod_to_have_install_toggled.Clear();
            Conflicts = new_conflicts;
            ChangeSet = full_change_set;
        }
Exemplo n.º 3
0
        private void UpdateChangeSetAndConflicts(Registry registry)
        {
            IEnumerable <KeyValuePair <CkanModule, GUIModChangeType> > full_change_set;
            Dictionary <Module, string> conflicts;

            var user_change_set = mainModList.ComputeUserChangeSet();

            try
            {
                var module_installer = ModuleInstaller.GetInstance(CurrentInstance, GUI.user);
                full_change_set = MainModList.ComputeChangeSetFromModList(registry, user_change_set, module_installer,
                                                                          CurrentInstance.Version());
                conflicts = null;
            }
            catch (InconsistentKraken)
            {
                conflicts       = MainModList.ComputeConflictsFromModList(registry, user_change_set, CurrentInstance.Version());
                full_change_set = null;
            }

            Conflicts = conflicts;
            ChangeSet = full_change_set;
        }