private IEnumerable <JunkNode> ScanEventLogs() { if (string.IsNullOrEmpty(Uninstaller.InstallLocation)) { yield break; } using (var key = Registry.LocalMachine.OpenSubKey( @"SYSTEM\CurrentControlSet\Services\EventLog\Application")) { if (key == null) { yield break; } var query = from name in key.GetSubKeyNames() let m = MatchStringToProductName(name) where m >= 0 && m < 3 //orderby m ascending select name; foreach (var result in query) { using (var subkey = key.OpenSubKey(result)) { var exePath = subkey?.GetValue("EventMessageFile") as string; if (string.IsNullOrEmpty(exePath) || !TestPathsMatchExe(exePath)) { continue; } var node = new RegistryKeyJunkNode(key.Name, result, Uninstaller.DisplayName); // Already matched names above node.Confidence.Add(ConfidencePart.ProductNamePerfectMatch); if (OtherUninstallers.Any(x => TestPathsMatch(x.InstallLocation, Path.GetDirectoryName(exePath)))) { node.Confidence.Add(ConfidencePart.DirectoryStillUsed); } yield return(node); } } } }
private IEnumerable <JunkNode> CheckLocation(Func <ApplicationUninstallerEntry, string> targetSelector) { var target = targetSelector(Uninstaller); var targetIsSafe = !OtherUninstallers.Any(x => PathTools.PathsEqual(targetSelector(x), target)); foreach (var source in _links) { if (source.LinkTarget.Contains(target, StringComparison.InvariantCultureIgnoreCase)) { var result = CreateJunkNode(source); if (!targetIsSafe) { result.Confidence.Add(ConfidencePart.DirectoryStillUsed); } yield return(result); } } }
public override IEnumerable <JunkNode> FindJunk() { var results = new List <JunkNode>(); var installLocationIsSafe = !OtherUninstallers.Any( x => PathTools.PathsEqual(x.InstallLocation, Uninstaller.InstallLocation)); var uninstallerLocationIsSafe = !OtherUninstallers.Any( x => PathTools.PathsEqual(x.UninstallerLocation, Uninstaller.UninstallerLocation)); var addAction = new Action <bool, Shortcut>((isSafe, source) => { var driveJunkNode = new DriveFileJunkNode(Path.GetDirectoryName(source.LinkFilename), Path.GetFileName(source.LinkFilename), Uninstaller.DisplayName); driveJunkNode.Confidence.Add(ConfidencePart.ExplicitConnection); if (!isSafe) { driveJunkNode.Confidence.Add(ConfidencePart.DirectoryStillUsed); } results.Add(driveJunkNode); // Remove from the shortcut list so other uninstallers won't show up with it //_links.Remove(source); }); foreach (var source in _links.ToList()) { if (CheckMatch(source.LinkTarget, Uninstaller.InstallLocation)) { addAction(installLocationIsSafe, source); } else if (CheckMatch(source.LinkTarget, Uninstaller.UninstallerLocation)) { addAction(uninstallerLocationIsSafe, source); } } return(results); }
private IEnumerable <JunkNode> ScanInstallerFolders() { var installLocation = Uninstaller.InstallLocation; if (string.IsNullOrEmpty(installLocation)) { yield break; } using (var key = Registry.LocalMachine.OpenSubKey( @"SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\Folders")) { if (key == null) { yield break; } foreach (var path in key.GetValueNames()) { if (!TestPathsMatch(installLocation, path)) { continue; } var node = new RegistryValueJunkNode(key.Name, path, Uninstaller.DisplayName); node.Confidence.Add(ConfidencePart.ExplicitConnection); if (OtherUninstallers.Any(x => TestPathsMatch(x.InstallLocation, path))) { node.Confidence.Add(ConfidencePart.DirectoryStillUsed); } yield return(node); } } }