Exemplo n.º 1
0
        private bool RemoveMatchingParts(KspCraftObject craft, RegexFilter partFilter)
        {
            var toBeRemoved = FindRemovedAndDependentParts(craft, partFilter);

            if (toBeRemoved.Count <= 0)
            {
                return(false);
            }

            ui.DisplayUserList("Removed Parts", toBeRemoved.Select(part => ProgramUI.PartObjectToString(craft, part)));

            var removeConfirmed = ui.AskYesNoQuestion("Remove the listed parts?");

            if (removeConfirmed)
            {
                craft.Edit().RemoveParts(toBeRemoved);

                ui.DisplayUserMessage($"{toBeRemoved.Count} parts removed");
            }

            return(removeConfirmed);
        }