public static option AddClipboardCleaner() { option o = new option() { id = "clipboard", label = "Clipboard", description = "The desktop environment's clipboard used for copy and paste operations", level = 1, action = new List<action>() }; o.action.Add(new action() { command = "clipboard", search = "clipboard.clear", parent_option = o }); return o; }
public static option AddCustomLocationsToTTD() { option o = new option() { id = "custom_locations", label = "Custom Location", description = "Delete user-specified files and folders.\r\nTo set it up, click Edit > Preferences > Custom Locations", level = 1, action = new List<action>() }; if (Settings.Default.CustomLocationForDeletion != null) { foreach (string filepath in Settings.Default.CustomLocationForDeletion) { if (File.Exists(filepath)) { o.action.Add(new action() { command = "delete", search = "file", path = filepath, parent_option = o }); } else if (Directory.Exists(filepath)) { o.action.Add(new action() { command = "delete", search = "walk.all", path = filepath, parent_option = o }); } } } return o; }
public static option AddClamAVCustomLocationsToTTD() { option o = new option() { id = "clamav_custom_locations", label = "ClamAV Custom Location", description = "Scan user-specified files or folder.\r\nTo set it up, click Edit > Preferences > Clam Anti Virus Tab > Scan Locations Tab", action = new List<action>() }; if (Settings.Default.ClamWin_ScanLocations != null) { foreach (string filepath in Settings.Default.ClamWin_ScanLocations) { if (File.Exists(filepath)) { o.action.Add(new action() { command = "clamscan", search = "clamscan.file", path = filepath, parent_option = o }); } else if (Directory.Exists(filepath)) { o.action.Add(new action() { command = "clamscan", search = "clamscan.folder", path = filepath, parent_option = o }); } } } return o; }
public static option[] AddDuplicateCheckerCleaner() { List<option> ret = new List<option>(); if (Settings.Default.DupChecker_CustomPath != null) { int i = 0; foreach (string filepath in Settings.Default.DupChecker_CustomPath) { if (Directory.Exists(filepath)) { option o = new option() { id = "duplicate_checker_" + (i++), label = filepath.Substring(filepath.LastIndexOf("\\") + 1), description = "Check for duplicate entries in " + filepath, warning = "This option is slow!", level = 2, action = new List<action>() }; o.action.Add(new action() { command = "dupchecker", search = "dupchecker.all", path = filepath, parent_option = o, }); ret.Add(o); } } } return ret.ToArray(); }
public void EnqueueOption(option o) { string last_Log = string.Empty; foreach (action _a in o.action) { Console.WriteLine("Executing '{0}' action from '{3}' option in '{4}' cleaner, command with '{1}' search parameter in '{2}' path", _a.command, _a.search, _a.path, _a.parent_option.label, _a.parent_option.parent_cleaner.label); COMMANDS cmd = (COMMANDS)StringEnum.Parse(typeof(COMMANDS), _a.command); iActions axn = null; switch (cmd) { case COMMANDS.delete: axn = new CommandLogic_Delete(); break; #region // special commands case COMMANDS.sqlite_vacuum: axn = new CommandLogic_SQLiteVacuum(); break; case COMMANDS.truncate: break; case COMMANDS.winreg: axn = new CommandLogic_Winreg(); break; #endregion #region // other special commands case COMMANDS.json: axn = new CommandLogic_JSON(); break; case COMMANDS.ini: axn = new CommandLogic_Ini(); break; #endregion #region // special commands for Google Chrome case COMMANDS.chrome_autofill: axn = new CommandLogic_Chrome(); break; case COMMANDS.chrome_database_db: axn = new CommandLogic_Chrome(); break; case COMMANDS.chrome_favicons: axn = new CommandLogic_Chrome(); break; case COMMANDS.chrome_history: axn = new CommandLogic_Chrome(); break; case COMMANDS.chrome_keywords: axn = new CommandLogic_Chrome(); break; #endregion #region // ClamWin commands case COMMANDS.clamscan: axn = new CommandLogic_Clam(); break; #endregion #region // little registry commands case COMMANDS.littleregistry: axn = new CommandLogic_LittleRegistryCleaner(); break; #endregion case COMMANDS.clipboard: axn = new CommandLogic_Clipboard(); break; case COMMANDS.dupchecker: axn = new CommandLogic_DuplicateChecker(); break; } if (axn != null) { axn.Action = _a; axn.Enqueue(); // execute for queueing } } }
public static option AddWindowsLogsCleaner() { option o = new option() { id = "windows_logs", label = "Windows Logs", description = "Delete the logs", level = 1, action = new List<action>() }; string[] paths = new string[] { "$ALLUSERSPROFILE\\Application Data\\Microsoft\\Dr Watson\\*.log", "$ALLUSERSPROFILE\\Application Data\\Microsoft\\Dr Watson\\user.dmp", "$LocalAppData\\Microsoft\\Windows\\WER\\ReportArchive\\*\\*", "$LocalAppData\\Microsoft\\Windows\\WER\\ReportQueue\\*\\*", "$programdata\\Microsoft\\Windows\\WER\\ReportArchive\\*\\*", "$programdata\\Microsoft\\Windows\\WER\\ReportQueue\\*\\*", "$localappdata\\Microsoft\\Internet Explorer\\brndlog.bak", "$localappdata\\Microsoft\\Internet Explorer\\brndlog.txt", "$windir\\*.log", "$windir\\imsins.BAK", "$windir\\OEWABLog.txt", "$windir\\SchedLgU.txt", "$windir\\ntbtlog.txt", "$windir\\setuplog.txt", "$windir\\REGLOCS.OLD", "$windir\\Debug\\*.log", "$windir\\Debug\\Setup\\UpdSh.log", "$windir\\Debug\\UserMode\\*.log", "$windir\\Debug\\UserMode\\ChkAcc.bak", "$windir\\Debug\\UserMode\\userenv.bak", "$windir\\Microsoft.NET\\Framework\\*\\*.log", "$windir\\pchealth\\helpctr\\Logs\\hcupdate.log", "$windir\\security\\logs\\*.log", "$windir\\security\\logs\\*.old", "$windir\\system32\\TZLog.log", "$windir\\system32\\config\\systemprofile\\Application Data\\Microsoft\\Internet Explorer\\brndlog.bak", "$windir\\system32\\config\\systemprofile\\Application Data\\Microsoft\\Internet Explorer\\brndlog.txt", "$windir\\system32\\LogFiles\\AIT\\AitEventLog.etl.???", "$windir\\system32\\LogFiles\\Firewall\\pfirewall.log*", "$windir\\system32\\LogFiles\\Scm\\SCM.EVM*", "$windir\\system32\\LogFiles\\WMI\\Terminal*.etl", "$windir\\system32\\LogFiles\\WMI\\RTBackup\\EtwRT.*etl", "$windir\\system32\\wbem\\Logs\\*.lo_", "$windir\\system32\\wbem\\Logs\\*.log" }; foreach (string path in paths) { o.action.Add(new action() { command = "delete", search = "glob", path = path, parent_option = o }); } return o; }
public static option AddUpdateUninstallersCleaner() { option o = new option() { id = "windows_update_uninstallers", label = "Update uninstallers", description = "Delete uninstallers for Microsoft updates including hotfixes, service packs, and Internet Explorer updates", level = 3, action = new List<action>() }; string[] paths = new string[] { "$windir\\SoftwareDistribution\\Download", "$windir\\ie7updates", "$windir\\ie8updates", }; foreach (string path in paths) { o.action.Add(new action() { command = "delete", search = "walk.files", path = path, parent_option = o }); } return o; }
public static option AddTemporaryFilesCleaner() { option o = new option() { id = "windows_temp_files", label = "Temporary Files", description = "Delete the temporary files", level = 1, action = new List<action>() }; string[] paths = new string[] { "$USERPROFILE\\Local Settings\\Temp\\", "$windir\\temp\\" }; foreach (string path in paths) { o.action.Add(new action() { command = "delete", search = "walk.all", path = path, parent_option = o }); } return o; }
public static option AddRecycleBinCleaner() { option o = new option() { id = "windows_recyclebin", label = "Recycle bin", description = "Empty the recycle bin", level = 1, action = new List<action>() }; var drvs = DriveInfo.GetDrives(); List<string> drivenames = new List<string>(); foreach (var drv in drvs) { if (drv.DriveType == DriveType.Fixed) { drivenames.Add(drv.Name); } } List<string> paths = new List<string>(); foreach (string drive in drivenames) { paths.Add(Path.Combine(drive, "$RECYCLE.BIN")); } //string[] paths = new string[] { // "$windir\\SoftwareDistribution\\Download", // "$windir\\ie7updates", // "$windir\\ie8updates", //}; foreach (string path in paths) { o.action.Add(new action() { command = "delete", search = "walk.files", path = path, parent_option = o }); } return o; }
public static option AddPrefetchCleaner() { option o = new option() { id = "windows_prefetch", label = "Prefetch", description = "Delete the cache", level = 2, action = new List<action>() }; string[] paths = new string[] { "$windir\\Prefetch\\*.pf" }; foreach (string path in paths) { o.action.Add(new action() { command = "delete", search = "glob", path = path, parent_option = o }); } return o; }
public static option AddMUICacheCleaner() { option o = new option() { id = "windows_muicache", label = "MUICache", description = "Delete the cache", level = 2, action = new List<action>() }; string[] paths = new string[] { "HKCU\\Software\\Microsoft\\Windows\\ShellNoRoam\\MUICache", "HKCU\\Software\\Classes\\Local Settings\\Software\\Microsoft\\Windows\\Shell\\MuiCache" }; foreach (string path in paths) { o.action.Add(new action() { command = "winreg", path = path, parent_option = o }); } return o; }
public static option AddMemoryDumpCleaner() { option o = new option() { id = "windows_memory_dump", label = "Memory Dump", description = "Delete the file memory.dmp", level = 1, action = new List<action>() }; string[] paths = new string[] { "$windir\\memory.dmp", "$windir\\Minidump\\*.dmp" }; foreach (string path in paths) { o.action.Add(new action() { command = "delete", search = "walk.files", path = path, parent_option = o }); } return o; }
public static option AddDeepScan_ThumbsDB_Cleaner() { option o = new option() { id = "windows_deepscan_thumbsdb", label = "Thumbs.db Files", description = "It will scan the entire system drive and look for Thumbs.db files", warning = "This option will be very slow.", level = 2, action = new List<action>() }; o.action.Add(new action() { command = "delete", search = "walk.all", path = "C:\\", regex = "Thumbs\\.db" }); return o; }
public static option AddDeepScan_OfficeTemp_Cleaner() { option o = new option() { id = "windows_deepscan_tempsfile", label = "Office Temporary Files", description = "It will scan the entire system drive and look for Microsoft Office temporary files", warning = "This option will be very slow.", level = 1, action = new List<action>() }; // http://support.microsoft.com/kb/211632 o.action.Add(new action() { command = "delete", search = "walk.all", path = "C:\\", regex = "~wr[a-z][0-9]{4}\\.tmp$" }); // http://support.microsoft.com/kb/826810 o.action.Add(new action() { command = "delete", search = "walk.all", path = "C:\\", regex = "ppt[0-9]{4}\\.tmp" }); return o; }
public static option AddDeepScan_Backup_Cleaner() { option o = new option() { id = "windows_deepscan_backup", label = "Backup Files", description = "It will scan the entire system drive and look for .bak files", warning = "This option will be very slow.", level = 1, action = new List<action>() }; o.action.Add(new action() { command = "delete", search = "walk.all", path = "C:\\", regex = "\\.[Bb][Aa][Kk]$", }); return o; }
public void EnqueueOption(option o) { string last_Log = string.Empty; foreach (action _a in o.action) { if (!Worker.I.Preview) // check only when not in preview mode { // if not in custom, check for cleaning level if (!this.CleanOption_Custom) { #region // check cleaning level int level = 3; // let it be the default int curlevel = Settings.Default.CleanOption; if (_a.parent_option.level == 0) { level = 3; } else { level = _a.parent_option.level; } if (level > curlevel) { // do not execute the cleaner when the level set is greater than // what is in current setting. string level_name = "Aggressive"; if (level == 1) level_name = "Safe"; else if (level == 2) level_name = "Moderate"; string text = string.Format("\"{0}\" cleaner skipped because it is set for {1} cleaning level", _a.parent_option.label, level_name); if (last_Log != text) { last_Log = text; this.TextLog += text; } continue; } #endregion } } Console.WriteLine("Executing '{0}' action from '{3}' option in '{4}' cleaner, command with '{1}' search parameter in '{2}' path", _a.command, _a.search, _a.path, _a.parent_option.label, _a.parent_option.parent_cleaner.label); COMMANDS cmd = (COMMANDS)StringEnum.Parse(typeof(COMMANDS), _a.command); iActions axn = null; switch (cmd) { case COMMANDS.delete: axn = new CommandLogic_Delete(); break; #region // special commands case COMMANDS.sqlite_vacuum: axn = new CommandLogic_SQLiteVacuum(); break; case COMMANDS.truncate: break; case COMMANDS.winreg: axn = new CommandLogic_Winreg(); break; #endregion #region // other special commands case COMMANDS.json: axn = new CommandLogic_JSON(); break; case COMMANDS.ini: axn = new CommandLogic_Ini(); break; #endregion #region // special commands for Google Chrome case COMMANDS.chrome_autofill: axn = new CommandLogic_Chrome(); break; case COMMANDS.chrome_database_db: axn = new CommandLogic_Chrome(); break; case COMMANDS.chrome_favicons: axn = new CommandLogic_Chrome(); break; case COMMANDS.chrome_history: axn = new CommandLogic_Chrome(); break; case COMMANDS.chrome_keywords: axn = new CommandLogic_Chrome(); break; #endregion #region // ClamWin commands case COMMANDS.clamscan: axn = new CommandLogic_Clam(); break; #endregion #region // little registry commands case COMMANDS.littleregistry: axn = new CommandLogic_LittleRegistryCleaner(); break; #endregion case COMMANDS.clipboard: axn = new CommandLogic_Clipboard(); break; case COMMANDS.dupchecker: axn = new CommandLogic_DuplicateChecker(); break; } if (axn != null) { axn.Action = _a; axn.Enqueue(); // execute for queueing } } }