예제 #1
0
        public static IEnumerable <JunkNode> FindJunk(IEnumerable <ApplicationUninstallerEntry> uninstallers,
                                                      IEnumerable <ApplicationUninstallerEntry> allUninstallers, ListGenerationProgress.ListGenerationCallback progressCallback)
        {
            var targetEntries = uninstallers as IList <ApplicationUninstallerEntry> ?? uninstallers.ToList();

            var otherUninstallers = allUninstallers.Except(targetEntries).ToList();

            var result   = new List <JunkNode>(targetEntries.Count);
            var progress = 0;

            foreach (var uninstaller in targetEntries)
            {
                var progressInfo = new ListGenerationProgress(progress++, targetEntries.Count, uninstaller.DisplayName);

                progressInfo.Inner = new ListGenerationProgress(0, 3, "Scanning start-ups...");
                progressCallback(progressInfo);
                var sj = new StartupJunk(uninstaller);
                result.AddRange(sj.FindJunk());

                progressInfo.Inner = new ListGenerationProgress(1, 3, "Scanning drives...");
                progressCallback(progressInfo);
                var dj = new DriveJunk(uninstaller, otherUninstallers);
                result.AddRange(dj.FindJunk());

                progressInfo.Inner = new ListGenerationProgress(2, 3, "Scanning registry...");
                progressCallback(progressInfo);
                var rj = new RegistryJunk(uninstaller, otherUninstallers);
                result.AddRange(rj.FindJunk());
            }

            result.AddRange(ShortcutJunk.FindAllJunk(targetEntries, otherUninstallers));

            return(result);
        }
        public IEnumerable <JunkNode> FindJunk()
        {
            var output = new List <ProgramFilesJunkNode>();

            foreach (var kvp in UninstallToolsGlobalConfig.GetProgramFilesDirectories(true))
            {
                FindJunkRecursively(output, kvp.Key, 0);
            }

            return(DriveJunk.RemoveDuplicates(output.Cast <DriveJunkNode>()).Cast <JunkNode>());
        }
        public static IEnumerable <JunkNode> FindJunk(IEnumerable <ApplicationUninstallerEntry> uninstallers,
                                                      IEnumerable <ApplicationUninstallerEntry> allUninstallers)
        {
            var targetEntries = uninstallers as IList <ApplicationUninstallerEntry> ?? uninstallers.ToList();

            var otherUninstallers = allUninstallers.Except(targetEntries).ToList();

            var result = new List <JunkNode>(targetEntries.Count);

            foreach (var uninstaller in targetEntries)
            {
                var dj = new DriveJunk(uninstaller, otherUninstallers);
                result.AddRange(dj.FindJunk());

                var rj = new RegistryJunk(uninstaller, otherUninstallers);
                result.AddRange(rj.FindJunk());

                var sj = new StartupJunk(uninstaller);
                result.AddRange(sj.FindJunk());
            }

            return(result);
        }