Beispiel #1
0
        private void ResetPatentDestinationIfNecessary(ModNode modNode)
        {
            var parent = modNode.Parent as ModNode;

            if (parent == null)
            {
                return;
            }

            if (!parent.HasDestinationForChilds)
            {
                Messenger.AddInfo(string.Format(Messages.MSG_CONFLICT_SOLVER_RESET_DESTINATION_PARENT_FOLDER_0_1, modNode.Name, modNode.ZipRoot.Name));
                parent._Checked = false;
                ModNodeHandler.SetDestinationPaths(parent, string.Empty);
            }
        }
Beispiel #2
0
        private void SolveConflicts(ConflictInfoNode conflictingFile)
        {
            bool    install      = false;
            ModNode selectedNode = null;

            foreach (var fileNode in conflictingFile.Nodes.Cast <ConflictInfoNode>())
            {
                // remember selected node for later use.
                if (fileNode.Checked)
                {
                    selectedNode = fileNode.ConflictingNode;
                    continue;
                }

                // uninstall not selected files if installed.
                if (fileNode.ConflictingNode.IsInstalled)
                {
                    Messenger.AddInfo(string.Format(Messages.MSG_CONFLICT_SOLVER_REMOVE_CONFLICT_FILE_0, fileNode.ConflictingNode.Name));
                    fileNode.ConflictingNode._Checked = false;
                    ModNodeHandler.ProcessMod(fileNode.ConflictingNode, true);

                    UninstallParentIfNecessary(fileNode.ConflictingNode);
                    install = true;
                }

                // reset destination of not selected files.
                Messenger.AddInfo(string.Format(Messages.MSG_CONFLICT_SOLVER_RESET_DESTINATION_CONFLICT_FILE_0, fileNode.ConflictingNode.Name));
                fileNode.ConflictingNode._Checked = false;
                ModNodeHandler.SetDestinationPaths(fileNode.ConflictingNode, string.Empty);
                ResetPatentDestinationIfNecessary(fileNode.ConflictingNode);
            }

            // install selected file if one of the not selected was installed.
            if (install && selectedNode != null)
            {
                Messenger.AddInfo(string.Format(Messages.MSG_CONFLICT_SOLVER_INSTALL_SELECTED_FILE_0, selectedNode.Name));
                selectedNode._Checked = true;
                ModNodeHandler.ProcessMod(selectedNode, true);
                InstallParentIfNecessary(selectedNode);
            }
        }