Advertisement
Guest User

Untitled

a guest
Jun 29th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Overloads Sub DeleteIEHistory(ByVal Enable As Boolean)
  2.         If Enable Then
  3.             Dim History As String = Environment.GetFolderPath(Environment.SpecialFolder.History)
  4.  
  5.             If System.IO.Directory.Exists(History) Then
  6.                 For Each historyFile As String In My.Computer.FileSystem.GetFiles(History)
  7.                     Try
  8.                         My.Computer.FileSystem.DeleteFile(historyFile)
  9.                     Catch
  10.                     End Try
  11.                 Next
  12.             End If
  13.         End If
  14.     End Sub
  15.  
  16.     Public Overloads Sub DeleteIECookies(ByVal Enable As Boolean)
  17.         If Enable Then
  18.             Dim Cookies As String = Environment.GetFolderPath(Environment.SpecialFolder.Cookies)
  19.  
  20.             If System.IO.Directory.Exists(Cookies) Then
  21.                 For Each cookiesFile As String In My.Computer.FileSystem.GetFiles(Cookies)
  22.                     Try
  23.                         My.Computer.FileSystem.DeleteFile(cookiesFile)
  24.                     Catch
  25.                     End Try
  26.                 Next
  27.             End If
  28.         End If
  29.     End Sub
  30.  
  31.     Public Overloads Sub DeleteIECache(ByVal Enable As Boolean)
  32.         If Enable Then
  33.             Dim Cache As String = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache)
  34.  
  35.             If System.IO.Directory.Exists(Cache & "\Content.IE5") Then
  36.                 For Each cacheFile As String In My.Computer.FileSystem.GetFiles(Cache & "\Content.IE5")
  37.                     Try
  38.                         My.Computer.FileSystem.DeleteFile(cacheFile)
  39.                     Catch
  40.                     End Try
  41.                 Next
  42.             End If
  43.  
  44.             For Each cacheFolder As String In My.Computer.FileSystem.GetDirectories(Cache)
  45.                 Try
  46.                     My.Computer.FileSystem.DeleteDirectory(cacheFolder, FileIO.DeleteDirectoryOption.DeleteAllContents)
  47.                 Catch
  48.                 End Try
  49.             Next
  50.         End If
  51.     End Sub
  52.  
  53.     Public Overloads Sub DeleteWinRecent(ByVal Enable As Boolean)
  54.         If Enable Then
  55.             Dim Recent As String = Environment.GetFolderPath(Environment.SpecialFolder.Recent)
  56.  
  57.             For Each recentFile As String In My.Computer.FileSystem.GetFiles(Recent)
  58.                 Try
  59.                     My.Computer.FileSystem.DeleteFile(recentFile)
  60.                 Catch
  61.                 End Try
  62.             Next
  63.         End If
  64.     End Sub
  65.  
  66.     Public Overloads Sub DeleteWinTemp(ByVal Enable As Boolean)
  67.         If Enable Then
  68.             Dim LocalSettings As String = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache).Remove(Environment.GetFolderPath(Environment.SpecialFolder.InternetCache).LastIndexOf("\")) ' & "\Temp"
  69.  
  70.             If System.IO.Directory.Exists(LocalSettings) Then
  71.                 For Each lsFolder As String In My.Computer.FileSystem.GetDirectories(LocalSettings)
  72.                     If Not lsFolder.Substring(lsFolder.LastIndexOf("\") + 1).StartsWith("App") Then
  73.                         For Each lsFile As String In My.Computer.FileSystem.GetFiles(lsFolder)
  74.                             Try
  75.                                 My.Computer.FileSystem.DeleteFile(lsFile)
  76.                             Catch
  77.                             End Try
  78.                         Next
  79.                         For Each lsFolder2 As String In My.Computer.FileSystem.GetDirectories(lsFolder)
  80.                             Try
  81.                                 My.Computer.FileSystem.DeleteDirectory(lsFolder2, FileIO.DeleteDirectoryOption.DeleteAllContents)
  82.                             Catch
  83.                             End Try
  84.                         Next
  85.                         Try
  86.                             My.Computer.FileSystem.DeleteDirectory(lsFolder, FileIO.DeleteDirectoryOption.DeleteAllContents)
  87.                         Catch
  88.                         End Try
  89.                     End If
  90.                 Next
  91.             End If
  92.         End If
  93.     End Sub
  94.  
  95.     Public Overloads Sub DeleteWinIcoCache(ByVal Enable As Boolean)
  96.         If Enable Then
  97.             Dim IconCache As String = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
  98.  
  99.             Try
  100.                 My.Computer.FileSystem.DeleteFile(IconCache & "\IconCache.dll")
  101.             Catch
  102.             End Try
  103.         End If
  104.     End Sub
  105.     Private Overloads Sub DeleteWinRecycleBin(ByVal Enable As Boolean)
  106.         If Enable Then
  107.             Const SHERB_NOCONFIRMATION As Integer = &H1
  108.             Const SHERB_NOPROGRESSUI As Integer = &H2
  109.             Const SHERB_NOSOUND As Integer = &H4
  110.             SHEmptyRecycleBin(Me.Handle.ToInt32, vbNullString, SHERB_NOCONFIRMATION + SHERB_NOPROGRESSUI + SHERB_NOSOUND)
  111.             SHUpdateRecycleBinIcon()
  112.         End If
  113.     End Sub
  114.  
  115.     Public Overloads Sub DeleteMozillaCookies(ByVal Enable As Boolean)
  116.         If Enable Then
  117.             Dim MozillaCookies As String = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Mozilla\Firefox\Profiles"
  118.  
  119.             If System.IO.Directory.Exists(MozillaCookies) Then
  120.                 For Each mozillaCookiesProfiles As String In My.Computer.FileSystem.GetDirectories(MozillaCookies)
  121.                     For Each mozillaCookiesFile As String In My.Computer.FileSystem.GetFiles(mozillaCookiesProfiles)
  122.                         If mozillaCookiesFile.Contains("cookie") Then
  123.                             Try
  124.                                 My.Computer.FileSystem.DeleteFile(mozillaCookiesFile)
  125.                             Catch
  126.                             End Try
  127.                         End If
  128.                     Next
  129.                 Next
  130.             End If
  131.         End If
  132.     End Sub
  133.  
  134.     Public Overloads Sub DeleteMozillaCache(ByVal Enable As Boolean)
  135.         If Enable Then
  136.             Dim MozillaCache As String = My.Computer.FileSystem.SpecialDirectories.Temp.Remove(My.Computer.FileSystem.SpecialDirectories.Temp.LastIndexOf("\"))
  137.  
  138.             If System.IO.Directory.Exists(MozillaCache) Then
  139.                 For Each mozillaCacheProfile As String In My.Computer.FileSystem.GetDirectories(MozillaCache)
  140.                     For Each mozillaCacheFile As String In My.Computer.FileSystem.GetFiles(mozillaCacheProfile)
  141.                         Try
  142.                             My.Computer.FileSystem.DeleteFile(mozillaCacheFile)
  143.                         Catch
  144.                         End Try
  145.                     Next
  146.                 Next
  147.             End If
  148.         End If
  149.     End Sub
  150.  
  151.     Public Overloads Sub DeleteMozillaSignons(ByVal Enable As Boolean)
  152.         If Enable Then
  153.             Dim MozillaCookies As String = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Mozilla\Firefox\Profiles"
  154.  
  155.             If System.IO.Directory.Exists(MozillaCookies) Then
  156.                 For Each mozillaCookiesProfiles As String In My.Computer.FileSystem.GetDirectories(MozillaCookies)
  157.                     For Each mozillaCookiesFile As String In My.Computer.FileSystem.GetFiles(mozillaCookiesProfiles)
  158.                         If mozillaCookiesFile.Contains("signon") Then
  159.                             Try
  160.                                 My.Computer.FileSystem.DeleteFile(mozillaCookiesFile)
  161.                             Catch
  162.                             End Try
  163.                         End If
  164.                     Next
  165.                 Next
  166.             End If
  167.         End If
  168.     End Sub
  169.  
  170.     Public Overloads Sub DeleteWoWCache(ByVal Enable As Boolean)
  171.         If Enable Then
  172.             Dim WoWCache1 As String = My.Computer.FileSystem.SpecialDirectories.Desktop.Remove(3) & "Program Files\World of Warcraft\Cache\WDB"
  173.             Dim WoWCache2 As String = My.Computer.FileSystem.SpecialDirectories.Desktop.Remove(3) & "Program Files\World of Warcraft\WTF"
  174.  
  175.             If System.IO.Directory.Exists(WoWCache1) Then
  176.                 For Each wowFile1 As String In My.Computer.FileSystem.GetFiles(WoWCache1)
  177.                     Try
  178.                         My.Computer.FileSystem.DeleteFile(wowFile1)
  179.                     Catch
  180.                     End Try
  181.                 Next
  182.             End If
  183.  
  184.             If System.IO.Directory.Exists(WoWCache2) Then
  185.                 For Each wowFile2 As String In My.Computer.FileSystem.GetFiles(WoWCache2)
  186.                     Try
  187.                         My.Computer.FileSystem.DeleteFile(wowFile2)
  188.                     Catch
  189.                     End Try
  190.                 Next
  191.             End If
  192.         End If
  193.     End Su
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement