-
Notifications
You must be signed in to change notification settings - Fork 1
/
Start.vb
289 lines (273 loc) · 14.8 KB
/
Start.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
Public Class Start
Dim frmMain As New Main
Dim frmCW
Dim item As Object
Public SessionStarted As Boolean = False
'OS Detection
Public OS_Number As String = Environment.OSVersion.Version.Major
Private Sub Start_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
On Error GoTo ErrorHandler
Load_Main()
frmCW = New CleanerWindow
Exit Sub
ErrorHandler:
If Err.Number = 5 Then
MsgBox("You may be running the program from a network drive. Please copy the file to a local drive and try again.", MsgBoxStyle.Exclamation, "Error 5")
Else
MsgBox(Err.Description, MsgBoxStyle.Exclamation, "Error " & Err.Number)
End If
Me.BeginInvoke(New MethodInvoker(AddressOf ForceClose))
End Sub
Public Sub ForceClose()
Me.Close()
End Sub
Private Sub Start_FormClosing(ByVal eventsender As System.Object, ByVal eventargs As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
If frmCW.cmdCancel.Visible = True Then
frmCW.Close()
eventargs.Cancel = True
Else
'Deletes files made by the cleanup
On Error Resume Next
My.Computer.FileSystem.DeleteFile(Environ("appdata") & "\DriveTidy\cleaner.bat")
My.Computer.FileSystem.DeleteFile(Environ("appdata") & "\DriveTidy\start.bat")
My.Computer.FileSystem.DeleteFile(Environ("appdata") & "\DriveTidy\log.txt")
My.Computer.FileSystem.DeleteFile(Environ("appdata") & "\DriveTidy\cleanchk.txt")
My.Computer.FileSystem.DeleteDirectory(Environ("appdata") & "\DriveTidy\", FileIO.DeleteDirectoryOption.DeleteAllContents)
End If
End Sub
Public Sub Load_Main()
If frmMain.Visible = False Then
frmMain = New Main
End If
frmMain.TopLevel = False
frmMain.Visible = True
Me.Controls.Add(frmMain)
End Sub
Public Sub Load_CW()
If frmCW.Visible = False Then
frmCW = New CleanerWindow
End If
frmCW.TopLevel = False
frmCW.Visible = True
Me.Controls.Add(frmCW)
End Sub
Public Sub Definitions()
If Not My.User.IsInRole(ApplicationServices.BuiltInRole.Administrator) Then
frmMain.cbWindowsUpdate.Enabled = False
frmMain.cbHibernate.Enabled = False
frmMain.cbThumbnails.Enabled = False
frmMain.cbVistaSP1.Enabled = False
frmMain.cbVistaSP2.Enabled = False
frmMain.cbWin7SP1.Enabled = False
frmMain.cbSteam.Enabled = False
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("allusersappdata") & "\Microsoft\Windows\WER\ReportArchive") Then
If Not My.Computer.FileSystem.DirectoryExists(Environ("allusersappdata") & "\Microsoft\Windows\WER\ReportQueue") Then
If Not My.Computer.FileSystem.DirectoryExists(Environ("localappdata") & "\Microsoft\Windows\WER\ReportArchive") Then
If Not My.Computer.FileSystem.DirectoryExists(Environ("localappdata") & "\Microsoft\Windows\WER\ReportQueue") Then
frmMain.cbErrorReports.Visible = False
End If
End If
End If
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("localappdata") & "\Mozilla\Firefox") Then
frmMain.cbFirefox.Visible = False
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("localappdata") & "\Google\Chrome") Then
frmMain.cbChrome.Visible = False
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("localappdata") & "\Opera") Then
If Not My.Computer.FileSystem.DirectoryExists(Environ("appdata") & "\Opera") Then
frmMain.cbOpera.Visible = False
End If
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("appdata") & "\Sun\Java\Deployment\cache") Then
If Not My.Computer.FileSystem.DirectoryExists(Environ("localappdata") & "\Sun\Java\Deployment\cache") Then
If Not My.Computer.FileSystem.DirectoryExists(Environ("locallowappdata") & "\Sun\Java\Deployment\cache") Then
frmMain.cbJava.Visible = False
End If
End If
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("localappdata") & "\Apple Computer\Safari") Then
If Not My.Computer.FileSystem.DirectoryExists(Environ("appdata") & "\Apple Computer\Safari") Then
frmMain.cbSafari.Visible = False
End If
End If
If Not My.Computer.FileSystem.FileExists(Environ("windir") & "\system32\vsp1cln.exe") Then
frmMain.cbVistaSP1.Visible = False
End If
If Not My.Computer.FileSystem.FileExists(Environ("windir") & "\system32\compcln.exe") Then
frmMain.cbVistaSP2.Visible = False
End If
If OS_Number = 7 Then
If Not Environment.OSVersion.ServicePack = "Service Pack 1" Then
frmMain.cbWin7SP1.Visible = False
End If
Else
frmMain.cbWin7SP1.Visible = False
End If
If Not My.Computer.FileSystem.FileExists(Environ("systemdrive") & "\hiberfil.sys") Then
frmMain.cbHibernate.Visible = False
End If
If OS_Number = 6 Then
If Not My.Computer.FileSystem.FileExists(Environ("localappdata") & "\Microsoft\Windows\Explorerthumbcache_idx.db") Then
frmMain.cbThumbnails.Visible = False
End If
ElseIf OS_Number > 6 Then
If Not My.Computer.FileSystem.FileExists(Environ("localappdata") & "\IconCache.db") Then
frmMain.cbThumbnails.Visible = False
End If
End If
If OS_Number < 8 Then
frmMain.cbWinSxS.Visible = False
frmMain.cbWinSPClean.Visible = False
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("localappdata") & "\Microsoft\WebSetup") Then
frmMain.cbWinWebSetup.Visible = False
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("systemdrive") & "\Config.Msi") Then
If Not My.Computer.FileSystem.DirectoryExists(Environ("programfiles") & "\MSECache") Then
frmMain.cbMSI.Visible = False
End If
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("systemdrive") & "\Users\Public\Music\Sample Music") Then
If Not My.Computer.FileSystem.DirectoryExists(Environ("systemdrive") & "\Documents and Settings\All Users\Documents\My Music\Sample Music") Then
frmMain.cbSampleMusic.Visible = False
End If
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("systemdrive") & "\Users\Public\Pictures\Sample Pictures") Then
If Not My.Computer.FileSystem.DirectoryExists(Environ("systemdrive") & "\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures") Then
frmMain.cbSamplePictures.Visible = False
End If
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("systemdrive") & "\Users\Public\Videos\Sample Videos") Then
If Not My.Computer.FileSystem.DirectoryExists(Environ("systemdrive") & "\Users\Public\Recorded TV\Sample Media") Then
frmMain.cbSampleVideos.Visible = False
End If
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("appdata") & "\Ableton\Cache") Then
frmMain.cbAbletonLive.Visible = False
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("appdata") & "\Adobe\CameraRaw\Cache") Then
frmMain.cbAdobeCameraRAW.Visible = False
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("appdata") & "\Adobe\Common\Media Cache") Then
frmMain.cbAdobeMedia.Visible = False
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("localappdata") & "\Adobe\Acrobat") Then
frmMain.cbAdobeReader.Visible = False
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("allusersappdata") & "\Apple\Installer Cache") Then
If Not My.Computer.FileSystem.DirectoryExists(Environ("allusersappdata") & "\Apple Computer\Installer Cache") Then
frmMain.cbAppleInstaller.Visible = False
End If
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("systemdrive") & "\Autodesk") Then
frmMain.cbAutoDesk.Visible = False
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("programfiles") & "\AVG") Then
If Not My.Computer.FileSystem.DirectoryExists(Environ("programfiles(x86)") & "\AVG") Then
frmMain.cbAVG.Visible = False
End If
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("localappdata") & "\Blizzard Entertainment\Battle.Net\Cache") Then
If Not My.Computer.FileSystem.DirectoryExists(Environ("allusersprofile") & "\Blizzard Entertainment\Battle.Net\Cache") Then
frmMain.cbBattleNet.Visible = False
End If
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("systemdrive") & "\BigFishGamesCache") Then
frmMain.cbBigFishGames.Visible = False
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("localappdata") & "\CCP\EVE") Then
frmMain.cbEVEcache.Visible = False
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("documents") & "\EVE\Logs") Then
frmMain.cbEVElogs.Visible = False
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("userprofile") & "\.thumbnails\normal") Then
frmMain.cbGIMP.Visible = False
End If
If Not My.Computer.FileSystem.FileExists(Environ("localappdata") & "\Google\GoogleEarth\dbCache.dat") Then
If Not My.Computer.FileSystem.FileExists(Environ("localappdata") & "\Google\GoogleEarth\dbCache.dat.index") Then
If Not My.Computer.FileSystem.FileExists(Environ("locallowappdata") & "\Google\GoogleEarth\dbCache.dat") Then
If Not My.Computer.FileSystem.FileExists(Environ("locallowappdata") & "\Google\GoogleEarth\dbCache.dat.index") Then
frmMain.cbGoogleEarth.Visible = False
End If
End If
End If
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("appdata") & "\Google\Local Search History") Then
frmMain.cbGoogleToolbar.Visible = False
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("allusersappdata") & "\Google Updater\cache") Then
frmMain.cbGoogleUpdater.Visible = False
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("localappdata") & "\HP\Digital Imaging\cache") Then
frmMain.cbHPDigitalImaging.Visible = False
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("appdata") & "\IMVU") Then
frmMain.cbIMVU.Visible = False
End If
If Not My.Computer.FileSystem.FileExists(Environ("localappdata") & "\Apple Computer\Cache.db") Then
If Not My.Computer.FileSystem.FileExists(Environ("localappdata") & "\Apple Computer\iTunes\Cache.db") Then
frmMain.cbiTunes.Visible = False
End If
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("systemdrive") & "\rscache") Then
If Not My.Computer.FileSystem.DirectoryExists(Environ("systemdrive") & "\.jagex_cache_32") Then
If Not My.Computer.FileSystem.DirectoryExists(Environ("windir") & "\.jagex_cache_32") Then
If Not My.Computer.FileSystem.DirectoryExists(Environ("systemdrive") & "\.jagex_cache_64") Then
If Not My.Computer.FileSystem.DirectoryExists(Environ("windir") & "\.jagex_cache_64") Then
frmMain.cbJagex.Visible = False
End If
End If
End If
End If
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("programfiles") & "\Kaspersky Lab") Then
If Not My.Computer.FileSystem.DirectoryExists(Environ("programfiles(x86)") & "\Kaspersky Lab") Then
frmMain.cbKaspersky.Visible = False
End If
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("allusersappdata") & "\oviinstallercache") Then
frmMain.cbNokiaOvi.Visible = False
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("localappdata") & "\Apple Computer\QuickTime\downloads") Then
If Not My.Computer.FileSystem.DirectoryExists(Environ("locallowappdata") & "\Apple Computer\QuickTime\downloads") Then
frmMain.cbQuicktime.Visible = False
End If
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("appdata") & "\Real\RealPlayer") Then
If Not My.Computer.FileSystem.DirectoryExists(Environ("appdata") & "\Real\RealOne Player") Then
frmMain.cbRealPlayer.Visible = False
End If
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("localappdata") & "\Microsoft\Terminal Server Client\Cache") Then
frmMain.cbRDP.Visible = False
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("localappdata") & "\Microsoft\Silverlight") Then
If Not My.Computer.FileSystem.DirectoryExists(Environ("locallowappdata") & "\Microsoft\Silverlight") Then
frmMain.cbSilverlight.Visible = False
End If
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("localappdata") & "\Spotify\Storage") Then
frmMain.cbSpotify.Visible = False
End If
If My.Computer.Registry.CurrentUser.OpenSubKey("Software\Valve\Steam") Is Nothing Then
frmMain.cbSteam.Visible = False
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("allusersappdata") & "\Symantec Temporary Files") Then
frmMain.cbSymantec.Visible = False
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("allusersappdata") & "\TrackMania\Cache") Then
If Not My.Computer.FileSystem.DirectoryExists(Environ("localappdata") & "\VirtualStore\ProgramData\TrackMania\Cache") Then
frmMain.cbTrackmania.Visible = False
End If
End If
If Not My.Computer.FileSystem.DirectoryExists(Environ("localappdata") & "\Unity\Web Player\Cache") Then
If Not My.Computer.FileSystem.DirectoryExists(Environ("locallowappdata") & "\Unity\Web Player\Cache") Then
frmMain.cbUnity.Visible = False
End If
End If
End Sub
End Class