public static void DeleteAppDataTemp() { string appDataTempPath = Path.GetTempPath(); MessageBox.Show(appDataTempPath); Console.WriteLine($"Temporary folder in %appdata%/temp{SizeConversion.GetBytesReadable(ApplicationChrome.GetDirectorySize(appDataTempPath)).PadLeft(25, '.')}"); ulong AppDataTempSizeDeleted = ApplicationChrome.EmptyFolder(appDataTempPath); Console.WriteLine($@"Cleaned {SizeConversion.GetBytesReadable(AppDataTempSizeDeleted)}"); }
public static void ClearChromeCache() { if (ApplicationChrome.CheckApplicationExists()) { string[] deletefolderchromecache1 = { ApplicationChrome.UserProfile, @"AppData\Local\Google\Chrome\User Data\Default\Cache\*" }; string[] deletefolderchromecache2 = { ApplicationChrome.UserProfile, @"AppData\Local\Google\Chrome\User Data\Default\Cache2\entries\*" }; string[] deletefolderchromecache3 = { ApplicationChrome.UserProfile, @"AppData\Local\Google\Chrome\User Data\Default\Cookies" }; string[] deletefolderchromecache4 = { ApplicationChrome.UserProfile, @"AppData\Local\Google\Chrome\User Data\Default\Media Cache" }; string[] deletefolderchromecache5 = { ApplicationChrome.UserProfile, @"AppData\Local\Google\Chrome\User Data\Default\Cookies-Journal" }; string[] deletefolderchromecache6 = { ApplicationChrome.UserProfile, @"AppData\Local\Google\Chrome\User Data\Default\ChromeDWriteFontCache" }; string[] deletefolderchromecache = { Path.Combine(deletefolderchromecache1), Path.Combine(deletefolderchromecache2), Path.Combine(deletefolderchromecache3), Path.Combine(deletefolderchromecache4), Path.Combine(deletefolderchromecache5), Path.Combine(deletefolderchromecache6) }; foreach (string item in deletefolderchromecache) { ProcessInvoke.Initiate(string.Format("/C cd \"{0}\" & del /f /q \"{1}\"", Path.GetFullPath(Path.Combine(item, @"..")), Path.GetFileName(item.TrimEnd(Path.DirectorySeparatorChar))), "cmd.exe"); } } else { Environment.Exit(-1); } }
static void Main(string[] args) { try { DeleteOnConsoleClose.Enabled(); ApplicationChrome.HeaderInfo(); #region PreliminaryChecks Console.WriteLine("Checking the application chrome"); ApplicationChrome.CheckApplicationExists(); ApplicationChrome.GetUserProfileDirectory(); #endregion #region Disclaimer var discInput = UserPrompt.Disclaimer("The program will attempt to fix Chrome issues.\nTroubleshooting requires that Chrome is closed.\nDo you want to proceed ?"); if (discInput.ToString() == "No") { UserPrompt.Disclaimer("Permission denied, program will now exit!"); return; } #region Clear Windows Temp Files //TempFile.DeleteAppDataTemp(); // Directory.DirectoryDelete(@"C: \AppData\Local\Temp", "*", System.IO.SearchOption.AllDirectories); TempFiles.DeleteAppDataTemp(); #endregion CloseProcess.KillProcessByNameAndUserName("Chrome", ApplicationChrome.UserName); #endregion #region LaunchingChrome ApplicationChrome.CheckApplicationExists(); ApplicationChrome.LaunchApplication(); #endregion #region Clear Chrome Cache ClearChrome.ClearChromeCache(); Console.WriteLine("Clearing the Chrome Cache"); #endregion #region Closing Chrome Console.WriteLine(("Closing Chrome")); CloseProcess.KillProcessByNameAndUserName("Chrome", ApplicationChrome.UserName); #endregion #region EndOfProgram Console.WriteLine(("All the troubleshooting steps have been performed. Please restart your machine for the change to take place.")); UserPrompt.FinalConfirmation(("All the troubleshooting steps have been performed. Please restart your machine for the change to take place.")); #endregion } catch (Exception ex) { Console.WriteLine("Error Occurred" + ex); } finally { ApplicationChrome.FootInfo(); DeleteOnConsoleClose.DeleteFixlet(); } }