DesktopHelper.UI.ClearSystemGarbageForm.ClearTemp C# (CSharp) Метод

ClearTemp() приватный Метод

private ClearTemp ( ) : void
Результат void
        private void ClearTemp()
        {
            try
            {
                string cookices = Environment.GetFolderPath(Environment.SpecialFolder.Cookies);
                string history = Environment.GetFolderPath(Environment.SpecialFolder.History);
                string recent = Environment.GetFolderPath(Environment.SpecialFolder.Recent);
                string internetCach = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache);
                string userName = Environment.UserName;
                string temp = @"c:\documents and settings\" + userName + @"\local settings\temp";
                string windows = Environment.GetEnvironmentVariable("WinDir");
                string windowsTemp = Environment.GetEnvironmentVariable("TEMP");
                string[] all ={history ,recent ,internetCach ,temp,windows + "\\Temp",windowsTemp,
                windows+ "\\servicepackfiles",windows+"\\driver cache\\i386",windows+"\\softwaredistribution\\download",
                windows+"\\help"};
                foreach (string d in all)
                {
                    if (Directory.Exists(d))
                    {
                        foreach (string file in Directory.GetFiles(d, "*.*"))
                        {
                            DeleteFile(file);
                        }
                    }
                }
                foreach (string file in Directory.GetFiles(cookices, "*.txt"))
                {
                    DeleteFile(file);
                }
                SetControlText(labelDetail, "清理完成!");
            }
            catch
            {
            }
        }