public static extern int SHQueryRecycleBin(string pszRootPath, ref SHQUERYRBINFO pSHQueryRBInfo);
void DoWork(object sender, DoWorkEventArgs e) { try { int prgTracker = 0; if (maxCnt == 0) { MessageBox.Show(WPFLocalizeExtensionHelpers.GetUIString("error_select") + "!", WPFLocalizeExtensionHelpers.GetUIString("warning"), MessageBoxButtons.OK, MessageBoxIcon.Warning); Complete(fixAfterScan); return; } //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), ""); if (resultsTxt.InvokeRequired) { resultsTxt.Invoke(new MethodInvoker(delegate { resultsTxt.Text = ""; })); } else { resultsTxt.Text = ""; } if (filesToDelete != null) filesToDelete.Clear(); if (regValuesToDelete != null) regValuesToDelete.Clear(); if (foldersToDelete != null) foldersToDelete.Clear(); recycleBinCount = 0; recycleBinSize = 0; bool res = false; bool res1 = false; #region Windows Recent Documents if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[0].Nodes[0].Checked; })); } else { res = trvMain.Nodes[0].Nodes[0].Checked; } if (res) { try { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "Windows Recent Documents"); var d = new DirectoryInfo( Environment.GetFolderPath(Environment.SpecialFolder.Recent)); DirectoryInfo[] dires = d.GetDirectories("*", SearchOption.AllDirectories); FileInfo[] files = d.GetFiles(); foreach (DirectoryInfo dir in dires) { if (worker.CancellationPending) { e.Cancel = true; return; } foldersToDelete.Add(dir.FullName); filesToDelete.Add(dir.FullName); //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), dir.FullName); } foreach (FileInfo f in files) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(f.FullName); //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), f.FullName); } } catch { } } #endregion #region Start Menu Run if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[0].Nodes[1].Checked; })); } else { res = trvMain.Nodes[0].Nodes[1].Checked; } if (res) { try { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "Start Menu Run"); string runRegKeyPath = @"Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU\"; using (RegistryKey regKey = Registry.CurrentUser.OpenSubKey(runRegKeyPath)) { if (regKey != null) { foreach (string valueName in regKey.GetValueNames()) { if (worker.CancellationPending) { e.Cancel = true; return; } //Update progress bar worker.ReportProgress((int)((float)(int)((float)prgTracker / maxCnt * 100)), valueName); if (valueName.ToLower() != "default") { regValuesToDelete.Add(@"Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU\" + valueName); //Update progress bar worker.ReportProgress((int)((float)(int)((float)prgTracker / maxCnt * 100)), regValuesToDelete[regValuesToDelete.Count - 1]); } } } } } catch { } } #endregion #region Common Dialog File/Folder List if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[0].Nodes[2].Checked; })); } else { res = trvMain.Nodes[0].Nodes[2].Checked; } if (res) { try { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "Common Dialog File/Folder List"); string runRegKeyPath = @"Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\"; using (RegistryKey regKey = Registry.CurrentUser.OpenSubKey(runRegKeyPath)) { foreach (string subKeyName in regKey.GetSubKeyNames()) { if (worker.CancellationPending) { e.Cancel = true; return; } //Update progress bar worker.ReportProgress((int)((float)(int)((float)prgTracker / maxCnt * 100)), subKeyName); if (subKeyName == "LastVisitedPidlMRU" || subKeyName == "OpenSavePidlMRU") { regValuesToDelete.Add(@"Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\" + subKeyName); //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), regValuesToDelete[regValuesToDelete.Count - 1]); } } } } catch { } } #endregion #region Windows Clipboard //Clipboard.SetText("Hello"); //Clipboard.Clear(); try { if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[0].Nodes[3].Checked; })); } else { res = trvMain.Nodes[0].Nodes[3].Checked; } if (res) { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "Windows Clipboard"); Object obj = Clipboard.GetData("*"); } } catch { } #endregion #region Windows Temporary Files if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[0].Nodes[4].Checked; })); } else { res = trvMain.Nodes[0].Nodes[4].Checked; } if (res) { try { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "Windows Temporary Files"); //string sWinTempFilesAddress = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData).ToString(); string sWinTempFilesAddress = Environment.GetEnvironmentVariable("temp"); //sWinTempFilesAddress + "\\Temp"; var dirWindowsTempFiles = new DirectoryInfo(sWinTempFilesAddress); FileSystemInfo[] fileSysInfoWinTemp = dirWindowsTempFiles.GetFiles("*", SearchOption.AllDirectories); foreach (FileInfo f in fileSysInfoWinTemp) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(f.FullName); //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), f.FullName); } foreach (DirectoryInfo di in dirWindowsTempFiles.GetDirectories()) { if (worker.CancellationPending) { e.Cancel = true; return; } foldersToDelete.Add(di.FullName); } //TODO : Find Windows folder sWinTempFilesAddress = Environment.GetEnvironmentVariable("windir"); sWinTempFilesAddress = sWinTempFilesAddress + "\\temp"; dirWindowsTempFiles = new DirectoryInfo(sWinTempFilesAddress); fileSysInfoWinTemp = dirWindowsTempFiles.GetFiles("*", SearchOption.AllDirectories); foreach (FileInfo f in fileSysInfoWinTemp) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(f.FullName); //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), f.FullName); } foreach (DirectoryInfo di in dirWindowsTempFiles.GetDirectories()) { if (worker.CancellationPending) { e.Cancel = true; return; } foldersToDelete.Add(di.FullName); } string windir = Environment.GetEnvironmentVariable("windir"); filesToDelete.Add(windir + @"\Memory.dmp"); worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), filesToDelete[filesToDelete.Count - 1]); try { foreach (string f in Directory.GetFiles(windir, "*.log", SearchOption.AllDirectories)) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(f); worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), f); } } catch { } try { foreach (string f in Directory.GetFiles(windir + @"\minidump", "*", SearchOption.AllDirectories)) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(f); worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), f); } } catch { } try { foreach ( string f in Directory.GetFiles( Environment.GetEnvironmentVariable("PROGRAMDATA") + "\\Microsoft\\Windows\\WER\\ReportArchive", "*", SearchOption.AllDirectories)) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(f); worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), f); } var folders = new DirectoryInfo(Environment.GetEnvironmentVariable("PROGRAMDATA") + "\\Microsoft\\Windows\\WER\\ReportArchive"); foreach (DirectoryInfo di in folders.GetDirectories()) { if (worker.CancellationPending) { e.Cancel = true; return; } foldersToDelete.Add(di.FullName); } } catch { } try { foreach ( string f in Directory.GetFiles( Environment.GetEnvironmentVariable("PROGRAMDATA") + "\\Microsoft\\Windows\\WER\\ReportQueue", "*", SearchOption.AllDirectories)) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(f); worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), f); } var folders = new DirectoryInfo(Environment.GetEnvironmentVariable("PROGRAMDATA") + "\\Microsoft\\Windows\\WER\\ReportQueue"); foreach (DirectoryInfo di in folders.GetDirectories()) { if (worker.CancellationPending) { e.Cancel = true; return; } foldersToDelete.Add(di.FullName); } } catch { } try { foreach ( string f in Directory.GetFiles(Environment.GetEnvironmentVariable("LOCALAPPDATA") + "\\ElevatedDiagnostics", "*", SearchOption.AllDirectories)) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(f); worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), f); } var folders = new DirectoryInfo(Environment.GetEnvironmentVariable("LOCALAPPDATA") + "\\ElevatedDiagnostics"); foreach (DirectoryInfo di in folders.GetDirectories()) { if (worker.CancellationPending) { e.Cancel = true; return; } foldersToDelete.Add(di.FullName); } } catch { } try { foreach ( string f in Directory.GetFiles( Environment.GetEnvironmentVariable("LOCALAPPDATA") + "\\Microsoft\\Windows\\WER\\ReportQueue", "*", SearchOption.AllDirectories)) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(f); worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), f); } var folders = new DirectoryInfo(Environment.GetEnvironmentVariable("LOCALAPPDATA") + "\\Microsoft\\Windows\\WER\\ReportQueue"); foreach (DirectoryInfo di in folders.GetDirectories()) { if (worker.CancellationPending) { e.Cancel = true; return; } foldersToDelete.Add(di.FullName); } } catch { } try { foreach ( string f in Directory.GetFiles( Environment.GetEnvironmentVariable("LOCALAPPDATA") + "\\Microsoft\\Windows\\WER\\ReportArchive", "*", SearchOption.AllDirectories)) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(f); worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), f); } var folders = new DirectoryInfo(Environment.GetEnvironmentVariable("LOCALAPPDATA") + "\\Microsoft\\Windows\\WER\\ReportArchive"); foreach (DirectoryInfo di in folders.GetDirectories()) { if (worker.CancellationPending) { e.Cancel = true; return; } foldersToDelete.Add(di.FullName); } } catch { } } catch { } } #endregion #region Windows recycle bin if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[0].Nodes[5].Checked; })); } else { res = trvMain.Nodes[0].Nodes[5].Checked; } if (res) { try { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "Windows recycle bin"); var sqrbi = new SHQUERYRBINFO(); sqrbi.cbSize = Marshal.SizeOf(typeof(SHQUERYRBINFO)); int result = SHQueryRecycleBin("", ref sqrbi); if (result == 0) { recycleBinCount = sqrbi.i64NumItems; recycleBinSize = sqrbi.i64Size; } } catch { } } #endregion #region Mapped Drives if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[0].Nodes[6].Checked; })); } else { res = trvMain.Nodes[0].Nodes[6].Checked; res1 = trvMain.Nodes[0].Nodes[8].Checked; } if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res1 = trvMain.Nodes[0].Nodes[8].Checked; })); } if (res || res1) { if (worker.CancellationPending) { e.Cancel = true; return; } if (res && res1) prgTracker = prgTracker + 2; else prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "Mapped Drives"); DriveInfo[] drives = null; try { drives = DriveInfo.GetDrives(); } catch (IOException) { } catch (UnauthorizedAccessException) { } if (drives != null) { foreach (DriveInfo drive in drives) { if (worker.CancellationPending) { e.Cancel = true; return; } try { //Update progress bar if (drive.DriveType == DriveType.Network) { filesToDelete.Add(drive.Name); //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), drive.Name); } } catch (Exception) { } } } } #endregion #region Start Menu Click History if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[0].Nodes[7].Checked; })); } else { res = trvMain.Nodes[0].Nodes[7].Checked; } if (res) { try { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "Start Menu Click History"); var dirInfoStartMenu = new DirectoryInfo( Environment.GetFolderPath(Environment.SpecialFolder.StartMenu)); DirectoryInfo[] dirStartMenu = dirInfoStartMenu.GetDirectories("*", SearchOption.AllDirectories); FileInfo[] filesStartMenu = dirInfoStartMenu.GetFiles(); } catch { } } #endregion #region Internet Explorer URL History if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[1].Nodes[0].Checked; })); } else { res = trvMain.Nodes[1].Nodes[0].Checked; } if (res) { try { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "Internet Explorer URL History"); while (Enumerator.MoveNext()) { if (worker.CancellationPending) { e.Cancel = true; return; } string s = Enumerator.Current.pwcsUrl; if (s.StartsWith("http")) { filesToDelete.Add(s); //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), s); } } } catch { } } #endregion #region Internet Explorer History if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[1].Nodes[1].Checked; })); } else { res = trvMain.Nodes[1].Nodes[1].Checked; } if (res) { try { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "Internet Explorer History"); var ieHistory1 = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Microsoft\Windows\History"); foreach (FileInfo fi in ieHistory1.GetFiles("*", SearchOption.AllDirectories)) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(fi.FullName); worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), fi.FullName); } foreach (DirectoryInfo di in ieHistory1.GetDirectories()) { if (worker.CancellationPending) { e.Cancel = true; return; } foldersToDelete.Add(di.FullName); } var ieHistory2 = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Microsoft\Internet Explorer\Recovery"); foreach (FileInfo fi in ieHistory2.GetFiles("*", SearchOption.AllDirectories)) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(fi.FullName); worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), fi.FullName); } foreach (DirectoryInfo di in ieHistory2.GetDirectories()) { if (worker.CancellationPending) { e.Cancel = true; return; } foldersToDelete.Add(di.FullName); } } catch { } } #endregion #region Internet Explorer Cache if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[1].Nodes[2].Checked; })); } else { res = trvMain.Nodes[1].Nodes[2].Checked; } if (res) { try { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "Internet Explorer Cache"); var dIECookies = new DirectoryInfo( Environment.GetFolderPath(Environment.SpecialFolder.Cookies)); DirectoryInfo[] dirCookies = dIECookies.GetDirectories("*", SearchOption.AllDirectories); FileInfo[] filesCookies = dIECookies.GetFiles("*", SearchOption.AllDirectories); foreach (DirectoryInfo dir in dirCookies) { if (worker.CancellationPending) { e.Cancel = true; return; } foldersToDelete.Add(dir.FullName); //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), dir.FullName); } foreach (FileInfo f in filesCookies) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(f.FullName); //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), f.FullName); } } catch { } } #endregion #region AutoComplete Passwords if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[1].Nodes[3].Checked; })); } else { res = trvMain.Nodes[1].Nodes[3].Checked; } if (res) { try { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "AutoComplete Passwords"); string uninstallKey = @"Software\Microsoft\Internet Explorer\TypedURLs"; using (RegistryKey rk = Registry.CurrentUser.OpenSubKey(uninstallKey)) { foreach (string skName in rk.GetValueNames()) { if (worker.CancellationPending) { e.Cancel = true; return; } //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), skName); if (skName.ToLower() != "default") { regValuesToDelete.Add(@"Software\Microsoft\Internet Explorer\TypedURLs\" + skName); //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), regValuesToDelete[regValuesToDelete.Count - 1]); } } } } catch { } } #endregion #region Temporary Internet Files if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[1].Nodes[4].Checked; })); } else { res = trvMain.Nodes[1].Nodes[4].Checked; } if (res) { try { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "Temporary Internet Files"); string tempDir = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache); var diInfoIECache = new DirectoryInfo(tempDir); DirectoryInfo[] dirCache = diInfoIECache.GetDirectories("*", SearchOption.AllDirectories); FileInfo[] filesCache = diInfoIECache.GetFiles(); foreach (FileInfo fi in filesCache) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(fi.FullName); //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), fi.FullName); } foreach (DirectoryInfo dir in dirCache) { if (worker.CancellationPending) { e.Cancel = true; return; } foldersToDelete.Add(dir.FullName); } tempDir = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Microsoft\Feeds Cache"; diInfoIECache = new DirectoryInfo(tempDir); dirCache = diInfoIECache.GetDirectories("*", SearchOption.AllDirectories); filesCache = diInfoIECache.GetFiles(); foreach (FileInfo fi in filesCache) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(fi.FullName); //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), fi.FullName); } foreach (DirectoryInfo dir in dirCache) { if (worker.CancellationPending) { e.Cancel = true; return; } foldersToDelete.Add(dir.FullName); } } catch { } } #endregion #region Index.dat if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[1].Nodes[5].Checked; })); } else { res = trvMain.Nodes[1].Nodes[5].Checked; } if (res) { try { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "Index.dat"); string sIndexDat = Environment.GetFolderPath(Environment.SpecialFolder.Cookies); var diInfoIEIndexDatCookies = new DirectoryInfo(sIndexDat); FileInfo[] fileInfoIndexDatCookies = diInfoIEIndexDatCookies.GetFiles("index.dat"); filesToDelete.Add(fileInfoIndexDatCookies[0].FullName); sIndexDat = Environment.GetFolderPath(Environment.SpecialFolder.History); var diInfoIEIndexDatHistory = new DirectoryInfo(sIndexDat); FileSystemInfo[] fileSysInfoHistory = diInfoIEIndexDatHistory.GetDirectories(); foreach (DirectoryInfo diNext in fileSysInfoHistory) { if (worker.CancellationPending) { e.Cancel = true; return; } //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), diNext.FullName); FileInfo[] datfiles = diNext.GetFiles("index.dat"); foreach (FileInfo f in datfiles) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(f.FullName); //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), f.FullName); } } // prgTracker++; sIndexDat = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache); var diInfoIEIndexDatCache = new DirectoryInfo(sIndexDat); FileSystemInfo[] fileSysInfoCache = diInfoIEIndexDatCache.GetDirectories(); foreach (DirectoryInfo diNext in fileSysInfoCache) { if (worker.CancellationPending) { e.Cancel = true; return; } //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), diNext.FullName); FileInfo[] datfiles = diNext.GetFiles("index.dat"); foreach (FileInfo f in datfiles) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(f.FullName); //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), f.FullName); } } } catch { } } #endregion #region Plugins try { string appData = Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System)) + "\\Users\\" + Environment.UserName + "\\AppData"; string localLowData = appData + "\\LocalLow"; string localData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); string roamingData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); string programData = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData); // windows media player try { if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[2].Nodes[0].Checked; })); } else { res = trvMain.Nodes[2].Nodes[0].Checked; } if (res) { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "Windows Media Player"); var mediaPlayerDir = new DirectoryInfo(localData + "\\Microsoft\\Media Player"); foreach (DirectoryInfo d in mediaPlayerDir.GetDirectories()) { if (worker.CancellationPending) { e.Cancel = true; return; } if (d.Name.ToLower().Contains("cache")) { foreach (FileInfo fi in d.GetFiles("*", SearchOption.AllDirectories)) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(fi.FullName); worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), fi.FullName); } foreach (DirectoryInfo di in d.GetDirectories()) { if (worker.CancellationPending) { e.Cancel = true; return; } foldersToDelete.Add(di.FullName); } } } } } catch { } //quick time player try { if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[2].Nodes[1].Checked; })); } else { res = trvMain.Nodes[2].Nodes[1].Checked; } if (res) { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "Quick Time Player"); var quickTimeDir = new DirectoryInfo(localLowData + "\\Apple Computer\\quicktime\\downloads"); foreach (FileInfo fi in quickTimeDir.GetFiles("*", SearchOption.AllDirectories)) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(fi.FullName); worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), fi.FullName); } foreach (DirectoryInfo di in quickTimeDir.GetDirectories()) { if (worker.CancellationPending) { e.Cancel = true; return; } foldersToDelete.Add(di.FullName); } } } catch { } //macromedia flash player try { if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[2].Nodes[2].Checked; })); } else { res = trvMain.Nodes[2].Nodes[2].Checked; } if (res) { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "Macromedia Flash Player"); var macromediaFlashDir = new DirectoryInfo(roamingData + "\\Macromedia\\Flash Player"); foreach (FileInfo fi in macromediaFlashDir.GetFiles("*", SearchOption.AllDirectories)) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(fi.FullName); worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), fi.FullName); } foreach (DirectoryInfo di in macromediaFlashDir.GetDirectories()) { if (worker.CancellationPending) { e.Cancel = true; return; } foldersToDelete.Add(di.FullName); } } } catch { } //microsoft office try { if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[2].Nodes[3].Checked; })); } else { res = trvMain.Nodes[2].Nodes[3].Checked; } if (res) { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "Microsoft Office"); var officeDir = new DirectoryInfo(roamingData + "\\Microsoft\\Office"); foreach (FileInfo fi in officeDir.GetFiles("*", SearchOption.AllDirectories)) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(fi.FullName); worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), fi.FullName); } foreach (DirectoryInfo di in officeDir.GetDirectories()) { if (worker.CancellationPending) { e.Cancel = true; return; } foldersToDelete.Add(di.FullName); } } } catch { } //ms management console try { if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[2].Nodes[4].Checked; })); } else { res = trvMain.Nodes[2].Nodes[4].Checked; } if (res) { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "MS Management console"); using ( RegistryKey regKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Microsoft Management Console\Recent File List\")) { foreach (string subKeyName in regKey.GetValueNames()) { if (worker.CancellationPending) { e.Cancel = true; return; } if (subKeyName.ToLower() != "default") { string name = @"Software\Microsoft\Microsoft Management Console\Recent File List\" + subKeyName; regValuesToDelete.Add(name); worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), name); } } } } } catch { } //ms wordpad try { if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[2].Nodes[5].Checked; })); } else { res = trvMain.Nodes[2].Nodes[5].Checked; } if (res) { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "MS Wordpad"); using ( RegistryKey regKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Applets\Wordpad\Recent File List\")) { foreach (string subKeyName in regKey.GetValueNames()) { if (worker.CancellationPending) { e.Cancel = true; return; } if (subKeyName.ToLower() != "default") { string name = @"Software\Microsoft\Windows\CurrentVersion\Applets\Wordpad\Recent File List\" + subKeyName; regValuesToDelete.Add(name); worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), name); } } } } } catch { } //ms paint try { if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[2].Nodes[6].Checked; })); } else { res = trvMain.Nodes[2].Nodes[6].Checked; } if (res) { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "MS Paint"); using ( RegistryKey regKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Applets\Paint\Recent File List\")) { foreach (string subKeyName in regKey.GetValueNames()) { if (worker.CancellationPending) { e.Cancel = true; return; } if (subKeyName.ToLower() != "default") { string name = @"Software\Microsoft\Windows\CurrentVersion\Applets\Paint\Recent File List\" + subKeyName; regValuesToDelete.Add(name); worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), name); } } } } } catch { } //winrar try { if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[2].Nodes[7].Checked; })); } else { res = trvMain.Nodes[2].Nodes[7].Checked; } if (res) { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "Winrar"); using (RegistryKey regKey = Registry.CurrentUser.OpenSubKey(@"Software\WinRAR\ArcHistory\")) { foreach (string subKeyName in regKey.GetValueNames()) { if (worker.CancellationPending) { e.Cancel = true; return; } if (subKeyName.ToLower() != "default") { string name = @"Software\WinRAR\ArcHistory\" + subKeyName; regValuesToDelete.Add(name); worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), name); } } } using (RegistryKey regKey = Registry.CurrentUser.OpenSubKey(@"Software\WinRAR\DialogEditHistory\ArcName\")) { foreach (string subKeyName in regKey.GetValueNames()) { if (worker.CancellationPending) { e.Cancel = true; return; } if (subKeyName.ToLower() != "default") { string name = @"Software\WinRAR\DialogEditHistory\ArcName\" + subKeyName; regValuesToDelete.Add(name); worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), name); } } } } } catch { } //sun java try { if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[2].Nodes[8].Checked; })); } else { res = trvMain.Nodes[2].Nodes[8].Checked; } if (res) { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "Sun Java"); var javaDir = new DirectoryInfo(localData + "\\Sun\\Java\\Deployment\\cache"); foreach (FileInfo fi in javaDir.GetFiles("*", SearchOption.AllDirectories)) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(fi.FullName); worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), fi.FullName); } foreach (DirectoryInfo di in javaDir.GetDirectories()) { if (worker.CancellationPending) { e.Cancel = true; return; } foldersToDelete.Add(di.FullName); } } } catch { } //windows defender try { if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[2].Nodes[9].Checked; })); } else { res = trvMain.Nodes[2].Nodes[9].Checked; } if (res) { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "Windows Defender"); var officeDir = new DirectoryInfo(programData + "\\Microsoft\\Windows Defender\\Scans\\History\\Results\\Quick"); foreach (FileInfo fi in officeDir.GetFiles("*", SearchOption.AllDirectories)) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(fi.FullName); worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), fi.FullName); } foreach (DirectoryInfo di in officeDir.GetDirectories()) { if (worker.CancellationPending) { e.Cancel = true; return; } foldersToDelete.Add(di.FullName); } } } catch { } } catch { } #endregion #region Mozilla Firefox try { string sMozillaHistory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); sMozillaHistory = sMozillaHistory + "\\Mozilla\\Firefox\\Profiles"; #region Mozilla Firefox History if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[3].Nodes[0].Checked; })); } else { res = trvMain.Nodes[3].Nodes[0].Checked; } if (res) { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "Mozilla Firefox History"); if (Directory.Exists(sMozillaHistory)) { try { var diInfoFirefoxHistory = new DirectoryInfo(sMozillaHistory); FileSystemInfo[] fileSysFirefoxHistory = diInfoFirefoxHistory.GetDirectories(); foreach (DirectoryInfo diNext in fileSysFirefoxHistory) { if (worker.CancellationPending) { e.Cancel = true; return; } //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), diNext.FullName); foreach (FileInfo f in diNext.GetFiles("places.sqlite")) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(f.FullName); //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), f.FullName); } foreach (FileInfo f in diNext.GetFiles("session*")) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(f.FullName); //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), f.FullName); } foreach (FileInfo f in diNext.GetFiles("history.dat")) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(f.FullName); //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), f.FullName); } } } catch { } } } #endregion #region Mozilla Firefox Cookies if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[3].Nodes[1].Checked; })); } else { res = trvMain.Nodes[3].Nodes[1].Checked; } if (res) { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "Mozilla Firefox Cookies"); if (Directory.Exists(sMozillaHistory)) { try { var diInfoFirefoxCookies = new DirectoryInfo(sMozillaHistory); FileSystemInfo[] fileSysFirefoxCookies = diInfoFirefoxCookies.GetDirectories(); foreach (DirectoryInfo diNext in fileSysFirefoxCookies) { if (worker.CancellationPending) { e.Cancel = true; return; } //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), diNext.FullName); FileInfo[] datfiles = diNext.GetFiles("cookies.sqlite"); foreach (FileInfo f in datfiles) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(f.FullName); //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), f.FullName); } } } catch { } } } #endregion #region Mozilla Firefox Internet Cache if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[3].Nodes[2].Checked; })); } else { res = trvMain.Nodes[3].Nodes[2].Checked; } if (res) { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "Mozilla Firefox Internet Cache"); if (Directory.Exists(sMozillaHistory)) { try { var diInfoFirefoxCookies = new DirectoryInfo(sMozillaHistory); FileSystemInfo[] fileSysFirefoxCookies = diInfoFirefoxCookies.GetDirectories(); foreach (DirectoryInfo diNext in fileSysFirefoxCookies) { if (worker.CancellationPending) { e.Cancel = true; return; } //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), diNext.FullName); DirectoryInfo cacheFolder1 = diNext.GetDirectories("OfflineCache").FirstOrDefault(); if (cacheFolder1 != null) { foreach (FileInfo file in cacheFolder1.GetFiles("*", SearchOption.AllDirectories)) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(file.FullName); worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), file.FullName); } } DirectoryInfo cacheFolder2 = diNext.GetDirectories("Cache").FirstOrDefault(); if (cacheFolder2 != null) { foreach (FileInfo file in cacheFolder2.GetFiles("*", SearchOption.AllDirectories)) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(file.FullName); worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), file.FullName); } } } } catch { } } } #endregion #region Mozilla Firefox Saved Form information if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[3].Nodes[3].Checked; })); } else { res = trvMain.Nodes[3].Nodes[3].Checked; } if (res) { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "Mozilla Firefox Saved Form information"); if (Directory.Exists(sMozillaHistory)) { try { var diInfoFirefoxformHistory = new DirectoryInfo(sMozillaHistory); FileSystemInfo[] fileSysFirefoxformHistory = diInfoFirefoxformHistory.GetDirectories(); foreach (DirectoryInfo diNext in fileSysFirefoxformHistory) { if (worker.CancellationPending) { e.Cancel = true; return; } //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), diNext.FullName); FileInfo[] datfiles = diNext.GetFiles("formhistory.sqlite"); foreach (FileInfo f in datfiles) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(f.FullName); //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), f.FullName); } } } catch { } } } #endregion #region Mozilla Firefox Saved Passwords if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[3].Nodes[4].Checked; })); } else { res = trvMain.Nodes[3].Nodes[4].Checked; } if (res) { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "Mozilla Firefox Saved Passwords"); if (Directory.Exists(sMozillaHistory)) { try { var diInfoFirefoxformPwd = new DirectoryInfo(sMozillaHistory); FileSystemInfo[] fileSysFirefoxformPwd = diInfoFirefoxformPwd.GetDirectories(); foreach (DirectoryInfo diNext in fileSysFirefoxformPwd) { if (worker.CancellationPending) { e.Cancel = true; return; } //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), diNext.FullName); FileInfo[] datfiles = diNext.GetFiles("key3.db"); foreach (FileInfo f in datfiles) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(f.FullName); //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), f.FullName); } } } catch { } } } #endregion #region Mozilla Firefox Download Manager History if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[3].Nodes[5].Checked; })); } else { res = trvMain.Nodes[3].Nodes[5].Checked; } if (res) { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "Mozilla Firefox Download Manager History"); if (Directory.Exists(sMozillaHistory)) { try { var diInfoFirefoxformDownload = new DirectoryInfo(sMozillaHistory); FileSystemInfo[] fileSysFirefoxformDownload = diInfoFirefoxformDownload.GetDirectories(); foreach (DirectoryInfo diNext in fileSysFirefoxformDownload) { if (worker.CancellationPending) { e.Cancel = true; return; } //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), diNext.FullName); FileInfo[] datfiles = diNext.GetFiles("downloads.sqlite"); foreach (FileInfo f in datfiles) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(f.FullName); //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), f.FullName); } } } catch { } } } #endregion #region Mozilla Firefox Search History if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[3].Nodes[6].Checked; })); } else { res = trvMain.Nodes[3].Nodes[6].Checked; } if (res) { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "Mozilla Firefox Search History"); if (Directory.Exists(sMozillaHistory)) { try { var diInfoFirefoxformSearch = new DirectoryInfo(sMozillaHistory); FileSystemInfo[] fileSysFirefoxformSearch = diInfoFirefoxformSearch.GetDirectories(); foreach (DirectoryInfo diNext in fileSysFirefoxformSearch) { if (worker.CancellationPending) { e.Cancel = true; return; } //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), diNext.FullName); FileInfo[] datfiles = diNext.GetFiles("search.sqlite"); foreach (FileInfo f in datfiles) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(f.FullName); //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), f.FullName); } } } catch { } } } #endregion } catch { } #endregion #region Google Chrome try { string sGoogleChromePath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); sGoogleChromePath = sGoogleChromePath + "\\Google\\Chrome\\User Data"; #region Google Chrome History if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[4].Nodes[0].Checked; })); } if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res1 = trvMain.Nodes[4].Nodes[4].Checked; })); } else { res = trvMain.Nodes[4].Nodes[0].Checked; res1 = trvMain.Nodes[4].Nodes[4].Checked; } if (res || res1) { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "Google Chrome History"); if (Directory.Exists(sGoogleChromePath)) { try { DirectoryInfo diInfoChromeHistory = new DirectoryInfo(sGoogleChromePath); DirectoryInfo[] profileDirs = diInfoChromeHistory.GetDirectories(); foreach (DirectoryInfo dir in profileDirs) { if (worker.CancellationPending) { e.Cancel = true; return; } MarkFilesToDelete(dir, "History"); MarkFilesToDelete(dir, "*Visited Links*"); MarkFilesToDelete(dir, "*Current Tabs*"); MarkFilesToDelete(dir, "*Top Sites"); MarkFilesToDelete(dir, "*Network Action Predictor"); } diInfoChromeHistory = new DirectoryInfo(sGoogleChromePath + @"\Default\JumpListIcons"); MarkDirToDelete(diInfoChromeHistory); diInfoChromeHistory = new DirectoryInfo(sGoogleChromePath + @"\Default\JumpListIconsOld"); MarkDirToDelete(diInfoChromeHistory); } catch { } } } #endregion #region Google Chrome Cookies if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[4].Nodes[1].Checked; })); } else { res = trvMain.Nodes[4].Nodes[1].Checked; } if (res) { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "Google Chrome Cookies"); if (Directory.Exists(sGoogleChromePath)) { try { var diInfoChromeHistory = new DirectoryInfo(sGoogleChromePath); DirectoryInfo[] profileDirs = diInfoChromeHistory.GetDirectories(); foreach (DirectoryInfo dir in profileDirs) { if (worker.CancellationPending) { e.Cancel = true; return; } FileSystemInfo[] fileSysChromeHistory = dir.GetFiles("*Cookies*"); foreach (FileInfo diNext in fileSysChromeHistory) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(diNext.FullName); //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), diNext.FullName); } } } catch { } } } #endregion #region Google Chrome internet Cache if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[4].Nodes[2].Checked; })); } else { res = trvMain.Nodes[4].Nodes[2].Checked; } if (res) { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "Google Chrome Internet Cache"); try { var diInfoChromeHistory = new DirectoryInfo(sGoogleChromePath); DirectoryInfo[] profileDirs = diInfoChromeHistory.GetDirectories(); foreach (DirectoryInfo dir in profileDirs) { if (worker.CancellationPending) { e.Cancel = true; return; } DirectoryInfo cache = dir.GetDirectories("Cache").FirstOrDefault(); if (cache != null) { FileInfo[] files = cache.GetFiles(); foreach (FileInfo diNext in files) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(diNext.FullName); worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), diNext.FullName); } } } } catch { } } #endregion #region Google Chrome Saved Form Information if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[4].Nodes[3].Checked; })); } else { res = trvMain.Nodes[4].Nodes[3].Checked; } if (res) { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "Google Chrome Saved Form Information"); if (Directory.Exists(sGoogleChromePath)) { try { var diInfoChromeHistory = new DirectoryInfo(sGoogleChromePath); DirectoryInfo[] profileDirs = diInfoChromeHistory.GetDirectories(); foreach (DirectoryInfo dir in profileDirs) { if (worker.CancellationPending) { e.Cancel = true; return; } FileSystemInfo[] fileSysChromeHistory = dir.GetFiles("*Web Data*"); foreach (FileInfo diNext in fileSysChromeHistory) { if (worker.CancellationPending) { e.Cancel = true; return; } filesToDelete.Add(diNext.FullName); //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), diNext.FullName); } } } catch { } } } #endregion #region Google Chrome Download History if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res = trvMain.Nodes[4].Nodes[0].Checked; })); } if (trvMain.InvokeRequired) { trvMain.Invoke(new MethodInvoker(delegate { res1 = trvMain.Nodes[4].Nodes[4].Checked; })); } else { res = trvMain.Nodes[4].Nodes[0].Checked; res = trvMain.Nodes[4].Nodes[4].Checked; } if (res || res1) { if (worker.CancellationPending) { e.Cancel = true; return; } prgTracker++; worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), "Google Chrome Download History"); if (Directory.Exists(sGoogleChromePath)) { try { var diInfoChromeHistory = new DirectoryInfo(sGoogleChromePath); DirectoryInfo[] profileDirs = diInfoChromeHistory.GetDirectories(); FileSystemInfo[] fileSysChromeHistory; foreach (DirectoryInfo dir in profileDirs) { if (worker.CancellationPending) { e.Cancel = true; return; } try { fileSysChromeHistory = dir.GetFiles("*history*"); foreach (FileInfo diNext in fileSysChromeHistory) { if (worker.CancellationPending) { e.Cancel = true; return; } //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), diNext.FullName); if (!filesToDelete.Contains(diNext.FullName)) { filesToDelete.Add(diNext.FullName); //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), diNext.FullName); } } } catch { } try { fileSysChromeHistory = dir.GetFiles("*Visited Links*"); foreach (FileInfo diNext in fileSysChromeHistory) { if (worker.CancellationPending) { e.Cancel = true; return; } //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), diNext.FullName); if (!filesToDelete.Contains(diNext.FullName)) { filesToDelete.Add(diNext.FullName); //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), diNext.FullName); } } } catch { } try { fileSysChromeHistory = dir.GetFiles("*Current Tabs*"); foreach (FileInfo diNext in fileSysChromeHistory) { if (worker.CancellationPending) { e.Cancel = true; return; } //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), diNext.FullName); if (!filesToDelete.Contains(diNext.FullName)) { filesToDelete.Add(diNext.FullName); //Update progress bar worker.ReportProgress((int)((float)prgTracker / maxCnt * 100), diNext.FullName); } } } catch { } } } catch { } } } #endregion } catch { } #endregion if (worker.CancellationPending) { e.Cancel = true; return; } } catch (Exception) { // ToDo: send exception details via SmartAssembly bug reporting! } }
/// <summary> /// handle do work event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void DoWork(object sender, DoWorkEventArgs e) { try { Thread.CurrentThread.CurrentUICulture = culture; if (txtResults.InvokeRequired) { txtResults.Invoke(new MethodInvoker(delegate { txtResults.Text = rm.GetString("scan_started"); })); } filesToDelete.Clear(); regValuesToDelete.Clear(); foldersToDelete.Clear(); recycleBinCount = 0; recycleBinSize = 0; bool res = false; bool res1 = false; #region Windows Recent Documents if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[0].Nodes[0].Checked; })); } else { res = trvTracks.Nodes[0].Nodes[0].Checked; } if (res) { try { DirectoryInfo d = new DirectoryInfo( Environment.GetFolderPath(Environment.SpecialFolder.Recent)); MarkDirToDelete(d); } catch { } } #endregion #region Start Menu Run if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[0].Nodes[1].Checked; })); } else { res = trvTracks.Nodes[0].Nodes[1].Checked; } if (res) { try { string runRegKeyPath = @"Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU\"; using (RegistryKey regKey = Registry.CurrentUser.OpenSubKey(runRegKeyPath)) { if (regKey != null) { foreach (string valueName in regKey.GetValueNames()) { if (valueName.ToLower() != "default") regValuesToDelete.Add(@"Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU\" + valueName); } } } } catch { } } #endregion #region Common Dialog File/Folder List if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[0].Nodes[2].Checked; })); } else { res = trvTracks.Nodes[0].Nodes[2].Checked; } if (res) { try { string runRegKeyPath = @"Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\"; using (RegistryKey regKey = Registry.CurrentUser.OpenSubKey(runRegKeyPath)) { foreach (string subKeyName in regKey.GetSubKeyNames()) { if (subKeyName == "LastVisitedPidlMRU" || subKeyName == "OpenSavePidlMRU") regValuesToDelete.Add(@"Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\" + subKeyName); } } } catch { } } #endregion #region Start Menu Search #endregion #region Windows Clipboard try { if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[0].Nodes[3].Checked; })); } else { res = trvTracks.Nodes[0].Nodes[3].Checked; } if (res) { Object obj = Clipboard.GetData("*"); } } catch { } #endregion #region Windows Temporary Files if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[0].Nodes[4].Checked; })); } else { res = trvTracks.Nodes[0].Nodes[4].Checked; } if (res) { try { string sWinTempFilesAddress = Environment.GetEnvironmentVariable("temp"); DirectoryInfo dirWindowsTempFiles = new DirectoryInfo(sWinTempFilesAddress); MarkDirToDelete(dirWindowsTempFiles); sWinTempFilesAddress = Environment.GetEnvironmentVariable("windir"); sWinTempFilesAddress = sWinTempFilesAddress + "\\temp"; dirWindowsTempFiles = new DirectoryInfo(sWinTempFilesAddress); MarkDirToDelete(dirWindowsTempFiles); string windir = Environment.GetEnvironmentVariable("windir"); filesToDelete.Add(windir + @"\Memory.dmp"); try { filesToDelete.AddRange(Directory.GetFiles(windir, "*.log", SearchOption.AllDirectories)); } catch { } try { filesToDelete.AddRange(Directory.GetFiles(windir + @"\minidump", "*", SearchOption.AllDirectories)); } catch { } try { DirectoryInfo d = new DirectoryInfo( Environment.GetEnvironmentVariable("PROGRAMDATA") + "\\Microsoft\\Windows\\WER\\ReportArchive"); MarkDirToDelete(d); } catch { } try { DirectoryInfo d = new DirectoryInfo( Environment.GetEnvironmentVariable("PROGRAMDATA") + "\\Microsoft\\Windows\\WER\\ReportQueue"); MarkDirToDelete(d); } catch { } try { DirectoryInfo d = new DirectoryInfo( Environment.GetEnvironmentVariable("LOCALAPPDATA") + "\\ElevatedDiagnostics"); MarkDirToDelete(d); } catch { } try { DirectoryInfo d = new DirectoryInfo( Environment.GetEnvironmentVariable("LOCALAPPDATA") + "\\Microsoft\\Windows\\WER\\ReportQueue"); MarkDirToDelete(d); } catch { } try { DirectoryInfo d = new DirectoryInfo( Environment.GetEnvironmentVariable("LOCALAPPDATA") + "\\Microsoft\\Windows\\WER\\ReportArchive"); MarkDirToDelete(d); } catch { } } catch { } } #endregion #region Windows recycle bin if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[0].Nodes[5].Checked; })); } else { res = trvTracks.Nodes[0].Nodes[5].Checked; } if (res) { try { SHQUERYRBINFO sqrbi = new SHQUERYRBINFO(); sqrbi.cbSize = Marshal.SizeOf(typeof(SHQUERYRBINFO)); int result = SHQueryRecycleBin(string.Empty, ref sqrbi); if (result == 0) { recycleBinCount = sqrbi.i64NumItems; recycleBinSize = sqrbi.i64Size; } } catch { } } #endregion #region Mapped Drives if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[0].Nodes[6].Checked; })); } else { res = trvTracks.Nodes[0].Nodes[6].Checked; res1 = trvTracks.Nodes[0].Nodes[8].Checked; } if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res1 = trvTracks.Nodes[0].Nodes[8].Checked; })); } if (res || res1) { DriveInfo[] drives = null; try { drives = DriveInfo.GetDrives(); } catch (IOException) { } catch (UnauthorizedAccessException) { } if (drives != null) { foreach (DriveInfo drive in drives) { try { if (drive.DriveType == DriveType.Network) filesToDelete.Add(drive.Name); } catch (Exception ex) { } } } } #endregion #region Start Menu Click History if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[0].Nodes[7].Checked; })); } else { res = trvTracks.Nodes[0].Nodes[7].Checked; } if (res) { try { DirectoryInfo dirInfoStartMenu = new DirectoryInfo( Environment.GetFolderPath(Environment.SpecialFolder.StartMenu)); MarkDirToDelete(dirInfoStartMenu); } catch { } } #endregion #region Internet Explorer URL History if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[1].Nodes[0].Checked; })); } else { res = trvTracks.Nodes[1].Nodes[0].Checked; } if (res) { try { while (Enumerator.MoveNext()) { string s = Enumerator.Current.pwcsUrl; if (s.StartsWith("http")) { filesToDelete.Add(s); } } } catch { } } #endregion #region Internet Explorer History if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[1].Nodes[1].Checked; })); } else { res = trvTracks.Nodes[1].Nodes[1].Checked; } if (res) { try { DirectoryInfo ieHistory1 = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Microsoft\Windows\History"); MarkDirToDelete(ieHistory1); DirectoryInfo ieHistory2 = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Microsoft\Internet Explorer\Recovery"); MarkDirToDelete(ieHistory2); } catch { } } #endregion #region Internet Explorer Cache if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[1].Nodes[2].Checked; })); } else { res = trvTracks.Nodes[1].Nodes[2].Checked; } if (res) { try { DirectoryInfo dIECookies = new DirectoryInfo( Environment.GetFolderPath(Environment.SpecialFolder.Cookies)); MarkDirToDelete(dIECookies); } catch { } } #endregion #region AutoComplete Passwords if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[1].Nodes[3].Checked; })); } else { res = trvTracks.Nodes[1].Nodes[3].Checked; } if (res) { try { string uninstallKey = @"Software\Microsoft\Internet Explorer\TypedURLs"; using (RegistryKey rk = Registry.CurrentUser.OpenSubKey(uninstallKey)) { foreach (string skName in rk.GetValueNames()) { if (skName.ToLower() != "default") { regValuesToDelete.Add(@"Software\Microsoft\Internet Explorer\TypedURLs\" + skName); } } } } catch { } } #endregion #region Temporary Internet Files if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[1].Nodes[4].Checked; })); } else { res = trvTracks.Nodes[1].Nodes[4].Checked; } if (res) { try { DirectoryInfo diInfoIECache = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.InternetCache)); MarkDirToDelete(diInfoIECache); diInfoIECache = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Microsoft\Feeds Cache"); MarkDirToDelete(diInfoIECache); } catch { } } #endregion #region Index.dat if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[1].Nodes[5].Checked; })); } else { res = trvTracks.Nodes[1].Nodes[5].Checked; } if (res) { try { string sIndexDat = Environment.GetFolderPath(Environment.SpecialFolder.Cookies); DirectoryInfo diInfoIEIndexDatCookies = new DirectoryInfo(sIndexDat); FileInfo[] fileInfoIndexDatCookies = diInfoIEIndexDatCookies.GetFiles("index.dat"); filesToDelete.Add(fileInfoIndexDatCookies[0].FullName); sIndexDat = Environment.GetFolderPath(Environment.SpecialFolder.History); DirectoryInfo diInfoIEIndexDatHistory = new DirectoryInfo(sIndexDat); FileSystemInfo[] fileSysInfoHistory = diInfoIEIndexDatHistory.GetDirectories(); foreach (DirectoryInfo diNext in fileSysInfoHistory) { MarkFilesToDelete(diNext, "index.dat"); } sIndexDat = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache); DirectoryInfo diInfoIEIndexDatCache = new DirectoryInfo(sIndexDat); FileSystemInfo[] fileSysInfoCache = diInfoIEIndexDatCache.GetDirectories(); foreach (DirectoryInfo diNext in fileSysInfoCache) { MarkFilesToDelete(diNext, "index.dat"); } } catch { } } #endregion #region Plugins try { string appData = Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System)) + "\\Users\\" + Environment.UserName + "\\AppData"; string localLowData = appData + "\\LocalLow"; string localData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); string roamingData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); string programData = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData); // windows media player try { if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[2].Nodes[0].Checked; })); } if (res) { DirectoryInfo mediaPlayerDir = new DirectoryInfo(localData + "\\Microsoft\\Media Player"); foreach (DirectoryInfo d in mediaPlayerDir.GetDirectories()) { if (d.Name.ToLower().Contains("cache")) { MarkDirToDelete(d); } } } } catch { } //quick time player try { if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[2].Nodes[1].Checked; })); } if (res) { DirectoryInfo quickTimeDir = new DirectoryInfo(localLowData + "\\Apple Computer\\quicktime\\downloads"); MarkDirToDelete(quickTimeDir); } } catch { } //macromedia flash player try { if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[2].Nodes[2].Checked; })); } if (res) { DirectoryInfo macromediaFlashDir = new DirectoryInfo(roamingData + "\\Macromedia\\Flash Player"); MarkDirToDelete(macromediaFlashDir); } } catch { } //microsoft office try { if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[2].Nodes[3].Checked; })); } if (res) { DirectoryInfo officeDir = new DirectoryInfo(roamingData + "\\Microsoft\\Office"); MarkDirToDelete(officeDir); } } catch { } //ms management console try { if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[2].Nodes[4].Checked; })); } if (res) { using ( RegistryKey regKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Microsoft Management Console\Recent File List\")) { foreach (string subKeyName in regKey.GetValueNames()) { if (subKeyName.ToLower() != "default") { regValuesToDelete.Add(@"Software\Microsoft\Microsoft Management Console\Recent File List\" + subKeyName); } } } } } catch { } //ms wordpad try { if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[2].Nodes[5].Checked; })); } if (res) { using ( RegistryKey regKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Applets\Wordpad\Recent File List\")) { foreach (string subKeyName in regKey.GetValueNames()) { if (subKeyName.ToLower() != "default") { regValuesToDelete.Add(@"Software\Microsoft\Windows\CurrentVersion\Applets\Wordpad\Recent File List\" + subKeyName); } } } } } catch { } //ms paint try { if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[2].Nodes[6].Checked; })); } if (res) { using ( RegistryKey regKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Applets\Paint\Recent File List\")) { foreach (string subKeyName in regKey.GetValueNames()) { if (subKeyName.ToLower() != "default") { regValuesToDelete.Add(@"Software\Microsoft\Windows\CurrentVersion\Applets\Paint\Recent File List\" + subKeyName); } } } } } catch { } //winrar try { if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[2].Nodes[7].Checked; })); } if (res) { using (RegistryKey regKey = Registry.CurrentUser.OpenSubKey(@"Software\WinRAR\ArcHistory\")) { foreach (string subKeyName in regKey.GetValueNames()) { if (subKeyName.ToLower() != "default") { regValuesToDelete.Add(@"Software\WinRAR\ArcHistory\" + subKeyName); } } } using (RegistryKey regKey = Registry.CurrentUser.OpenSubKey(@"Software\WinRAR\DialogEditHistory\ArcName\")) { foreach (string subKeyName in regKey.GetValueNames()) { if (subKeyName.ToLower() != "default") { regValuesToDelete.Add(@"Software\WinRAR\DialogEditHistory\ArcName\" + subKeyName); } } } } } catch { } //sun java try { if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[2].Nodes[8].Checked; })); } if (res) { DirectoryInfo javaDir = new DirectoryInfo(localData + "\\Sun\\Java\\Deployment\\cache"); MarkDirToDelete(javaDir); } } catch { } //windows defender try { if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[2].Nodes[9].Checked; })); } if (res) { DirectoryInfo officeDir = new DirectoryInfo(programData + "\\Microsoft\\Windows Defender\\Scans\\History\\Results\\Quick"); MarkDirToDelete(officeDir); } } catch { } } catch { } #endregion #region Mozilla Firefox try { string sMozillaHistory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); sMozillaHistory = sMozillaHistory + "\\Mozilla\\Firefox\\Profiles"; #region Mozilla Firefox History if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[3].Nodes[0].Checked; })); } else { res = trvTracks.Nodes[3].Nodes[0].Checked; } if (res) { if (Directory.Exists(sMozillaHistory)) { try { DirectoryInfo diInfoFirefoxHistory = new DirectoryInfo(sMozillaHistory); DirectoryInfo[] fileSysFirefoxHistory = diInfoFirefoxHistory.GetDirectories(); foreach (DirectoryInfo diNext in fileSysFirefoxHistory) { MarkFilesToDelete(diNext, "places.sqlite"); MarkFilesToDelete(diNext, "session"); MarkFilesToDelete(diNext, "history.dat"); } } catch { } } } #endregion #region Mozilla Firefox Cookies if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[3].Nodes[1].Checked; })); } else { res = trvTracks.Nodes[3].Nodes[1].Checked; } if (res) { if (Directory.Exists(sMozillaHistory)) { try { DirectoryInfo diInfoFirefoxCookies = new DirectoryInfo(sMozillaHistory); FileSystemInfo[] fileSysFirefoxCookies = diInfoFirefoxCookies.GetDirectories(); foreach (DirectoryInfo diNext in fileSysFirefoxCookies) { MarkFilesToDelete(diNext, "cookies.sqlite"); } } catch { } } } #endregion #region Mozilla Firefox Internet Cache if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[3].Nodes[2].Checked; })); } else { res = trvTracks.Nodes[3].Nodes[2].Checked; } if (res) { if (Directory.Exists(sMozillaHistory)) { try { DirectoryInfo diInfoFirefoxCookies = new DirectoryInfo(sMozillaHistory); FileSystemInfo[] fileSysFirefoxCookies = diInfoFirefoxCookies.GetDirectories(); foreach (DirectoryInfo diNext in fileSysFirefoxCookies) { DirectoryInfo cacheFolder1 = diNext.GetDirectories("OfflineCache").FirstOrDefault(); MarkFilesToDelete(cacheFolder1); DirectoryInfo cacheFolder2 = diNext.GetDirectories("Cache").FirstOrDefault(); MarkFilesToDelete(cacheFolder2); } } catch { } } } #endregion #region Mozilla Firefox Saved Form information if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[3].Nodes[3].Checked; })); } else { res = trvTracks.Nodes[3].Nodes[3].Checked; } if (res) { if (Directory.Exists(sMozillaHistory)) { try { DirectoryInfo diInfoFirefoxformHistory = new DirectoryInfo(sMozillaHistory); FileSystemInfo[] fileSysFirefoxformHistory = diInfoFirefoxformHistory.GetDirectories(); foreach (DirectoryInfo diNext in fileSysFirefoxformHistory) { MarkFilesToDelete(diNext, "formhistory.sqlite"); } } catch { } } } #endregion #region Mozilla Firefox Saved Passwords if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[3].Nodes[4].Checked; })); } else { res = trvTracks.Nodes[3].Nodes[4].Checked; } if (res) { if (Directory.Exists(sMozillaHistory)) { try { DirectoryInfo diInfoFirefoxformPwd = new DirectoryInfo(sMozillaHistory); FileSystemInfo[] fileSysFirefoxformPwd = diInfoFirefoxformPwd.GetDirectories(); foreach (DirectoryInfo diNext in fileSysFirefoxformPwd) { MarkFilesToDelete(diNext, "key3.db"); } } catch { } } } #endregion #region Mozilla Firefox Download Manager History if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[3].Nodes[5].Checked; })); } else { res = trvTracks.Nodes[3].Nodes[5].Checked; } if (res) { if (Directory.Exists(sMozillaHistory)) { try { DirectoryInfo diInfoFirefoxformDownload = new DirectoryInfo(sMozillaHistory); FileSystemInfo[] fileSysFirefoxformDownload = diInfoFirefoxformDownload.GetDirectories(); foreach (DirectoryInfo diNext in fileSysFirefoxformDownload) { MarkFilesToDelete(diNext, "downloads.sqlite"); } } catch { } } } #endregion #region Mozilla Firefox Search History if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[3].Nodes[6].Checked; })); } else { res = trvTracks.Nodes[3].Nodes[6].Checked; } if (res) { if (Directory.Exists(sMozillaHistory)) { try { var diInfoFirefoxformSearch = new DirectoryInfo(sMozillaHistory); FileSystemInfo[] fileSysFirefoxformSearch = diInfoFirefoxformSearch.GetDirectories(); foreach (DirectoryInfo diNext in fileSysFirefoxformSearch) { MarkFilesToDelete(diNext, "search.sqlite"); } } catch { } } } #endregion } catch { } #endregion #region Google Chrome try { string sGoogleChromePath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); sGoogleChromePath = sGoogleChromePath + "\\Google\\Chrome\\User Data"; #region Google Chrome History if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[4].Nodes[0].Checked; })); } if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res1 = trvTracks.Nodes[4].Nodes[4].Checked; })); } else { res = trvTracks.Nodes[4].Nodes[0].Checked; res1 = trvTracks.Nodes[4].Nodes[4].Checked; } if (res || res1) { if (Directory.Exists(sGoogleChromePath)) { try { DirectoryInfo diInfoChromeHistory = new DirectoryInfo(sGoogleChromePath); DirectoryInfo[] profileDirs = diInfoChromeHistory.GetDirectories(); foreach (DirectoryInfo dir in profileDirs) { MarkFilesToDelete(dir, "History"); MarkFilesToDelete(dir, "*Visited Links*"); MarkFilesToDelete(dir, "*Current Tabs*"); MarkFilesToDelete(dir, "*Top Sites"); MarkFilesToDelete(dir, "*Network Action Predictor"); } diInfoChromeHistory = new DirectoryInfo(sGoogleChromePath + @"\Default\JumpListIcons"); MarkDirToDelete(diInfoChromeHistory); diInfoChromeHistory = new DirectoryInfo(sGoogleChromePath + @"\Default\JumpListIconsOld"); MarkDirToDelete(diInfoChromeHistory); } catch { } } } #endregion #region Google Chrome Cookies if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[4].Nodes[1].Checked; })); } else { res = trvTracks.Nodes[4].Nodes[1].Checked; } if (res) { if (Directory.Exists(sGoogleChromePath)) { try { DirectoryInfo diInfoChromeHistory = new DirectoryInfo(sGoogleChromePath); DirectoryInfo[] profileDirs = diInfoChromeHistory.GetDirectories(); foreach (DirectoryInfo dir in profileDirs) { MarkFilesToDelete(dir, "*Cookies*"); } diInfoChromeHistory = new DirectoryInfo(sGoogleChromePath + "\\Default\\Local Storage"); MarkDirToDelete(diInfoChromeHistory); } catch { } } } #endregion #region Google Chrome internet Cache if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[4].Nodes[2].Checked; })); } else { res = trvTracks.Nodes[4].Nodes[2].Checked; } if (res) { try { var diInfoChromeHistory = new DirectoryInfo(sGoogleChromePath); DirectoryInfo[] profileDirs = diInfoChromeHistory.GetDirectories(); foreach (DirectoryInfo dir in profileDirs) { DirectoryInfo cache = dir.GetDirectories("Cache").FirstOrDefault(); MarkFilesToDelete(cache, "*"); } } catch { } } #endregion #region Google Chrome Saved Form Information if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[4].Nodes[3].Checked; })); } else { res = trvTracks.Nodes[4].Nodes[3].Checked; } if (res) { if (Directory.Exists(sGoogleChromePath)) { try { DirectoryInfo diInfoChromeHistory = new DirectoryInfo(sGoogleChromePath); DirectoryInfo[] profileDirs = diInfoChromeHistory.GetDirectories(); foreach (DirectoryInfo dir in profileDirs) { MarkFilesToDelete(dir, "*Web Data*"); } } catch { } } } #endregion #region Google Chrome Download History if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res = trvTracks.Nodes[4].Nodes[0].Checked; })); } if (trvTracks.InvokeRequired) { trvTracks.Invoke(new MethodInvoker(delegate { res1 = trvTracks.Nodes[4].Nodes[4].Checked; })); } else { res = trvTracks.Nodes[4].Nodes[0].Checked; res1 = trvTracks.Nodes[4].Nodes[4].Checked; } if (res || res1) { if (Directory.Exists(sGoogleChromePath)) { try { DirectoryInfo diInfoChromeHistory = new DirectoryInfo(sGoogleChromePath); DirectoryInfo[] profileDirs = diInfoChromeHistory.GetDirectories(); foreach (DirectoryInfo dir in profileDirs) { try { FileInfo[] fileSysChromeHistory = dir.GetFiles("*history*"); foreach (FileInfo diNext in fileSysChromeHistory) { if (!filesToDelete.Contains(diNext.FullName)) { filesToDelete.Add(diNext.FullName); } } } catch { } try { FileInfo[] fileSysChromeHistory = dir.GetFiles("*Visited Links*"); foreach (FileInfo diNext in fileSysChromeHistory) { if (!filesToDelete.Contains(diNext.FullName)) { filesToDelete.Add(diNext.FullName); } } } catch { } try { FileInfo[] fileSysChromeHistory = dir.GetFiles("*Current Tabs*"); foreach (FileInfo diNext in fileSysChromeHistory) { if (!filesToDelete.Contains(diNext.FullName)) { filesToDelete.Add(diNext.FullName); } } } catch { } } } catch { } } } #endregion } catch { } #endregion } catch (Exception) { // ToDo: send exception details via SmartAssembly bug reporting! } }