diff --git a/ArgsHelper.vb b/ArgsHelper.vb
new file mode 100644
index 0000000..90f2157
--- /dev/null
+++ b/ArgsHelper.vb
@@ -0,0 +1,17 @@
+Public Class ArgsHelper
+ Public Shared Function GetCommandLine() As IConfigurationRoot
+ Dim commands As New ConsoleApplicationBase
+ Dim list_param As New List(Of String)
+ For Each everyparam As String In commands.CommandLineArgs
+ list_param.Add(everyparam)
+ Next
+ Dim builder As ConfigurationBuilder = New ConfigurationBuilder()
+ builder.AddCommandLine(list_param.ToArray)
+ GC.Collect()
+ Return builder.Build()
+ End Function
+ Public Shared Function GetParam(params As String) As String
+ Dim iconfig As IConfigurationRoot = GetCommandLine()
+ Return iconfig.Item(params)
+ End Function
+End Class
diff --git a/CMDHelper.vb b/CMDHelper.vb
new file mode 100644
index 0000000..fb45e55
--- /dev/null
+++ b/CMDHelper.vb
@@ -0,0 +1,26 @@
+Public Class Dism
+ Public Shared Property UpdatePercent As String
+ Public Shared Function MidStrEx_New(sourse As String, startstr As String, endstr As String) As String
+ Dim rg As Regex = New Regex("(?<=(" & startstr & "))[.\s\S]*?(?=(" & endstr & "))", RegexOptions.Multiline Or RegexOptions.Singleline)
+ Return rg.Match(sourse).Value
+ End Function
+ Public Shared Sub Run(cmd As String)
+ Dim procs As New Process
+ procs.StartInfo.FileName = Environment.GetFolderPath(Environment.SpecialFolder.System) + "\dism.exe"
+ procs.StartInfo.Arguments = cmd
+ procs.StartInfo.UseShellExecute = False
+ procs.StartInfo.CreateNoWindow = True
+ procs.StartInfo.RedirectStandardOutput = True
+ procs.StartInfo.StandardOutputEncoding = Encoding.UTF8
+ procs.StartInfo.RedirectStandardError = False
+ AddHandler procs.OutputDataReceived, AddressOf Proc_OutputDataReceived
+ procs.StartInfo.WindowStyle = ProcessWindowStyle.Hidden
+ procs.Start()
+ procs.BeginOutputReadLine()
+ End Sub
+ Private Shared Sub Proc_OutputDataReceived(sender As Object, e As DataReceivedEventArgs)
+ Dim Oristr As String = MidStrEx_New(e.Data, "[", "]")
+ Dim Percent As String = Regex.Replace(Oristr, "[^0-9]+", "")
+ UpdatePercent = Percent
+ End Sub
+End Class
diff --git a/ClearConst.vb b/ClearConst.vb
new file mode 100644
index 0000000..56ef9ee
--- /dev/null
+++ b/ClearConst.vb
@@ -0,0 +1,16 @@
+Public Class ClearConst
+ Public ReadOnly WINDOWS_ROOT_PATH As String = Environment.GetFolderPath(Environment.SpecialFolder.Windows)
+ Public ReadOnly DISM_CLEAR_UPDATE_IMAGE As String = "/Online /Cleanup-Image /StartComponentCleanup /ResetBase"
+ Public ReadOnly WINDOWS_BT_FILE As String = WINDOWS_ROOT_PATH + "\$WINDOWS.~BT\"
+ Public ReadOnly WINDOWS_WS_FILE As String = WINDOWS_ROOT_PATH + "\$WINDOWS.~WS\"
+ Public ReadOnly PREFETCH_FILE As String = WINDOWS_ROOT_PATH + "\Prefetch\"
+ Public ReadOnly INTERNET_CACHE_FILE As String = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache) + "\"
+ Public ReadOnly APPDATA_ROAMING_TEMP As String = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\Temp\"
+ Public ReadOnly APPDATA_LOCAL_TEMP As String = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\Temp\"
+ Public ReadOnly SYSTEM_TMP As String = Environment.GetEnvironmentVariable("TMP", EnvironmentVariableTarget.Machine) + "\"
+ Public ReadOnly SYSTEM_TEMP As String = Environment.GetEnvironmentVariable("TEMP", EnvironmentVariableTarget.Machine) + "\"
+ Public ReadOnly SYSTEM_TMPDIR As String = Environment.GetEnvironmentVariable("TMPDIR", EnvironmentVariableTarget.Machine) + "\"
+ Public ReadOnly USER_TMP As String = Environment.GetEnvironmentVariable("TMP", EnvironmentVariableTarget.User) + "\"
+ Public ReadOnly USER_TEMP As String = Environment.GetEnvironmentVariable("TEMP", EnvironmentVariableTarget.User) + "\"
+
+End Class
diff --git a/ClearHelper.vb b/ClearHelper.vb
new file mode 100644
index 0000000..cb7b73f
--- /dev/null
+++ b/ClearHelper.vb
@@ -0,0 +1,77 @@
+
+Public Class ClearHelper
+ Public Shared Sub ClearMemory()
+ On Error Resume Next
+ Task.Factory.StartNew(New Action(Sub()
+
+ GC.Collect()
+ GC.WaitForPendingFinalizers()
+ Dim processes As Process() = Process.GetProcesses()
+ For Each oprocess As Process In processes
+ Try
+ If oprocess IsNot Process.GetCurrentProcess Then
+ If oprocess.Handle <> IntPtr.Zero Then
+ Psapi.EmptyWorkingSet(New Kernel32.SafeObjectHandle(oprocess.Handle))
+ End If
+ End If
+ Catch ex As SEHException
+ Catch ex As NullReferenceException
+ Catch ex As Exception
+ End Try
+ Next
+ End Sub))
+ End Sub
+ Public Shared Function GetCurrentMemoryUsing() As Single
+ On Error Resume Next
+ Dim cpu As PerformanceCounter = New PerformanceCounter("Memory", "Available MBytes", "")
+ Dim CPUs As Single = cpu.NextValue()
+ Dim Be_RAM As Single = (8089 - CPUs) / 8089 * 100
+ Return Be_RAM
+ End Function
+ Public Shared Sub ClearSystemProcess()
+ If My.Settings.ClearTask_Dwm Then
+ RestartProcess("dwm", False)
+ End If
+ If My.Settings.ClearTask_Explorer Then
+ RestartProcess("explorer")
+ End If
+ If My.Settings.ClearTask_SearchIndexer Then
+ RestartProcess("searchindexer", False)
+ End If
+ End Sub
+ Public Shared Sub RestartProcess(name As String, Optional autoRun As Boolean = True)
+ Dim ProcessPath As String
+ Dim process_all As Process() = Process.GetProcesses()
+ For Each every_proc As Process In process_all
+ If every_proc.ProcessName.ToLower = name Then
+ ProcessPath = every_proc.MainModule.FileName
+ every_proc.Kill()
+ If autoRun Then
+ Process.Start(ProcessPath)
+ End If
+ End If
+ Next
+ End Sub
+ Public Shared Sub ClearSystemUpdateTempFiles(dir As String)
+ On Error Resume Next
+ Task.Factory.StartNew(New Action(Sub()
+ DeleteDir(dir)
+ End Sub))
+ End Sub
+
+ Public Shared Sub DeleteDir(files As String)
+ On Error Resume Next
+ Dim fileInfo As DirectoryInfo = New DirectoryInfo(files) With {.Attributes = FileAttributes.Normal And FileAttributes.Directory}
+ File.SetAttributes(files, FileAttributes.Normal)
+ If Directory.Exists(files) Then
+ Parallel.ForEach(Directory.GetFileSystemEntries(files), New Action(Of String)(Sub(f)
+ If File.Exists(f) Then
+ File.Delete(f)
+ Else
+ DeleteDir(f)
+ End If
+ End Sub))
+ Directory.Delete(files)
+ End If
+ End Sub
+End Class
diff --git a/ConfigHelper.vb b/ConfigHelper.vb
new file mode 100644
index 0000000..53036bd
--- /dev/null
+++ b/ConfigHelper.vb
@@ -0,0 +1,20 @@
+Public Class ConfigHelper
+ Public Shared Sub SetAutoTime(time As Integer)
+ My.Settings.AutoClearTime = time
+ DymSaveAndReload()
+ End Sub
+
+ Public Shared Sub ReSet()
+ My.Settings.Reset()
+ End Sub
+ Public Shared Sub ReLoad()
+ My.Settings.Reload()
+ End Sub
+ Public Shared Sub Save()
+ My.Settings.Save()
+ End Sub
+ Public Shared Sub DymSaveAndReload()
+ Save()
+ ReLoad()
+ End Sub
+End Class
diff --git a/FastClear.sln b/FastClear.sln
new file mode 100644
index 0000000..0a71c4b
--- /dev/null
+++ b/FastClear.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31005.135
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "FastClear", "FastClear.vbproj", "{ED8A6495-1442-4FF2-88DC-4037736815D6}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {ED8A6495-1442-4FF2-88DC-4037736815D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {ED8A6495-1442-4FF2-88DC-4037736815D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {ED8A6495-1442-4FF2-88DC-4037736815D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {ED8A6495-1442-4FF2-88DC-4037736815D6}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {8E2D29D8-62EE-41E4-8C47-6311C584BAFE}
+ EndGlobalSection
+EndGlobal
diff --git a/FastClear.vbproj b/FastClear.vbproj
new file mode 100644
index 0000000..668aa63
--- /dev/null
+++ b/FastClear.vbproj
@@ -0,0 +1,196 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {ED8A6495-1442-4FF2-88DC-4037736815D6}
+ WinExe
+ Sub Main
+ FastClear
+ FastClear
+ 512
+ WindowsFormsWithCustomSubMain
+ v4.8
+ true
+ true
+
+
+ AnyCPU
+ true
+ full
+ true
+ true
+ bin\Debug\
+ FastClear.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+ AnyCPU
+ pdbonly
+ false
+ true
+ true
+ bin\Release\
+ FastClear.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+ false
+
+
+ On
+
+
+ Binary
+
+
+ Off
+
+
+ On
+
+
+
+ packages\Microsoft.Extensions.Configuration.5.0.0\lib\net461\Microsoft.Extensions.Configuration.dll
+
+
+ packages\Microsoft.Extensions.Configuration.Abstractions.5.0.0\lib\net461\Microsoft.Extensions.Configuration.Abstractions.dll
+
+
+ packages\Microsoft.Extensions.Configuration.CommandLine.5.0.0\lib\net461\Microsoft.Extensions.Configuration.CommandLine.dll
+
+
+ packages\Microsoft.Extensions.Primitives.5.0.0\lib\net461\Microsoft.Extensions.Primitives.dll
+
+
+ packages\PInvoke.Kernel32.0.7.104\lib\net46\PInvoke.Kernel32.dll
+
+
+ packages\PInvoke.Psapi.0.7.104\lib\net45\PInvoke.Psapi.dll
+
+
+ packages\PInvoke.Windows.Core.0.7.104\lib\net45\PInvoke.Windows.Core.dll
+
+
+ packages\SunnyUI.3.0.5\lib\net45\SunnyUI.dll
+
+
+ packages\SunnyUI.Common.3.0.5\lib\net45\SunnyUI.Common.dll
+
+
+
+ packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll
+
+
+
+
+
+
+
+ packages\System.Memory.4.5.4\lib\net461\System.Memory.dll
+
+
+
+ packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll
+
+
+ packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll
+
+
+
+
+ packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll
+
+
+ packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Form
+
+
+ MainWindow.vb
+ Form
+
+
+
+ True
+ Application.myapp
+ True
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+
+
+ MainWindow.vb
+
+
+ VbMyResourcesResXFileCodeGenerator
+ Resources.Designer.vb
+ My.Resources
+ Designer
+
+
+
+
+
+ MyApplicationCodeGenerator
+ Application.Designer.vb
+
+
+ SettingsSingleFileGenerator
+ My
+ Settings.Designer.vb
+
+
+
+
+
\ No newline at end of file
diff --git a/MainWindow.Designer.vb b/MainWindow.Designer.vb
new file mode 100644
index 0000000..182c0a2
--- /dev/null
+++ b/MainWindow.Designer.vb
@@ -0,0 +1,79 @@
+ _
+Partial Class MainWindow
+ Inherits UIForm
+
+ 'Form 重写 Dispose,以清理组件列表。
+ _
+ Protected Overrides Sub Dispose(ByVal disposing As Boolean)
+ Try
+ If disposing AndAlso components IsNot Nothing Then
+ components.Dispose()
+ End If
+ Finally
+ MyBase.Dispose(disposing)
+ End Try
+ End Sub
+
+ 'Windows 窗体设计器所必需的
+ Private components As System.ComponentModel.IContainer
+
+ '注意: 以下过程是 Windows 窗体设计器所必需的
+ '可以使用 Windows 窗体设计器修改它。
+ '不要使用代码编辑器修改它。
+ _
+ Private Sub InitializeComponent()
+ Me.components = New System.ComponentModel.Container()
+ Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(MainWindow))
+ Me.RAM_Size = New Sunny.UI.UILabel()
+ Me.RAM_Refresh = New System.Windows.Forms.Timer(Me.components)
+ Me.ClearRAMBtn = New Sunny.UI.UIButton()
+ Me.SuspendLayout()
+ '
+ 'RAM_Size
+ '
+ resources.ApplyResources(Me.RAM_Size, "RAM_Size")
+ Me.RAM_Size.ForeColor = System.Drawing.Color.Green
+ Me.RAM_Size.Name = "RAM_Size"
+ Me.RAM_Size.Style = Sunny.UI.UIStyle.Custom
+ '
+ 'RAM_Refresh
+ '
+ Me.RAM_Refresh.Enabled = True
+ Me.RAM_Refresh.Interval = 1
+ '
+ 'ClearRAMBtn
+ '
+ Me.ClearRAMBtn.Cursor = System.Windows.Forms.Cursors.Hand
+ Me.ClearRAMBtn.FillColor = System.Drawing.Color.DodgerBlue
+ resources.ApplyResources(Me.ClearRAMBtn, "ClearRAMBtn")
+ Me.ClearRAMBtn.Name = "ClearRAMBtn"
+ Me.ClearRAMBtn.RadiusSides = Sunny.UI.UICornerRadiusSides.None
+ Me.ClearRAMBtn.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None
+ Me.ClearRAMBtn.Style = Sunny.UI.UIStyle.Custom
+ '
+ 'MainWindow
+ '
+ resources.ApplyResources(Me, "$this")
+ Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
+ Me.BackColor = System.Drawing.Color.White
+ Me.Controls.Add(Me.ClearRAMBtn)
+ Me.Controls.Add(Me.RAM_Size)
+ Me.EscClose = True
+ Me.IsForbidAltF4 = True
+ Me.MaximizeBox = False
+ Me.Name = "MainWindow"
+ Me.RectColor = System.Drawing.Color.DodgerBlue
+ Me.ShowRadius = False
+ Me.ShowRect = False
+ Me.ShowShadow = True
+ Me.Style = Sunny.UI.UIStyle.Custom
+ Me.TitleColor = System.Drawing.Color.DodgerBlue
+ Me.ResumeLayout(False)
+ Me.PerformLayout()
+
+ End Sub
+
+ Friend WithEvents RAM_Size As UILabel
+ Friend WithEvents RAM_Refresh As Windows.Forms.Timer
+ Friend WithEvents ClearRAMBtn As UIButton
+End Class
diff --git a/MainWindow.resx b/MainWindow.resx
new file mode 100644
index 0000000..a128507
--- /dev/null
+++ b/MainWindow.resx
@@ -0,0 +1,209 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+ True
+
+
+
+ 微软雅黑, 20pt
+
+
+ 34, 47
+
+
+ 0, 35
+
+
+ 0
+
+
+ MiddleLeft
+
+
+ RAM_Size
+
+
+ Sunny.UI.UILabel, SunnyUI, Version=3.0.5.0, Culture=neutral, PublicKeyToken=null
+
+
+ $this
+
+
+ 1
+
+
+ 17, 17
+
+
+ 微软雅黑, 12pt
+
+
+ 563, 47
+
+
+ 1, 1
+
+
+ 115, 35
+
+
+ 1
+
+
+ 清理内存
+
+
+ ClearRAMBtn
+
+
+ Sunny.UI.UIButton, SunnyUI, Version=3.0.5.0, Culture=neutral, PublicKeyToken=null
+
+
+ $this
+
+
+ 0
+
+
+ True
+
+
+ 10, 21
+
+
+ 694, 439
+
+
+ FastClear
+
+
+ RAM_Refresh
+
+
+ System.Windows.Forms.Timer, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ MainWindow
+
+
+ Sunny.UI.UIForm, SunnyUI, Version=3.0.5.0, Culture=neutral, PublicKeyToken=null
+
+
\ No newline at end of file
diff --git a/MainWindow.vb b/MainWindow.vb
new file mode 100644
index 0000000..61b98e3
--- /dev/null
+++ b/MainWindow.vb
@@ -0,0 +1,26 @@
+Public Class MainWindow
+
+ Private Sub MainWindow_Load(sender As Object, e As EventArgs) Handles MyBase.Load
+
+
+ End Sub
+
+ Private Sub RAM_Refresh_Tick(sender As Object, e As EventArgs) Handles RAM_Refresh.Tick
+ Dim usingT As Single = ClearHelper.GetCurrentMemoryUsing
+ If usingT >= 70.55 Then
+ RAM_Size.ForeColor = Color.Crimson
+ Else
+ RAM_Size.ForeColor = Color.Green
+ End If
+ RAM_Size.Text = "内存占用:" + usingT.ToString.Substring(0, 5) + "%"
+ End Sub
+
+ Private Sub ClearRAMBtn_Click(sender As Object, e As EventArgs) Handles ClearRAMBtn.Click
+ DelayControl(ClearRAMBtn, False)
+ ClearHelper.ClearMemory()
+ DelayControl(ClearRAMBtn, True)
+ End Sub
+ Private Sub DelayControl(controls As Control, state As Boolean)
+ controls.Enabled = state
+ End Sub
+End Class
diff --git a/My Project/Application.Designer.vb b/My Project/Application.Designer.vb
new file mode 100644
index 0000000..537244b
--- /dev/null
+++ b/My Project/Application.Designer.vb
@@ -0,0 +1,13 @@
+'------------------------------------------------------------------------------
+'
+' 此代码由工具生成。
+' 运行时版本:4.0.30319.42000
+'
+' 对此文件的更改可能会导致不正确的行为,并且如果
+' 重新生成代码,这些更改将会丢失。
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
diff --git a/My Project/Application.myapp b/My Project/Application.myapp
new file mode 100644
index 0000000..20dcb2c
--- /dev/null
+++ b/My Project/Application.myapp
@@ -0,0 +1,10 @@
+
+
+ false
+ MainWindow
+ true
+ 0
+ true
+ 0
+ true
+
\ No newline at end of file
diff --git a/My Project/AssemblyInfo.vb b/My Project/AssemblyInfo.vb
new file mode 100644
index 0000000..6457bca
--- /dev/null
+++ b/My Project/AssemblyInfo.vb
@@ -0,0 +1,35 @@
+Imports System
+Imports System.Reflection
+Imports System.Runtime.InteropServices
+
+' 有关程序集的一般信息由以下
+' 控制。更改这些特性值可修改
+' 与程序集关联的信息。
+
+'查看程序集特性的值
+
+
+
+
+
+
+
+
+
+
+'如果此项目向 COM 公开,则下列 GUID 用于 typelib 的 ID
+
+
+' 程序集的版本信息由下列四个值组成:
+'
+' 主版本
+' 次版本
+' 生成号
+' 修订号
+'
+'可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
+'通过使用 "*",如下所示:
+'
+
+
+
diff --git a/My Project/Resources.Designer.vb b/My Project/Resources.Designer.vb
new file mode 100644
index 0000000..4147af4
--- /dev/null
+++ b/My Project/Resources.Designer.vb
@@ -0,0 +1,99 @@
+'------------------------------------------------------------------------------
+'
+' 此代码由工具生成。
+' 运行时版本:4.0.30319.42000
+'
+' 对此文件的更改可能会导致不正确的行为,并且如果
+' 重新生成代码,这些更改将会丢失。
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+Imports System
+
+Namespace My.Resources
+
+ '此类是由 StronglyTypedResourceBuilder
+ '类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
+ '若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
+ '(以 /str 作为命令选项),或重新生成 VS 项目。
+ '''
+ ''' 一个强类型的资源类,用于查找本地化的字符串等。
+ '''
+ _
+ Friend Module Resources
+
+ Private resourceMan As Global.System.Resources.ResourceManager
+
+ Private resourceCulture As Global.System.Globalization.CultureInfo
+
+ '''
+ ''' 返回此类使用的缓存的 ResourceManager 实例。
+ '''
+ _
+ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
+ Get
+ If Object.ReferenceEquals(resourceMan, Nothing) Then
+ Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("FastClear.Resources", GetType(Resources).Assembly)
+ resourceMan = temp
+ End If
+ Return resourceMan
+ End Get
+ End Property
+
+ '''
+ ''' 重写当前线程的 CurrentUICulture 属性,对
+ ''' 使用此强类型资源类的所有资源查找执行重写。
+ '''
+ _
+ Friend Property Culture() As Global.System.Globalization.CultureInfo
+ Get
+ Return resourceCulture
+ End Get
+ Set
+ resourceCulture = value
+ End Set
+ End Property
+
+ '''
+ ''' 查找类似 " 的本地化字符串。
+ '''
+ Friend ReadOnly Property SChar() As String
+ Get
+ Return ResourceManager.GetString("SChar", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' 查找类似 此服务用于执行设置的快速清理任务。 该服务由 Fast Clear 创建。 请不要手动删除该服务,否则可能导致系统异常。| This service is used to perform set quick cleanup tasks. This service is created by Fast Clear. Please do not delete this service manually, otherwise it may cause system abnormalities. 的本地化字符串。
+ '''
+ Friend ReadOnly Property SrvDescription() As String
+ Get
+ Return ResourceManager.GetString("SrvDescription", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' 查找类似 System Fast Clear Helper Services 的本地化字符串。
+ '''
+ Friend ReadOnly Property SrvDisplayName() As String
+ Get
+ Return ResourceManager.GetString("SrvDisplayName", resourceCulture)
+ End Get
+ End Property
+
+ '''
+ ''' 查找类似 SystemFastClear 的本地化字符串。
+ '''
+ Friend ReadOnly Property SrvServiceName() As String
+ Get
+ Return ResourceManager.GetString("SrvServiceName", resourceCulture)
+ End Get
+ End Property
+ End Module
+End Namespace
diff --git a/My Project/Resources.resx b/My Project/Resources.resx
new file mode 100644
index 0000000..a4d53a6
--- /dev/null
+++ b/My Project/Resources.resx
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ "
+
+
+ 此服务用于执行设置的快速清理任务。 该服务由 Fast Clear 创建。 请不要手动删除该服务,否则可能导致系统异常。| This service is used to perform set quick cleanup tasks. This service is created by Fast Clear. Please do not delete this service manually, otherwise it may cause system abnormalities.
+
+
+ System Fast Clear Helper Services
+
+
+ SystemFastClear
+
+
\ No newline at end of file
diff --git a/My Project/Settings.Designer.vb b/My Project/Settings.Designer.vb
new file mode 100644
index 0000000..8677fbb
--- /dev/null
+++ b/My Project/Settings.Designer.vb
@@ -0,0 +1,145 @@
+'------------------------------------------------------------------------------
+'
+' 此代码由工具生成。
+' 运行时版本:4.0.30319.42000
+'
+' 对此文件的更改可能会导致不正确的行为,并且如果
+' 重新生成代码,这些更改将会丢失。
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My
+
+ _
+ Partial Friend NotInheritable Class MySettings
+ Inherits Global.System.Configuration.ApplicationSettingsBase
+
+ Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
+
+#Region "My.Settings 自动保存功能"
+#If _MyType = "WindowsForms" Then
+ Private Shared addedHandler As Boolean
+
+ Private Shared addedHandlerLockObject As New Object
+
+ _
+ Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs)
+ If My.Application.SaveMySettingsOnExit Then
+ My.Settings.Save()
+ End If
+ End Sub
+#End If
+#End Region
+
+ Public Shared ReadOnly Property [Default]() As MySettings
+ Get
+
+#If _MyType = "WindowsForms" Then
+ If Not addedHandler Then
+ SyncLock addedHandlerLockObject
+ If Not addedHandler Then
+ AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
+ addedHandler = True
+ End If
+ End SyncLock
+ End If
+#End If
+ Return defaultInstance
+ End Get
+ End Property
+
+ _
+ Public Property AutoClearTime() As Integer
+ Get
+ Return CType(Me("AutoClearTime"),Integer)
+ End Get
+ Set
+ Me("AutoClearTime") = value
+ End Set
+ End Property
+
+ _
+ Public Property ClearMemory() As Boolean
+ Get
+ Return CType(Me("ClearMemory"),Boolean)
+ End Get
+ Set
+ Me("ClearMemory") = value
+ End Set
+ End Property
+
+ _
+ Public Property ClearTempFiles() As Boolean
+ Get
+ Return CType(Me("ClearTempFiles"),Boolean)
+ End Get
+ Set
+ Me("ClearTempFiles") = value
+ End Set
+ End Property
+
+ _
+ Public Property ClearTask_Dwm() As Boolean
+ Get
+ Return CType(Me("ClearTask_Dwm"),Boolean)
+ End Get
+ Set
+ Me("ClearTask_Dwm") = value
+ End Set
+ End Property
+
+ _
+ Public Property ClearTask_Explorer() As Boolean
+ Get
+ Return CType(Me("ClearTask_Explorer"),Boolean)
+ End Get
+ Set
+ Me("ClearTask_Explorer") = value
+ End Set
+ End Property
+
+ _
+ Public Property ClearTask_SearchIndexer() As Boolean
+ Get
+ Return CType(Me("ClearTask_SearchIndexer"),Boolean)
+ End Get
+ Set
+ Me("ClearTask_SearchIndexer") = value
+ End Set
+ End Property
+ End Class
+End Namespace
+
+Namespace My
+
+ _
+ Friend Module MySettingsProperty
+
+ _
+ Friend ReadOnly Property Settings() As Global.FastClear.My.MySettings
+ Get
+ Return Global.FastClear.My.MySettings.Default
+ End Get
+ End Property
+ End Module
+End Namespace
diff --git a/My Project/Settings.settings b/My Project/Settings.settings
new file mode 100644
index 0000000..f9940a8
--- /dev/null
+++ b/My Project/Settings.settings
@@ -0,0 +1,24 @@
+
+
+
+
+
+ 60000
+
+
+ True
+
+
+ True
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+
\ No newline at end of file
diff --git a/Program.vb b/Program.vb
new file mode 100644
index 0000000..f365884
--- /dev/null
+++ b/Program.vb
@@ -0,0 +1,23 @@
+Public Class Program
+ Public Shared Sub Main(args As String())
+ AddHandler Application.ThreadException, AddressOf Application_ThreadException
+ AddHandler AppDomain.CurrentDomain.UnhandledException, AddressOf CurrentDomain_UnhandledException
+ If Command().ToLower = "/startservice fastclear_run" Then
+ ServiceBase.Run(New ServiceBase() {New ServicesRun.Service})
+ Else
+ Application.Run(New MainWindow)
+ End If
+ End Sub
+
+ Private Shared Sub CurrentDomain_UnhandledException(ByVal sender As Object, ByVal e As System.UnhandledExceptionEventArgs)
+ On Error Resume Next
+ 'Dim ex As Exception = TryCast(e.ExceptionObject, Exception)
+ 'MessageBox.Show(String.Format("捕获到未处理异常:{0}" & vbCrLf & "异常信息:{1}" & vbCrLf & "异常堆栈:{2}" & vbCrLf & "CLR即将退出:{3}", ex.[GetType](), ex.Message, ex.StackTrace, e.IsTerminating))
+ End Sub
+
+ Private Shared Sub Application_ThreadException(ByVal sender As Object, ByVal e As System.Threading.ThreadExceptionEventArgs)
+ On Error Resume Next
+ 'Dim ex As Exception = e.Exception
+ 'MessageBox.Show(String.Format("捕获到未处理异常:{0}" & vbCrLf & "异常信息:{1}" & vbCrLf & "异常堆栈:{2}", ex.[GetType](), ex.Message, ex.StackTrace))
+ End Sub
+End Class
diff --git a/ServicesRun.vb b/ServicesRun.vb
new file mode 100644
index 0000000..494bfcd
--- /dev/null
+++ b/ServicesRun.vb
@@ -0,0 +1,135 @@
+Public Class ServicesRun
+ ''辅助类
+ Public Class ServiceHelper
+ Public Shared Function IsServiceExisted() As Boolean
+ Dim services As ServiceController() = ServiceController.GetServices()
+
+ For Each s As ServiceController In services
+
+ If s.ServiceName = My.Resources.SrvServiceName Then
+ Return True
+ End If
+ Next
+
+ Return False
+ End Function
+
+ Public Shared Function StartService()
+ If IsServiceExisted() Then
+ Dim service As ServiceController = New ServiceController(My.Resources.SrvServiceName)
+
+ If service.Status <> ServiceControllerStatus.Running AndAlso service.Status <> ServiceControllerStatus.StartPending Then
+ service.Start()
+
+ For i As Integer = 0 To 60 - 1
+ service.Refresh()
+ Thread.Sleep(1000)
+
+ If service.Status = System.ServiceProcess.ServiceControllerStatus.Running Then
+ Exit For
+ End If
+
+ If i = 59 Then
+ Return False
+ End If
+ Next
+ Return True
+ Else
+ Return False
+ End If
+ Else
+ Return False
+ End If
+ End Function
+
+ Public Shared Function GetServiceStatus() As ServiceControllerStatus
+ Dim service As ServiceController = New ServiceController(My.Resources.SrvServiceName)
+ Return service.Status
+ End Function
+
+ Public Shared Sub ConfigService(myserv As MyInstaller, install As Boolean)
+ Dim ti As TransactedInstaller = New TransactedInstaller()
+ ti.Installers.Add(myserv.ServiceInstallers)
+ ti.Installers.Add(myserv.ServiceProcessInstallers)
+ ti.Context = New InstallContext()
+ ti.Context.Parameters("AssemblyPath") = My.Resources.SChar & Assembly.GetEntryAssembly().Location & My.Resources.SChar + " /StartService fastclear_run"
+ 'ti.Context.Parameters("LogToConsole") = "false"
+ If install Then
+ ti.Install(New Hashtable())
+ Else
+ ti.Uninstall(Nothing)
+ End If
+ End Sub
+ End Class
+ ''服务
+ Public Class Service
+ Inherits ServiceBase
+ Public Sub New()
+ CanHandlePowerEvent = True
+ CanHandleSessionChangeEvent = True
+ CanShutdown = True
+ CanStop = True
+ CanPauseAndContinue = True
+ AutoLog = True
+ ExitCode = 0
+ ServiceName = My.Resources.SrvServiceName
+ End Sub
+ Protected ReadOnly TaskTimer As New Windows.Forms.Timer With {.Enabled = False, .Interval = 60000}
+ Protected Sub RunTask()
+ On Error Resume Next
+ If My.Settings.ClearMemory Then
+ ClearHelper.ClearMemory()
+ End If
+ If My.Settings.ClearTempFiles Then
+
+ End If
+ If My.Settings.ClearTask_Dwm Then
+
+ End If
+ If My.Settings.ClearTask_Explorer Then
+
+ End If
+ If My.Settings.ClearTask_SearchIndexer Then
+
+ End If
+ End Sub
+
+ Protected Overrides Sub OnStart(args() As String)
+ AddHandler TaskTimer.Tick, AddressOf RunTask
+ TaskTimer.Interval = My.Settings.AutoClearTime
+
+ End Sub
+ Protected Overrides Sub OnPause()
+
+ End Sub
+ Protected Overrides Sub OnContinue()
+
+ End Sub
+ Protected Overrides Sub OnStop()
+
+ End Sub
+ Protected Overrides Function OnPowerEvent(powerStatus As PowerBroadcastStatus) As Boolean
+ Return True
+ End Function
+ End Class
+ Public Class MyInstaller
+ Public ReadOnly Property ServiceProcessInstallers As ServiceProcessInstaller
+ Public ReadOnly Property ServiceInstallers As ServiceInstaller
+ Public Sub New()
+ ''初始化
+
+ ServiceProcessInstallers = New ServiceProcessInstaller
+ ServiceInstallers = New ServiceInstaller
+ ''设置属性等
+ ServiceProcessInstallers.Account = ServiceAccount.LocalSystem
+ ServiceProcessInstallers.Username = Nothing
+ ServiceProcessInstallers.Password = Nothing
+ ''
+ ServiceInstallers.StartType = ServiceStartMode.Automatic
+ ServiceInstallers.DelayedAutoStart = False
+ ServiceInstallers.ServiceName = My.Resources.SrvServiceName
+ ServiceInstallers.DisplayName = My.Resources.SrvDisplayName
+ ServiceInstallers.Description = My.Resources.SrvDescription
+ End Sub
+ End Class
+End Class
diff --git a/app.config b/app.config
new file mode 100644
index 0000000..a47b5eb
--- /dev/null
+++ b/app.config
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 60000
+
+
+ True
+
+
+ True
+
+
+ False
+
+
+ False
+
+
+ False
+
+
+
+
\ No newline at end of file
diff --git a/packages.config b/packages.config
new file mode 100644
index 0000000..1c56977
--- /dev/null
+++ b/packages.config
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file