├── .github
└── FUNDING.yml
├── src
├── program.ico
├── TaskScheduler
│ ├── Microsoft.Win32.TaskScheduler.dll
│ └── readme.txt
├── Utilities.cs
├── OpenTimerResolution.sln
├── Program.cs
├── OpenTimerResolution.csproj
├── .gitattributes
├── app.manifest
├── resources.Designer.cs
├── resources.resx
├── MemoryCleaner.cs
├── MainWindow.cs
└── MainWindow.Designer.cs
├── repo_imgs
├── banner.png
└── dark_mode.gif
├── README.md
├── .gitignore
└── LICENSE
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | custom: https://tornix.dev/
2 |
--------------------------------------------------------------------------------
/src/program.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TorniX0/OpenTimerResolution/HEAD/src/program.ico
--------------------------------------------------------------------------------
/repo_imgs/banner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TorniX0/OpenTimerResolution/HEAD/repo_imgs/banner.png
--------------------------------------------------------------------------------
/repo_imgs/dark_mode.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TorniX0/OpenTimerResolution/HEAD/repo_imgs/dark_mode.gif
--------------------------------------------------------------------------------
/src/TaskScheduler/Microsoft.Win32.TaskScheduler.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TorniX0/OpenTimerResolution/HEAD/src/TaskScheduler/Microsoft.Win32.TaskScheduler.dll
--------------------------------------------------------------------------------
/src/Utilities.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace OpenTimerResolution
8 | {
9 | public static class Utilities
10 | {
11 | #region Methods
12 |
13 | public static async Task DownloadAsync(Uri requestUri, string filename)
14 | {
15 | HttpClient client = new();
16 |
17 | using var s = await client.GetStreamAsync(requestUri);
18 | using var fs = new FileStream(filename, FileMode.Create);
19 | await s.CopyToAsync(fs);
20 | }
21 |
22 | #endregion
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/TaskScheduler/readme.txt:
--------------------------------------------------------------------------------
1 | Source code for the TaskScheduler API can be found here: https://github.com/dahall/TaskScheduler
2 |
3 | MIT Copyright (c) 2003-2010 David Hall
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6 |
7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 |
9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10 |
--------------------------------------------------------------------------------
/src/OpenTimerResolution.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.0.32014.148
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTimerResolution", "OpenTimerResolution.csproj", "{8A577748-FBC9-47E2-8404-E579CF97EB4C}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {8A577748-FBC9-47E2-8404-E579CF97EB4C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {8A577748-FBC9-47E2-8404-E579CF97EB4C}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {8A577748-FBC9-47E2-8404-E579CF97EB4C}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {8A577748-FBC9-47E2-8404-E579CF97EB4C}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {A7B7F1D2-77DD-4037-B812-6741F18AE265}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/src/Program.cs:
--------------------------------------------------------------------------------
1 | using System.Configuration;
2 | using System.Diagnostics;
3 | using System.Globalization;
4 |
5 | namespace OpenTimerResolution
6 | {
7 | internal static class Program
8 | {
9 | internal static bool startMinimized = Environment.GetCommandLineArgs().Contains("-minimized");
10 | internal static bool silentInstall = Environment.GetCommandLineArgs().Contains("-silentInstall");
11 |
12 | ///
13 | /// The main entry point for the application.
14 | ///
15 |
16 |
17 | [STAThread]
18 | static void Main()
19 | {
20 | CultureInfo ci = new("en-US");
21 | Thread.CurrentThread.CurrentCulture = ci;
22 | Thread.CurrentThread.CurrentUICulture = ci;
23 |
24 | if (Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName).Length > 1)
25 | {
26 | MessageBox.Show("OpenTimerResolution is already running. Only one instance of this application is allowed.", "OpenTimerResolution");
27 | Application.Exit();
28 | return;
29 | }
30 |
31 | if (silentInstall)
32 | startMinimized = true;
33 |
34 | if (!File.Exists(ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None).FilePath))
35 | File.WriteAllText(ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None).FilePath, resources.defaultConfig);
36 |
37 |
38 | ApplicationConfiguration.Initialize();
39 |
40 | MainWindow mainWind = new();
41 |
42 | Application.Run(mainWind);
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/OpenTimerResolution.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | net7.0-windows
6 | true
7 | enable
8 | OpenTimerResolution.Program
9 | program.ico
10 | app.manifest
11 | 1.0.4.6
12 | 1.0.4.6
13 | 1.0.4.6
14 | embedded
15 | OpenTimerResolution
16 | OpenTimerResolution is a lightweight open-source application that changes the resolution of the Windows system Timer to a specified value and has a memory cache cleaner included.
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | TaskScheduler\Microsoft.Win32.TaskScheduler.dll
34 |
35 |
36 |
37 |
38 |
39 | True
40 | True
41 | resources.resx
42 |
43 |
44 |
45 |
46 |
47 | ResXFileCodeGenerator
48 | resources.Designer.cs
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | ## ℹ️ Summary
6 |
7 | **OpenTimerResolution** is a *lightweight* open-source application that changes the resolution of the Windows system Timer to a specified value and has a memory cache cleaner included.
8 | + Log the resolution `[>=v1.0.2.3]`
9 | + Dark mode `[>=v1.0.2.4]`
10 | + Ability to silent install `(-silentInstall)` `[>=v1.0.3.5]`
11 | + Automatic GitHub update check on start-up `[>=v1.0.3.6]`
12 | + Ability to run minimized `(-minimized)` `[>=v1.0.0.0]`
13 | + Start-up schedule `[>=v1.0.2.0]`
14 | + Config manager `[>=v1.0.3.1]`
15 |
16 |
17 | ## 📸 Screenshot (GIF)
18 |
19 |
20 |
21 | ## 💾 Details
22 | + .NET 7.0 (WinForms)
23 | + Portable single-executable
24 |
25 | ## ⚡ Important
26 |
27 | **In order for the program to take effect, it needs to be running in the background.**
28 |
29 | *Small note: the automatic memory cache cleaner might slow down downloads on apps such as Steam (when downloading or updating)*
30 |
31 | .NET 7.0 SDK is required to build the project: https://dotnet.microsoft.com/download/dotnet/7.0
32 |
33 | ## 📝 License
34 |
35 | This project is licensed under the GNU General Public License version 2 ("GPLv2") and therefore can be used in commercial projects. However, any commit or change to the main code must be public and there should be a copyright notice in the source code clarifying the license and its terms as part of your project as well as a hyperlink to this repository. This program is distributed in the hope that it will be useful. [Read more about GPLv2](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html).
36 |
37 | **THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.**
38 |
--------------------------------------------------------------------------------
/src/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/src/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
54 |
62 |
63 |
64 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/src/resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace OpenTimerResolution {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OpenTimerResolution.resources", typeof(resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 |
63 | ///
64 | /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8" ?>
65 | ///<configuration>
66 | /// <appSettings>
67 | /// <add key="DesiredResolution" value="0.50"/>
68 | /// <add key="StartPurgingAutomatically" value="True"/>
69 | /// <add key="DarkMode" value="True"/>
70 | /// <add key="TextUpdateInterval" value="1000ms"/>
71 | /// </appSettings>
72 | ///</configuration>.
73 | ///
74 | internal static string defaultConfig {
75 | get {
76 | return ResourceManager.GetString("defaultConfig", resourceCulture);
77 | }
78 | }
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/src/resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
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 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | <?xml version="1.0" encoding="utf-8" ?>
122 | <configuration>
123 | <appSettings>
124 | <add key="DesiredResolution" value="0.50"/>
125 | <add key="StartPurgingAutomatically" value="True"/>
126 | <add key="DarkMode" value="True"/>
127 | <add key="TextUpdateInterval" value="1000ms"/>
128 | </appSettings>
129 | </configuration>
130 |
131 |
132 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Mono auto generated files
17 | mono_crash.*
18 |
19 | # Build results
20 | [Dd]ebug/
21 | [Dd]ebugPublic/
22 | [Rr]elease/
23 | [Rr]eleases/
24 | x64/
25 | x86/
26 | [Ww][Ii][Nn]32/
27 | [Aa][Rr][Mm]/
28 | [Aa][Rr][Mm]64/
29 | bld/
30 | [Bb]in/
31 | [Oo]bj/
32 | [Oo]ut/
33 | [Ll]og/
34 | [Ll]ogs/
35 |
36 | # Visual Studio 2015/2017 cache/options directory
37 | .vs/
38 | # Uncomment if you have tasks that create the project's static files in wwwroot
39 | #wwwroot/
40 |
41 | # Visual Studio 2017 auto generated files
42 | Generated\ Files/
43 |
44 | # MSTest test Results
45 | [Tt]est[Rr]esult*/
46 | [Bb]uild[Ll]og.*
47 |
48 | # NUnit
49 | *.VisualState.xml
50 | TestResult.xml
51 | nunit-*.xml
52 |
53 | # Build Results of an ATL Project
54 | [Dd]ebugPS/
55 | [Rr]eleasePS/
56 | dlldata.c
57 |
58 | # Benchmark Results
59 | BenchmarkDotNet.Artifacts/
60 |
61 | # .NET Core
62 | project.lock.json
63 | project.fragment.lock.json
64 | artifacts/
65 |
66 | # ASP.NET Scaffolding
67 | ScaffoldingReadMe.txt
68 |
69 | # StyleCop
70 | StyleCopReport.xml
71 |
72 | # Files built by Visual Studio
73 | *_i.c
74 | *_p.c
75 | *_h.h
76 | *.ilk
77 | *.meta
78 | *.obj
79 | *.iobj
80 | *.pch
81 | *.pdb
82 | *.ipdb
83 | *.pgc
84 | *.pgd
85 | *.rsp
86 | *.sbr
87 | *.tlb
88 | *.tli
89 | *.tlh
90 | *.tmp
91 | *.tmp_proj
92 | *_wpftmp.csproj
93 | *.log
94 | *.vspscc
95 | *.vssscc
96 | .builds
97 | *.pidb
98 | *.svclog
99 | *.scc
100 |
101 | # Chutzpah Test files
102 | _Chutzpah*
103 |
104 | # Visual C++ cache files
105 | ipch/
106 | *.aps
107 | *.ncb
108 | *.opendb
109 | *.opensdf
110 | *.sdf
111 | *.cachefile
112 | *.VC.db
113 | *.VC.VC.opendb
114 |
115 | # Visual Studio profiler
116 | *.psess
117 | *.vsp
118 | *.vspx
119 | *.sap
120 |
121 | # Visual Studio Trace Files
122 | *.e2e
123 |
124 | # TFS 2012 Local Workspace
125 | $tf/
126 |
127 | # Guidance Automation Toolkit
128 | *.gpState
129 |
130 | # ReSharper is a .NET coding add-in
131 | _ReSharper*/
132 | *.[Rr]e[Ss]harper
133 | *.DotSettings.user
134 |
135 | # TeamCity is a build add-in
136 | _TeamCity*
137 |
138 | # DotCover is a Code Coverage Tool
139 | *.dotCover
140 |
141 | # AxoCover is a Code Coverage Tool
142 | .axoCover/*
143 | !.axoCover/settings.json
144 |
145 | # Coverlet is a free, cross platform Code Coverage Tool
146 | coverage*.json
147 | coverage*.xml
148 | coverage*.info
149 |
150 | # Visual Studio code coverage results
151 | *.coverage
152 | *.coveragexml
153 |
154 | # NCrunch
155 | _NCrunch_*
156 | .*crunch*.local.xml
157 | nCrunchTemp_*
158 |
159 | # MightyMoose
160 | *.mm.*
161 | AutoTest.Net/
162 |
163 | # Web workbench (sass)
164 | .sass-cache/
165 |
166 | # Installshield output folder
167 | [Ee]xpress/
168 |
169 | # DocProject is a documentation generator add-in
170 | DocProject/buildhelp/
171 | DocProject/Help/*.HxT
172 | DocProject/Help/*.HxC
173 | DocProject/Help/*.hhc
174 | DocProject/Help/*.hhk
175 | DocProject/Help/*.hhp
176 | DocProject/Help/Html2
177 | DocProject/Help/html
178 |
179 | # Click-Once directory
180 | publish/
181 |
182 | # Publish Web Output
183 | *.[Pp]ublish.xml
184 | *.azurePubxml
185 | # Note: Comment the next line if you want to checkin your web deploy settings,
186 | # but database connection strings (with potential passwords) will be unencrypted
187 | *.pubxml
188 | *.publishproj
189 |
190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
191 | # checkin your Azure Web App publish settings, but sensitive information contained
192 | # in these scripts will be unencrypted
193 | PublishScripts/
194 |
195 | # NuGet Packages
196 | *.nupkg
197 | # NuGet Symbol Packages
198 | *.snupkg
199 | # The packages folder can be ignored because of Package Restore
200 | **/[Pp]ackages/*
201 | # except build/, which is used as an MSBuild target.
202 | !**/[Pp]ackages/build/
203 | # Uncomment if necessary however generally it will be regenerated when needed
204 | #!**/[Pp]ackages/repositories.config
205 | # NuGet v3's project.json files produces more ignorable files
206 | *.nuget.props
207 | *.nuget.targets
208 |
209 | # Microsoft Azure Build Output
210 | csx/
211 | *.build.csdef
212 |
213 | # Microsoft Azure Emulator
214 | ecf/
215 | rcf/
216 |
217 | # Windows Store app package directories and files
218 | AppPackages/
219 | BundleArtifacts/
220 | Package.StoreAssociation.xml
221 | _pkginfo.txt
222 | *.appx
223 | *.appxbundle
224 | *.appxupload
225 |
226 | # Visual Studio cache files
227 | # files ending in .cache can be ignored
228 | *.[Cc]ache
229 | # but keep track of directories ending in .cache
230 | !?*.[Cc]ache/
231 |
232 | # Others
233 | ClientBin/
234 | ~$*
235 | *~
236 | *.dbmdl
237 | *.dbproj.schemaview
238 | *.jfm
239 | *.pfx
240 | *.publishsettings
241 | orleans.codegen.cs
242 |
243 | # Including strong name files can present a security risk
244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
245 | #*.snk
246 |
247 | # Since there are multiple workflows, uncomment next line to ignore bower_components
248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
249 | #bower_components/
250 |
251 | # RIA/Silverlight projects
252 | Generated_Code/
253 |
254 | # Backup & report files from converting an old project file
255 | # to a newer Visual Studio version. Backup files are not needed,
256 | # because we have git ;-)
257 | _UpgradeReport_Files/
258 | Backup*/
259 | UpgradeLog*.XML
260 | UpgradeLog*.htm
261 | ServiceFabricBackup/
262 | *.rptproj.bak
263 |
264 | # SQL Server files
265 | *.mdf
266 | *.ldf
267 | *.ndf
268 |
269 | # Business Intelligence projects
270 | *.rdl.data
271 | *.bim.layout
272 | *.bim_*.settings
273 | *.rptproj.rsuser
274 | *- [Bb]ackup.rdl
275 | *- [Bb]ackup ([0-9]).rdl
276 | *- [Bb]ackup ([0-9][0-9]).rdl
277 |
278 | # Microsoft Fakes
279 | FakesAssemblies/
280 |
281 | # GhostDoc plugin setting file
282 | *.GhostDoc.xml
283 |
284 | # Node.js Tools for Visual Studio
285 | .ntvs_analysis.dat
286 | node_modules/
287 |
288 | # Visual Studio 6 build log
289 | *.plg
290 |
291 | # Visual Studio 6 workspace options file
292 | *.opt
293 |
294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
295 | *.vbw
296 |
297 | # Visual Studio LightSwitch build output
298 | **/*.HTMLClient/GeneratedArtifacts
299 | **/*.DesktopClient/GeneratedArtifacts
300 | **/*.DesktopClient/ModelManifest.xml
301 | **/*.Server/GeneratedArtifacts
302 | **/*.Server/ModelManifest.xml
303 | _Pvt_Extensions
304 |
305 | # Paket dependency manager
306 | .paket/paket.exe
307 | paket-files/
308 |
309 | # FAKE - F# Make
310 | .fake/
311 |
312 | # CodeRush personal settings
313 | .cr/personal
314 |
315 | # Python Tools for Visual Studio (PTVS)
316 | __pycache__/
317 | *.pyc
318 |
319 | # Cake - Uncomment if you are using it
320 | # tools/**
321 | # !tools/packages.config
322 |
323 | # Tabs Studio
324 | *.tss
325 |
326 | # Telerik's JustMock configuration file
327 | *.jmconfig
328 |
329 | # BizTalk build output
330 | *.btp.cs
331 | *.btm.cs
332 | *.odx.cs
333 | *.xsd.cs
334 |
335 | # OpenCover UI analysis results
336 | OpenCover/
337 |
338 | # Azure Stream Analytics local run output
339 | ASALocalRun/
340 |
341 | # MSBuild Binary and Structured Log
342 | *.binlog
343 |
344 | # NVidia Nsight GPU debugger configuration file
345 | *.nvuser
346 |
347 | # MFractors (Xamarin productivity tool) working folder
348 | .mfractor/
349 |
350 | # Local History for Visual Studio
351 | .localhistory/
352 |
353 | # BeatPulse healthcheck temp database
354 | healthchecksdb
355 |
356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
357 | MigrationBackup/
358 |
359 | # Ionide (cross platform F# VS Code tools) working folder
360 | .ionide/
361 |
362 | # Fody - auto-generated XML schema
363 | FodyWeavers.xsd
364 |
--------------------------------------------------------------------------------
/src/MemoryCleaner.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Diagnostics;
4 | using System.Runtime.InteropServices;
5 | using System.Security.Principal;
6 |
7 | namespace OpenTimerResolution
8 | {
9 | public static class MemoryCleaner
10 | {
11 | #region Methods
12 |
13 | ///
14 | /// Clears the standby cache.
15 | ///
16 | internal static void ClearStandbyCache()
17 | {
18 | SetIncreasePrivilege("SeProfileSingleProcessPrivilege");
19 |
20 | int iSize = Marshal.SizeOf(ClearStandbyPageList);
21 |
22 | GCHandle gch = GCHandle.Alloc(ClearStandbyPageList, GCHandleType.Pinned);
23 | NtStatus result = NtSetSystemInformation(SysMemoryListInfo, gch.AddrOfPinnedObject(), iSize);
24 | gch.Free();
25 |
26 | if (result != NtStatus.SUCCESS)
27 | {
28 | MessageBox.Show(string.Concat("Error code: ", result.ToString()), "OpenTimerResolution", MessageBoxButtons.OK, MessageBoxIcon.Error);
29 | return;
30 | }
31 |
32 | cleanCounter++;
33 | }
34 |
35 | ///
36 | /// Returns the standby cache in MB.
37 | ///
38 | internal static long GetStandbyCache()
39 | {
40 | PERFORMANCE_INFORMATION pCounter = new();
41 |
42 | bool result = GetPerformanceInfo(out pCounter, Marshal.SizeOf(pCounter));
43 |
44 | if (result == true)
45 | return pCounter.SystemCache.ToInt64() * pCounter.PageSize.ToInt64() / 1048576L;
46 | else
47 | return 0;
48 | }
49 |
50 | ///
51 | /// Returns the total physical memory in MB.
52 | ///
53 | internal static long GetTotalMemory()
54 | {
55 | PERFORMANCE_INFORMATION pCounter = new();
56 |
57 | bool result = GetPerformanceInfo(out pCounter, Marshal.SizeOf(pCounter));
58 |
59 | if (result == true)
60 | return pCounter.PhysicalTotal.ToInt64() * pCounter.PageSize.ToInt64() / 1048576L;
61 | else
62 | return 0;
63 | }
64 |
65 | ///
66 | /// Returns the available physical memory in MB.
67 | ///
68 | internal static long GetAvailableMemory()
69 | {
70 | PERFORMANCE_INFORMATION pCounter = new();
71 |
72 | bool result = GetPerformanceInfo(out pCounter, Marshal.SizeOf(pCounter));
73 |
74 | if (result == true)
75 | return pCounter.PhysicalAvailable.ToInt64() * pCounter.PageSize.ToInt64() / 1048576L;
76 | else
77 | return 0;
78 | }
79 |
80 | ///
81 | /// Returns the free memory in MB.
82 | /// (Available physical memory subtracted by the standby cache memory)
83 | ///
84 | internal static long GetFreeMemory()
85 | {
86 | return GetAvailableMemory() - GetStandbyCache();
87 | }
88 |
89 | ///
90 | /// Function to increase the privilege of the process.
91 | ///
92 | /// The name of the privilege needed.
93 | private static bool SetIncreasePrivilege(string privilegeName)
94 | {
95 | using WindowsIdentity current = WindowsIdentity.GetCurrent(TokenAccessLevels.Query | TokenAccessLevels.AdjustPrivileges);
96 |
97 | TokPriv1Luid newst;
98 | newst.Count = 1;
99 | newst.Luid = 0L;
100 | newst.Attr = SE_PRIVILEGE_ENABLED;
101 |
102 | //Retrieves the LUID used on a specified system to locally represent the specified privilege name
103 | if (!LookupPrivilegeValue(null, privilegeName, ref newst.Luid))
104 | throw new Exception("Error in LookupPrivilegeValue: ", new Win32Exception(Marshal.GetLastWin32Error()));
105 |
106 | //Enables or disables privileges in a specified access token
107 | int num = AdjustTokenPrivileges(current.Token, false, ref newst, 0, IntPtr.Zero, IntPtr.Zero) ? 1 : 0;
108 | if (num == 0)
109 | throw new Exception("Error in AdjustTokenPrivileges: ", new Win32Exception(Marshal.GetLastWin32Error()));
110 | return num != 0;
111 | }
112 |
113 | #endregion
114 |
115 | #region Definitions
116 |
117 | ///
118 | /// The LookupPrivilegeValue function retrieves the locally unique identifier (LUID) used on a specified system to locally represent the specified privilege name.
119 | ///
120 | /// A pointer to a null-terminated string that specifies the name of the system on which the privilege name is retrieved.
121 | /// If a null string is specified, the function attempts to find the privilege name on the local system.
122 | /// A pointer to a null-terminated string that specifies the name of the privilege, as defined in the Winnt.h header file.
123 | /// For example, this parameter could specify the constant, SE_SECURITY_NAME, or its corresponding string, "SeSecurityPrivilege".
124 | /// A pointer to a variable that receives the LUID by which the privilege is known on the system specified by the "host" parameter.
125 | [DllImport("advapi32.dll", SetLastError = true)]
126 | private static extern bool LookupPrivilegeValue(string host, string name, ref long pluid);
127 |
128 | ///
129 | /// The AdjustTokenPrivileges function enables or disables privileges in the specified access token.
130 | ///
131 | /// A handle to the access token that contains the privileges to be modified. The handle must have TOKEN_ADJUST_PRIVILEGES access to the token.
132 | /// If the prevState parameter is not NULL, the handle must also have TOKEN_QUERY access.
133 | /// Specifies whether the function disables all of the token's privileges. If this value is TRUE, the function disables all privileges and ignores the newState parameter.
134 | /// If it is FALSE, the function modifies privileges based on the information pointed to by the newState parameter.
135 | /// A pointer to a TOKEN_PRIVILEGES structure that specifies an array of privileges and their attributes.
136 | /// If the disableAll parameter is FALSE, the AdjustTokenPrivileges function enables, disables, or removes these privileges for the token.
137 | /// The following table describes the action taken by the AdjustTokenPrivileges function, based on the privilege attribute.
138 | /// If disableAll is TRUE, the function ignores this parameter.
139 | /// Specifies the size, in bytes, of the buffer pointed to by the prevState parameter. This parameter can be zero if the prevState parameter is NULL.
140 | /// A pointer to a buffer that the function fills with a TOKEN_PRIVILEGES structure that contains the previous state of any privileges that the function modifies.
141 | /// That is, if a privilege has been modified by this function, the privilege and its previous state are contained in the TOKEN_PRIVILEGES structure referenced by prevState.
142 | /// If the PrivilegeCount member of TOKEN_PRIVILEGES is zero, then no privileges have been changed by this function. This parameter can be NULL.
143 | /// If you specify a buffer that is too small to receive the complete list of modified privileges, the function fails and does not adjust any privileges.
144 | /// In this case, the function sets the variable pointed to by the retLen parameter to the number of bytes required to hold the complete list of modified privileges.
145 | /// A pointer to a variable that receives the required size, in bytes, of the buffer pointed to by the prevState parameter.
146 | /// This parameter can be NULL if PreviousState is NULL.
147 | [DllImport("advapi32.dll", SetLastError = true)]
148 | private static extern bool AdjustTokenPrivileges(IntPtr tokenHandle, bool disableAll, ref TokPriv1Luid newState, int bufLen, IntPtr prevState, IntPtr retLen);
149 |
150 | [StructLayout(LayoutKind.Sequential, Pack = 1)]
151 | private struct TokPriv1Luid
152 | {
153 | internal int Count;
154 | internal long Luid;
155 | internal int Attr;
156 | }
157 |
158 | ///
159 | /// NtSetSystemInformation is used to set some unaccessable KernelMode variables. (There's not too much documentation about this function).
160 | ///
161 | /// Specifies what sort of information to set.
162 | /// A pointer to the buffer that provides the information.
163 | /// The size (in bytes) of the buffer that provides the information.
164 | [DllImport("ntdll.dll", SetLastError = true)]
165 | private static extern NtStatus NtSetSystemInformation(int SystemInfoClass, IntPtr SystemInfo, int SystemInfoLength);
166 |
167 | [StructLayout(LayoutKind.Sequential)]
168 | private struct PERFORMANCE_INFORMATION
169 | {
170 | internal int cb;
171 | internal IntPtr CommitTotal;
172 | internal IntPtr CommitLimit;
173 | internal IntPtr CommitPeak;
174 | internal IntPtr PhysicalTotal;
175 | internal IntPtr PhysicalAvailable;
176 | internal IntPtr SystemCache;
177 | internal IntPtr KernelTotal;
178 | internal IntPtr KernelPaged;
179 | internal IntPtr KernelNonpaged;
180 | internal IntPtr PageSize;
181 | internal int HandleCount;
182 | internal int ProcessCount;
183 | internal int ThreadCount;
184 | }
185 |
186 |
187 | ///
188 | /// GetPerformanceInfo retrieves the performance values contained in the PERFORMANCE_INFORMATION structure.
189 | ///
190 | /// A pointer to a PERFORMANCE_INFORMATION structure that receives the performance information.
191 | /// The size of the PERFORMANCE_INFORMATION structure, in bytes.
192 | [DllImport("psapi.dll", SetLastError = true)]
193 | private static extern bool GetPerformanceInfo(out PERFORMANCE_INFORMATION pPerformanceInformation, int cb);
194 |
195 | private const int SysMemoryListInfo = 80;
196 | private const int SE_PRIVILEGE_ENABLED = 2;
197 | private const int ClearStandbyPageList = 4;
198 | internal static long cleanCounter = 0;
199 |
200 | #endregion
201 | }
202 | }
203 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 2, June 1991
3 |
4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 | Everyone is permitted to copy and distribute verbatim copies
7 | of this license document, but changing it is not allowed.
8 |
9 | Preamble
10 |
11 | The licenses for most software are designed to take away your
12 | freedom to share and change it. By contrast, the GNU General Public
13 | License is intended to guarantee your freedom to share and change free
14 | software--to make sure the software is free for all its users. This
15 | General Public License applies to most of the Free Software
16 | Foundation's software and to any other program whose authors commit to
17 | using it. (Some other Free Software Foundation software is covered by
18 | the GNU Lesser General Public License instead.) You can apply it to
19 | your programs, too.
20 |
21 | When we speak of free software, we are referring to freedom, not
22 | price. Our General Public Licenses are designed to make sure that you
23 | have the freedom to distribute copies of free software (and charge for
24 | this service if you wish), that you receive source code or can get it
25 | if you want it, that you can change the software or use pieces of it
26 | in new free programs; and that you know you can do these things.
27 |
28 | To protect your rights, we need to make restrictions that forbid
29 | anyone to deny you these rights or to ask you to surrender the rights.
30 | These restrictions translate to certain responsibilities for you if you
31 | distribute copies of the software, or if you modify it.
32 |
33 | For example, if you distribute copies of such a program, whether
34 | gratis or for a fee, you must give the recipients all the rights that
35 | you have. You must make sure that they, too, receive or can get the
36 | source code. And you must show them these terms so they know their
37 | rights.
38 |
39 | We protect your rights with two steps: (1) copyright the software, and
40 | (2) offer you this license which gives you legal permission to copy,
41 | distribute and/or modify the software.
42 |
43 | Also, for each author's protection and ours, we want to make certain
44 | that everyone understands that there is no warranty for this free
45 | software. If the software is modified by someone else and passed on, we
46 | want its recipients to know that what they have is not the original, so
47 | that any problems introduced by others will not reflect on the original
48 | authors' reputations.
49 |
50 | Finally, any free program is threatened constantly by software
51 | patents. We wish to avoid the danger that redistributors of a free
52 | program will individually obtain patent licenses, in effect making the
53 | program proprietary. To prevent this, we have made it clear that any
54 | patent must be licensed for everyone's free use or not licensed at all.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | GNU GENERAL PUBLIC LICENSE
60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61 |
62 | 0. This License applies to any program or other work which contains
63 | a notice placed by the copyright holder saying it may be distributed
64 | under the terms of this General Public License. The "Program", below,
65 | refers to any such program or work, and a "work based on the Program"
66 | means either the Program or any derivative work under copyright law:
67 | that is to say, a work containing the Program or a portion of it,
68 | either verbatim or with modifications and/or translated into another
69 | language. (Hereinafter, translation is included without limitation in
70 | the term "modification".) Each licensee is addressed as "you".
71 |
72 | Activities other than copying, distribution and modification are not
73 | covered by this License; they are outside its scope. The act of
74 | running the Program is not restricted, and the output from the Program
75 | is covered only if its contents constitute a work based on the
76 | Program (independent of having been made by running the Program).
77 | Whether that is true depends on what the Program does.
78 |
79 | 1. You may copy and distribute verbatim copies of the Program's
80 | source code as you receive it, in any medium, provided that you
81 | conspicuously and appropriately publish on each copy an appropriate
82 | copyright notice and disclaimer of warranty; keep intact all the
83 | notices that refer to this License and to the absence of any warranty;
84 | and give any other recipients of the Program a copy of this License
85 | along with the Program.
86 |
87 | You may charge a fee for the physical act of transferring a copy, and
88 | you may at your option offer warranty protection in exchange for a fee.
89 |
90 | 2. You may modify your copy or copies of the Program or any portion
91 | of it, thus forming a work based on the Program, and copy and
92 | distribute such modifications or work under the terms of Section 1
93 | above, provided that you also meet all of these conditions:
94 |
95 | a) You must cause the modified files to carry prominent notices
96 | stating that you changed the files and the date of any change.
97 |
98 | b) You must cause any work that you distribute or publish, that in
99 | whole or in part contains or is derived from the Program or any
100 | part thereof, to be licensed as a whole at no charge to all third
101 | parties under the terms of this License.
102 |
103 | c) If the modified program normally reads commands interactively
104 | when run, you must cause it, when started running for such
105 | interactive use in the most ordinary way, to print or display an
106 | announcement including an appropriate copyright notice and a
107 | notice that there is no warranty (or else, saying that you provide
108 | a warranty) and that users may redistribute the program under
109 | these conditions, and telling the user how to view a copy of this
110 | License. (Exception: if the Program itself is interactive but
111 | does not normally print such an announcement, your work based on
112 | the Program is not required to print an announcement.)
113 |
114 | These requirements apply to the modified work as a whole. If
115 | identifiable sections of that work are not derived from the Program,
116 | and can be reasonably considered independent and separate works in
117 | themselves, then this License, and its terms, do not apply to those
118 | sections when you distribute them as separate works. But when you
119 | distribute the same sections as part of a whole which is a work based
120 | on the Program, the distribution of the whole must be on the terms of
121 | this License, whose permissions for other licensees extend to the
122 | entire whole, and thus to each and every part regardless of who wrote it.
123 |
124 | Thus, it is not the intent of this section to claim rights or contest
125 | your rights to work written entirely by you; rather, the intent is to
126 | exercise the right to control the distribution of derivative or
127 | collective works based on the Program.
128 |
129 | In addition, mere aggregation of another work not based on the Program
130 | with the Program (or with a work based on the Program) on a volume of
131 | a storage or distribution medium does not bring the other work under
132 | the scope of this License.
133 |
134 | 3. You may copy and distribute the Program (or a work based on it,
135 | under Section 2) in object code or executable form under the terms of
136 | Sections 1 and 2 above provided that you also do one of the following:
137 |
138 | a) Accompany it with the complete corresponding machine-readable
139 | source code, which must be distributed under the terms of Sections
140 | 1 and 2 above on a medium customarily used for software interchange; or,
141 |
142 | b) Accompany it with a written offer, valid for at least three
143 | years, to give any third party, for a charge no more than your
144 | cost of physically performing source distribution, a complete
145 | machine-readable copy of the corresponding source code, to be
146 | distributed under the terms of Sections 1 and 2 above on a medium
147 | customarily used for software interchange; or,
148 |
149 | c) Accompany it with the information you received as to the offer
150 | to distribute corresponding source code. (This alternative is
151 | allowed only for noncommercial distribution and only if you
152 | received the program in object code or executable form with such
153 | an offer, in accord with Subsection b above.)
154 |
155 | The source code for a work means the preferred form of the work for
156 | making modifications to it. For an executable work, complete source
157 | code means all the source code for all modules it contains, plus any
158 | associated interface definition files, plus the scripts used to
159 | control compilation and installation of the executable. However, as a
160 | special exception, the source code distributed need not include
161 | anything that is normally distributed (in either source or binary
162 | form) with the major components (compiler, kernel, and so on) of the
163 | operating system on which the executable runs, unless that component
164 | itself accompanies the executable.
165 |
166 | If distribution of executable or object code is made by offering
167 | access to copy from a designated place, then offering equivalent
168 | access to copy the source code from the same place counts as
169 | distribution of the source code, even though third parties are not
170 | compelled to copy the source along with the object code.
171 |
172 | 4. You may not copy, modify, sublicense, or distribute the Program
173 | except as expressly provided under this License. Any attempt
174 | otherwise to copy, modify, sublicense or distribute the Program is
175 | void, and will automatically terminate your rights under this License.
176 | However, parties who have received copies, or rights, from you under
177 | this License will not have their licenses terminated so long as such
178 | parties remain in full compliance.
179 |
180 | 5. You are not required to accept this License, since you have not
181 | signed it. However, nothing else grants you permission to modify or
182 | distribute the Program or its derivative works. These actions are
183 | prohibited by law if you do not accept this License. Therefore, by
184 | modifying or distributing the Program (or any work based on the
185 | Program), you indicate your acceptance of this License to do so, and
186 | all its terms and conditions for copying, distributing or modifying
187 | the Program or works based on it.
188 |
189 | 6. Each time you redistribute the Program (or any work based on the
190 | Program), the recipient automatically receives a license from the
191 | original licensor to copy, distribute or modify the Program subject to
192 | these terms and conditions. You may not impose any further
193 | restrictions on the recipients' exercise of the rights granted herein.
194 | You are not responsible for enforcing compliance by third parties to
195 | this License.
196 |
197 | 7. If, as a consequence of a court judgment or allegation of patent
198 | infringement or for any other reason (not limited to patent issues),
199 | conditions are imposed on you (whether by court order, agreement or
200 | otherwise) that contradict the conditions of this License, they do not
201 | excuse you from the conditions of this License. If you cannot
202 | distribute so as to satisfy simultaneously your obligations under this
203 | License and any other pertinent obligations, then as a consequence you
204 | may not distribute the Program at all. For example, if a patent
205 | license would not permit royalty-free redistribution of the Program by
206 | all those who receive copies directly or indirectly through you, then
207 | the only way you could satisfy both it and this License would be to
208 | refrain entirely from distribution of the Program.
209 |
210 | If any portion of this section is held invalid or unenforceable under
211 | any particular circumstance, the balance of the section is intended to
212 | apply and the section as a whole is intended to apply in other
213 | circumstances.
214 |
215 | It is not the purpose of this section to induce you to infringe any
216 | patents or other property right claims or to contest validity of any
217 | such claims; this section has the sole purpose of protecting the
218 | integrity of the free software distribution system, which is
219 | implemented by public license practices. Many people have made
220 | generous contributions to the wide range of software distributed
221 | through that system in reliance on consistent application of that
222 | system; it is up to the author/donor to decide if he or she is willing
223 | to distribute software through any other system and a licensee cannot
224 | impose that choice.
225 |
226 | This section is intended to make thoroughly clear what is believed to
227 | be a consequence of the rest of this License.
228 |
229 | 8. If the distribution and/or use of the Program is restricted in
230 | certain countries either by patents or by copyrighted interfaces, the
231 | original copyright holder who places the Program under this License
232 | may add an explicit geographical distribution limitation excluding
233 | those countries, so that distribution is permitted only in or among
234 | countries not thus excluded. In such case, this License incorporates
235 | the limitation as if written in the body of this License.
236 |
237 | 9. The Free Software Foundation may publish revised and/or new versions
238 | of the General Public License from time to time. Such new versions will
239 | be similar in spirit to the present version, but may differ in detail to
240 | address new problems or concerns.
241 |
242 | Each version is given a distinguishing version number. If the Program
243 | specifies a version number of this License which applies to it and "any
244 | later version", you have the option of following the terms and conditions
245 | either of that version or of any later version published by the Free
246 | Software Foundation. If the Program does not specify a version number of
247 | this License, you may choose any version ever published by the Free Software
248 | Foundation.
249 |
250 | 10. If you wish to incorporate parts of the Program into other free
251 | programs whose distribution conditions are different, write to the author
252 | to ask for permission. For software which is copyrighted by the Free
253 | Software Foundation, write to the Free Software Foundation; we sometimes
254 | make exceptions for this. Our decision will be guided by the two goals
255 | of preserving the free status of all derivatives of our free software and
256 | of promoting the sharing and reuse of software generally.
257 |
258 | NO WARRANTY
259 |
260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268 | REPAIR OR CORRECTION.
269 |
270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278 | POSSIBILITY OF SUCH DAMAGES.
279 |
280 | END OF TERMS AND CONDITIONS
281 |
282 | How to Apply These Terms to Your New Programs
283 |
284 | If you develop a new program, and you want it to be of the greatest
285 | possible use to the public, the best way to achieve this is to make it
286 | free software which everyone can redistribute and change under these terms.
287 |
288 | To do so, attach the following notices to the program. It is safest
289 | to attach them to the start of each source file to most effectively
290 | convey the exclusion of warranty; and each file should have at least
291 | the "copyright" line and a pointer to where the full notice is found.
292 |
293 |
294 | Copyright (C)
295 |
296 | This program is free software; you can redistribute it and/or modify
297 | it under the terms of the GNU General Public License as published by
298 | the Free Software Foundation; either version 2 of the License, or
299 | (at your option) any later version.
300 |
301 | This program is distributed in the hope that it will be useful,
302 | but WITHOUT ANY WARRANTY; without even the implied warranty of
303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 | GNU General Public License for more details.
305 |
306 | You should have received a copy of the GNU General Public License along
307 | with this program; if not, write to the Free Software Foundation, Inc.,
308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309 |
310 | Also add information on how to contact you by electronic and paper mail.
311 |
312 | If the program is interactive, make it output a short notice like this
313 | when it starts in an interactive mode:
314 |
315 | Gnomovision version 69, Copyright (C) year name of author
316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317 | This is free software, and you are welcome to redistribute it
318 | under certain conditions; type `show c' for details.
319 |
320 | The hypothetical commands `show w' and `show c' should show the appropriate
321 | parts of the General Public License. Of course, the commands you use may
322 | be called something other than `show w' and `show c'; they could even be
323 | mouse-clicks or menu items--whatever suits your program.
324 |
325 | You should also get your employer (if you work as a programmer) or your
326 | school, if any, to sign a "copyright disclaimer" for the program, if
327 | necessary. Here is a sample; alter the names:
328 |
329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330 | `Gnomovision' (which makes passes at compilers) written by James Hacker.
331 |
332 | , 1 April 1989
333 | Ty Coon, President of Vice
334 |
335 | This General Public License does not permit incorporating your program into
336 | proprietary programs. If your program is a subroutine library, you may
337 | consider it more useful to permit linking proprietary applications with the
338 | library. If this is what you want to do, use the GNU Lesser General
339 | Public License instead of this License.
340 |
--------------------------------------------------------------------------------
/src/MainWindow.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Win32.TaskScheduler;
2 | using Newtonsoft.Json.Linq;
3 | using System.Configuration;
4 | using System.Diagnostics;
5 | using System.Globalization;
6 | using System.Net.Http.Headers;
7 | using System.Net.Sockets;
8 | using System.Reflection;
9 | using System.Runtime.InteropServices;
10 | using System.Text;
11 | using System.Text.RegularExpressions;
12 | using Task = System.Threading.Tasks.Task;
13 |
14 | namespace OpenTimerResolution
15 | {
16 | public partial class MainWindow : Form
17 | {
18 | #region Definitions
19 |
20 | ///
21 | /// NtQueryTimerResolution returns the resolution of the system Timer in the context of the calling process.
22 | ///
23 | /// Minimum resolution defined by the system Timer.
24 | /// Maximum resolution defined by the system Timer.
25 | /// Actual current resolution set.
26 | [DllImport("ntdll.dll", SetLastError = true)]
27 | private static extern NtStatus NtQueryTimerResolution(out uint MinimumResolution, out uint MaximumResolution, out uint ActualResolution);
28 |
29 | ///
30 | /// NtSetTimerResolution sets the resolution of the system Timer in the calling process context.
31 | ///
32 | /// The desired resolution for the system Timer.
33 | /// Set to 'true' if setting a custom resolution, to 'false' if resetting to the default resolution.
34 | /// Current resolution set.
35 | [DllImport("ntdll.dll", SetLastError = true)]
36 | private static extern NtStatus NtSetTimerResolution(int DesiredResolution, bool SetResolution, out int CurrentResolution);
37 |
38 | private int NtCurrentResolution = 156250;
39 | private uint NtMinimumResolution = 0;
40 | private uint NtMaximumResolution = 0;
41 | private uint NtActualResolution = 0;
42 |
43 | private readonly static Version assemblyVersion = Assembly.GetEntryAssembly().GetName().Version;
44 | private readonly string programVersion = string.Join('.', assemblyVersion.Major, assemblyVersion.Minor, assemblyVersion.Build, assemblyVersion.Revision);
45 |
46 | private static Dictionary Logger = new();
47 |
48 | ///
49 | /// Receives the index of the Text Update Interval Combo Box, and returns the represented value.
50 | ///
51 | /// The index of the Text Update Interval Combo Box.
52 | /// Interval value for the timer.
53 | private static int GetIntervalFromIndex(int original)
54 | {
55 |
56 | return original switch
57 | {
58 | 0 => 1000,
59 | 1 => 500,
60 | 2 => 125,
61 | 3 => 50,
62 | _ => 1000,
63 | };
64 | }
65 |
66 | ///
67 | /// Receives a string and translates it to the index for the Text Update Interval Combo Box (in this case used for the config).
68 | ///
69 | /// The string needed to be translated.
70 | /// The index value for the Text Update Interval Combo Box.
71 | private static int GetIndexFromString(string text)
72 | {
73 |
74 | return text switch
75 | {
76 | "1000ms" => 0,
77 | "500ms" => 1,
78 | "125ms" => 2,
79 | "50ms" => 3,
80 | _ => 0,
81 | };
82 | }
83 |
84 | #endregion
85 |
86 |
87 | #region Methods
88 |
89 | public MainWindow()
90 | {
91 | InitializeComponent();
92 |
93 | using (TaskService ts = new())
94 | {
95 | installScheduleButton.Text = ts.RootFolder.AllTasks.Any(t => t.Name == "OpenTimerRes") ? "Remove start-up schedule" : "Install start-up schedule";
96 | }
97 |
98 | this.Text = string.Concat("OpenTimerResolution | ", programVersion);
99 |
100 | bool darkMode = false;
101 | bool purgeAutomatically = false;
102 | float desiredResolution = 0f;
103 | string textUpdateInterval = string.Empty;
104 |
105 | try
106 | {
107 | if (bool.TryParse(ConfigurationManager.AppSettings["DarkMode"], out darkMode))
108 | darkModeBox.Checked = darkMode;
109 |
110 | if (bool.TryParse(ConfigurationManager.AppSettings["StartPurgingAutomatically"], out purgeAutomatically))
111 | automaticCacheCleanBox.Checked = purgeAutomatically;
112 |
113 | float.TryParse(ConfigurationManager.AppSettings["DesiredResolution"], out desiredResolution);
114 |
115 | if (desiredResolution == 0f)
116 | desiredResolution = 0.50f;
117 |
118 | timerResolutionBox.Text = desiredResolution.ToString();
119 |
120 | textUpdateInterval = ConfigurationManager.AppSettings["TextUpdateInterval"];
121 |
122 | intervalComboBox.SelectedIndex = GetIndexFromString(textUpdateInterval);
123 | }
124 | catch
125 | {
126 | MessageBox.Show("Config is invalid, or something else went wrong!", "OpenTimerResolution", MessageBoxButtons.OK, MessageBoxIcon.Error);
127 | return;
128 | }
129 |
130 | #if !DEBUG
131 | CheckForUpdates();
132 | #endif
133 | }
134 |
135 | private static string GetRequest(string uri, bool jsonaccept)
136 | {
137 | HttpClient client = new()
138 | {
139 | BaseAddress = new(uri),
140 | Timeout = new(0, 0, 4)
141 | };
142 |
143 | if (jsonaccept)
144 | client.DefaultRequestHeaders
145 | .Accept
146 | .Add(new MediaTypeWithQualityHeaderValue("application/json"));
147 |
148 | string res = string.Empty;
149 |
150 | try
151 | {
152 | res = client.GetStringAsync(uri).Result;
153 | }
154 | catch (AggregateException ex)
155 | {
156 | ex.Handle(x =>
157 | {
158 | if (x is HttpRequestException || x is SocketException || x is TaskCanceledException)
159 | {
160 | return true;
161 | }
162 |
163 | return false;
164 | });
165 | }
166 |
167 | return res;
168 | }
169 |
170 | private void CheckForUpdates()
171 | {
172 | string json = GetRequest("https://github.com/TorniX0/OpenTimerResolution/releases/latest", true);
173 |
174 | if (json == string.Empty)
175 | return;
176 |
177 | var obj = JObject.Parse(json);
178 | string ver = obj["tag_name"].ToString();
179 | ver = ver.Substring(8, ver.Length - 8);
180 |
181 | if (ver != programVersion)
182 | {
183 | DialogResult res = MessageBox.Show("Found a new update! Would you like to install it?", "OpenTimerResolution", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
184 |
185 | switch (res)
186 | {
187 | case DialogResult.Yes:
188 |
189 | DialogResult type = MessageBox.Show("Framework dependent version?", "OpenTimerResolution", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
190 |
191 | string url = (type == DialogResult.Yes) ?
192 | $"https://github.com/TorniX0/OpenTimerResolution/releases/download/{obj["tag_name"]}/OpenTimerResolution.exe" :
193 | $"https://github.com/TorniX0/OpenTimerResolution/releases/download/{obj["tag_name"]}/OpenTimerResolution_s.exe";
194 |
195 | UpdateProgram(new Uri(url));
196 | break;
197 | case DialogResult.No:
198 | break;
199 | }
200 | }
201 | }
202 |
203 | private void UpdateProgram(Uri url)
204 | {
205 | FileInfo file = new(Application.ExecutablePath);
206 | var oldFile = file.DirectoryName + "\\" + file.Name.Replace(file.Extension, ".old");
207 | File.Move(file.FullName, oldFile);
208 |
209 | var task = Task.Run(async () => await Utilities.DownloadAsync(url, file.FullName));
210 | task.ContinueWith(x =>
211 | {
212 | Process.Start(new ProcessStartInfo("cmd", $"/c taskkill /f /im {file.Name} && start {file.FullName} && takeown.exe /f \"{oldFile}\" && del \"{oldFile}\" /f /q") { CreateNoWindow = true, Verb = "runas" });
213 | });
214 |
215 | updateText.Visible = true;
216 | timerResolutionBox.ReadOnly = true;
217 | timerResolutionBox.Enabled = false;
218 | startButton.Enabled = false;
219 | purgeCacheButton.Enabled = false;
220 | updateConfigButton.Enabled = false;
221 | darkModeBox.Enabled = false;
222 | automaticCacheCleanBox.Enabled = false;
223 | intervalComboBox.Enabled = false;
224 | installScheduleButton.Enabled = false;
225 | logButton.Enabled = false;
226 | stopButton.Enabled = false;
227 | }
228 |
229 | private void timerResolutionBox_TextChanged(object sender, EventArgs e)
230 | {
231 | if (timerResolutionBox.Text != string.Empty && timerResolutionBox.Text.Last() != '.')
232 | {
233 | warningLabel.Visible = float.Parse(timerResolutionBox.Text) > 15.6250f;
234 | }
235 | }
236 |
237 |
238 | private void timerResolutionBox_KeyPress(object sender, KeyPressEventArgs e)
239 | {
240 | if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && (e.KeyChar != '.'))
241 | {
242 | e.Handled = true;
243 | return;
244 | }
245 |
246 | if ((e.KeyChar == '.') && (timerResolutionBox.Text.IndexOf('.') > -1))
247 | {
248 | e.Handled = true;
249 | return;
250 | }
251 | }
252 |
253 |
254 | private void intervalComboBox_SelectedIndexChanged(object sender, EventArgs e)
255 | {
256 | textChanger.Interval = GetIntervalFromIndex(intervalComboBox.SelectedIndex); // Changing the interval on index change.
257 | automaticMemoryPurger.Interval = GetIntervalFromIndex(intervalComboBox.SelectedIndex); // Also linked the automatic memory purger to it.
258 | }
259 |
260 |
261 | private void startButton_Click(object sender, EventArgs e)
262 | {
263 | if (timerResolutionBox.Text == string.Empty)
264 | return;
265 |
266 | var result = NtSetTimerResolution((int)(float.Parse(timerResolutionBox.Text) * 10000f), true, out NtCurrentResolution);
267 |
268 | if (result != NtStatus.SUCCESS)
269 | {
270 | MessageBox.Show(string.Concat("Error code: ", result.ToString()), "OpenTimerResolution", MessageBoxButtons.OK, MessageBoxIcon.Error);
271 | return;
272 | }
273 |
274 | timerResolutionBox.ReadOnly = true;
275 | timerResolutionBox.Enabled = false;
276 | startButton.Enabled = false;
277 | stopButton.Enabled = true;
278 | }
279 |
280 |
281 | private void stopButton_Click(object sender, EventArgs e)
282 | {
283 | if (timerResolutionBox.Text == string.Empty)
284 | return;
285 |
286 | var result = NtSetTimerResolution((int)(float.Parse(timerResolutionBox.Text) * 10000f), false, out NtCurrentResolution);
287 |
288 | if (result != NtStatus.SUCCESS)
289 | {
290 | MessageBox.Show(string.Concat("Error code: ", result.ToString()), "OpenTimerResolution", MessageBoxButtons.OK, MessageBoxIcon.Error);
291 | return;
292 | }
293 |
294 | timerResolutionBox.ReadOnly = false;
295 | timerResolutionBox.Enabled = true;
296 | startButton.Enabled = true;
297 | stopButton.Enabled = false;
298 | }
299 |
300 | private void textChanger_Tick(object sender, EventArgs e)
301 | {
302 | if (!timerLogger.Enabled)
303 | NtQueryTimerResolution(out NtMinimumResolution, out NtMaximumResolution, out NtActualResolution);
304 |
305 | // Timer Resolution labels
306 | currentResolutionLabel.Text = string.Concat("Current Resolution: ", (NtActualResolution * 0.0001f).ToString("N4"), "ms");
307 | minimumResolutionLabel.Text = string.Concat("Minimum Resolution: ", (NtMinimumResolution * 0.0001f).ToString("N4"), "ms");
308 | maximumResolutionLabel.Text = string.Concat("Maximum Resolution: ", (NtMaximumResolution * 0.0001f).ToString("N4") ,"ms");
309 |
310 | // Memory Cleaner labels
311 | totalSystemMemoryText.Text = string.Concat("Total system memory: ", MemoryCleaner.GetTotalMemory().ToString(), " MB");
312 | freeMemoryText.Text = string.Concat("Free memory: ", MemoryCleaner.GetFreeMemory().ToString(), " MB");
313 | cacheSizeText.Text = string.Concat("Cache size: ", MemoryCleaner.GetStandbyCache().ToString(), " MB");
314 | totalTimesCleanText.Text = string.Concat("Total times cleaned: ", MemoryCleaner.cleanCounter.ToString(), " time(s)");
315 | }
316 |
317 | private void MainWindow_Resize(object sender, EventArgs e)
318 | {
319 | if (this.WindowState == FormWindowState.Minimized)
320 | {
321 | minimizeIcon.Visible = true;
322 | this.ShowInTaskbar = false;
323 | this.Hide();
324 | this.SendToBack();
325 | }
326 | }
327 |
328 | private void minimizeIcon_MouseClick(object sender, MouseEventArgs e)
329 | {
330 | minimizeIcon.Visible = false;
331 | this.ShowInTaskbar = true;
332 | this.Show();
333 | this.BringToFront();
334 | this.WindowState = FormWindowState.Normal;
335 | }
336 |
337 | private void quitStripMenu_Click(object sender, EventArgs e)
338 | {
339 | this.Close();
340 | }
341 |
342 | private void installScheduleButton_Click(object sender, EventArgs e)
343 | {
344 | using TaskService ts = new();
345 |
346 | if (ts.RootFolder.AllTasks.Any(t => t.Name == "OpenTimerRes")) ts.RootFolder.DeleteTask("OpenTimerRes");
347 | else
348 | {
349 | TaskDefinition td = ts.NewTask();
350 |
351 | td.RegistrationInfo.Description = "Opens OpenTimerResolution at startup.";
352 |
353 | td.Principal.RunLevel = TaskRunLevel.Highest;
354 |
355 | td.Triggers.Add(new LogonTrigger());
356 |
357 | td.Actions.Add(new ExecAction(string.Concat("\"", Application.ExecutablePath, "\""), "-minimized"));
358 |
359 | td.Settings.StopIfGoingOnBatteries = false;
360 | td.Settings.DisallowStartIfOnBatteries = false;
361 | td.Settings.RunOnlyIfNetworkAvailable = false;
362 | td.Settings.RunOnlyIfIdle = false;
363 | td.Settings.Enabled = true;
364 |
365 | ts.RootFolder.RegisterTaskDefinition("OpenTimerRes", td);
366 | }
367 |
368 | installScheduleButton.Text = ts.RootFolder.AllTasks.Any(t => t.Name == "OpenTimerRes") ? "Remove start-up schedule" : "Install start-up schedule";
369 | }
370 |
371 | private void MainWindow_Load(object sender, EventArgs e)
372 | {
373 | if (Program.startMinimized)
374 | {
375 | var result = NtSetTimerResolution((int)(float.Parse(timerResolutionBox.Text) * 10000f), true, out NtCurrentResolution);
376 |
377 | if (result != NtStatus.SUCCESS)
378 | MessageBox.Show(string.Concat("Error code: ", result.ToString()), "OpenTimerResolution", MessageBoxButtons.OK, MessageBoxIcon.Error);
379 |
380 | timerResolutionBox.ReadOnly = true;
381 | timerResolutionBox.Enabled = false;
382 | startButton.Enabled = false;
383 | stopButton.Enabled = true;
384 |
385 | this.ShowInTaskbar = false;
386 | minimizeIcon.Visible = true;
387 | this.Hide();
388 | this.SendToBack();
389 | }
390 |
391 | using (TaskService ts = new())
392 | {
393 | if (Program.silentInstall && !ts.RootFolder.AllTasks.Any(t => t.Name == "OpenTimerRes"))
394 | installScheduleButton_Click(installScheduleButton, EventArgs.Empty);
395 | }
396 | }
397 |
398 | private void logButton_Click(object sender, EventArgs e)
399 | {
400 | if (!timerLogger.Enabled)
401 | {
402 | timerLogger.Start();
403 | logButton.Text = "Stop logging";
404 | logButton.ForeColor = Color.Red;
405 | }
406 | else
407 | {
408 | timerLogger.Stop();
409 |
410 | StringBuilder final = new();
411 |
412 | final.AppendLine(string.Concat("- Note: updated once every ", timerLogger.Interval.ToString(), "ms.", Environment.NewLine));
413 |
414 | foreach (var pair in Logger)
415 | {
416 | final.AppendLine(string.Concat(pair.Key, "ms - ", pair.Value.ToString(), " time(s)"));
417 | }
418 |
419 | SaveFileDialog saveFileDiag = new();
420 | saveFileDiag.InitialDirectory = Application.ExecutablePath;
421 | saveFileDiag.FileName = Regex.Replace($"OTR-{DateTime.Now}.log", "[\\/:*?\"<>|]", "-").Replace(" ", "_");
422 | saveFileDiag.Title = "Choose where to save log file...";
423 | saveFileDiag.DefaultExt = "log";
424 | saveFileDiag.Filter = "log files (*.log)|*.log";
425 | saveFileDiag.CheckPathExists = true;
426 | saveFileDiag.CheckFileExists = false;
427 |
428 | var result = saveFileDiag.ShowDialog();
429 |
430 | logButton.Text = "Start logging actual resolution";
431 | logButton.ForeColor = this.ForeColor;
432 |
433 | if (result != DialogResult.OK)
434 | {
435 | MessageBox.Show("Cancelled log saving.", "OpenTimerResolution", MessageBoxButtons.OK, MessageBoxIcon.Information);
436 | return;
437 | }
438 |
439 | File.WriteAllText(saveFileDiag.FileName, final.ToString());
440 |
441 | MessageBox.Show(string.Concat("Saved log file in ", saveFileDiag.FileName, "!"), "OpenTimerResolution", MessageBoxButtons.OK, MessageBoxIcon.Information);
442 | }
443 | }
444 |
445 | private void timerLogger_Tick(object sender, EventArgs e)
446 | {
447 | NtQueryTimerResolution(out NtMinimumResolution, out NtMaximumResolution, out NtActualResolution);
448 |
449 | Logger.TryGetValue((NtActualResolution * 0.0001f).ToString("N4"), out var count);
450 | Logger[(NtActualResolution * 0.0001f).ToString("N4")] = count + 1;
451 | }
452 |
453 | private void darkModeBox_CheckedChanged(object sender, EventArgs e)
454 | {
455 | if (darkModeBox.Checked)
456 | {
457 | this.BackColor = Color.FromArgb(255, 15, 15, 15);
458 | this.ForeColor = Color.White;
459 | UpdateUI();
460 | }
461 | else
462 | {
463 | this.BackColor = Color.White;
464 | this.ForeColor = SystemColors.ControlText;
465 | UpdateUI();
466 | }
467 | }
468 |
469 | private void UpdateUI()
470 | {
471 | for (int i = 0; i < this.Controls.Count; i++)
472 | {
473 | if (this.Controls[i] == creatorLabel || this.Controls[i] == warningLabel) continue;
474 |
475 | this.Controls[i].ForeColor = this.ForeColor;
476 | this.Controls[i].BackColor = this.BackColor;
477 | }
478 | }
479 |
480 | private void automaticCacheCleanBox_CheckedChanged(object sender, EventArgs e)
481 | {
482 | if (automaticCacheCleanBox.Checked)
483 | automaticMemoryPurger.Start();
484 | else
485 | automaticMemoryPurger.Stop();
486 | }
487 |
488 | private void purgeCacheButton_Click(object sender, EventArgs e)
489 | {
490 | MemoryCleaner.ClearStandbyCache();
491 | }
492 |
493 | private void automaticMemoryPurger_Tick(object sender, EventArgs e)
494 | {
495 | if (MemoryCleaner.GetStandbyCache() >= 2048 && MemoryCleaner.GetFreeMemory() < (MemoryCleaner.GetTotalMemory() / 2))
496 | MemoryCleaner.ClearStandbyCache();
497 | else
498 | return;
499 | }
500 |
501 | private void updateConfigButton_Click(object sender, EventArgs e)
502 | {
503 | Configuration customConfig = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
504 |
505 | AppSettingsSection appSettings = customConfig.GetSection("appSettings") as AppSettingsSection;
506 |
507 | appSettings.Settings["DarkMode"].Value = darkModeBox.Checked.ToString();
508 | appSettings.Settings["StartPurgingAutomatically"].Value = automaticCacheCleanBox.Checked.ToString();
509 | appSettings.Settings["DesiredResolution"].Value = timerResolutionBox.Text;
510 | appSettings.Settings["TextUpdateInterval"].Value = intervalComboBox.Text;
511 |
512 | customConfig.Save();
513 |
514 |
515 | MessageBox.Show("Config was updated successfully!", "OpenTimerResolution", MessageBoxButtons.OK, MessageBoxIcon.Information);
516 | }
517 |
518 | #endregion
519 | }
520 | }
521 |
--------------------------------------------------------------------------------
/src/MainWindow.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace OpenTimerResolution
2 | {
3 | partial class MainWindow
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.components = new System.ComponentModel.Container();
32 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainWindow));
33 | this.startButton = new System.Windows.Forms.Button();
34 | this.stopButton = new System.Windows.Forms.Button();
35 | this.currentResolutionLabel = new System.Windows.Forms.Label();
36 | this.minimumResolutionLabel = new System.Windows.Forms.Label();
37 | this.maximumResolutionLabel = new System.Windows.Forms.Label();
38 | this.textChanger = new System.Windows.Forms.Timer(this.components);
39 | this.wantedResolutionLabel = new System.Windows.Forms.Label();
40 | this.timerResolutionBox = new System.Windows.Forms.TextBox();
41 | this.warningLabel = new System.Windows.Forms.Label();
42 | this.intervalComboBox = new System.Windows.Forms.ComboBox();
43 | this.textIntervalLabel = new System.Windows.Forms.Label();
44 | this.minimizeIcon = new System.Windows.Forms.NotifyIcon(this.components);
45 | this.minimizeIconContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
46 | this.quitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
47 | this.creatorLabel = new System.Windows.Forms.Label();
48 | this.installScheduleButton = new System.Windows.Forms.Button();
49 | this.logButton = new System.Windows.Forms.Button();
50 | this.timerLogger = new System.Windows.Forms.Timer(this.components);
51 | this.darkModeBox = new System.Windows.Forms.CheckBox();
52 | this.purgeCacheButton = new System.Windows.Forms.Button();
53 | this.freeMemoryText = new System.Windows.Forms.Label();
54 | this.cacheSizeText = new System.Windows.Forms.Label();
55 | this.totalSystemMemoryText = new System.Windows.Forms.Label();
56 | this.automaticCacheCleanBox = new System.Windows.Forms.CheckBox();
57 | this.totalTimesCleanText = new System.Windows.Forms.Label();
58 | this.automaticMemoryPurger = new System.Windows.Forms.Timer(this.components);
59 | this.updateConfigButton = new System.Windows.Forms.Button();
60 | this.updateText = new System.Windows.Forms.Label();
61 | this.minimizeIconContextMenu.SuspendLayout();
62 | this.SuspendLayout();
63 | //
64 | // startButton
65 | //
66 | this.startButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
67 | this.startButton.Location = new System.Drawing.Point(62, 159);
68 | this.startButton.Name = "startButton";
69 | this.startButton.Size = new System.Drawing.Size(75, 23);
70 | this.startButton.TabIndex = 0;
71 | this.startButton.Text = "Start";
72 | this.startButton.UseVisualStyleBackColor = true;
73 | this.startButton.Click += new System.EventHandler(this.startButton_Click);
74 | //
75 | // stopButton
76 | //
77 | this.stopButton.Enabled = false;
78 | this.stopButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
79 | this.stopButton.Location = new System.Drawing.Point(178, 159);
80 | this.stopButton.Name = "stopButton";
81 | this.stopButton.Size = new System.Drawing.Size(75, 23);
82 | this.stopButton.TabIndex = 1;
83 | this.stopButton.Text = "Stop";
84 | this.stopButton.UseVisualStyleBackColor = false;
85 | this.stopButton.Click += new System.EventHandler(this.stopButton_Click);
86 | //
87 | // currentResolutionLabel
88 | //
89 | this.currentResolutionLabel.AutoSize = true;
90 | this.currentResolutionLabel.BackColor = System.Drawing.Color.Transparent;
91 | this.currentResolutionLabel.Location = new System.Drawing.Point(62, 9);
92 | this.currentResolutionLabel.Name = "currentResolutionLabel";
93 | this.currentResolutionLabel.Size = new System.Drawing.Size(109, 15);
94 | this.currentResolutionLabel.TabIndex = 2;
95 | this.currentResolutionLabel.Text = "Current Resolution:";
96 | //
97 | // minimumResolutionLabel
98 | //
99 | this.minimumResolutionLabel.AutoSize = true;
100 | this.minimumResolutionLabel.BackColor = System.Drawing.Color.Transparent;
101 | this.minimumResolutionLabel.Location = new System.Drawing.Point(62, 37);
102 | this.minimumResolutionLabel.Name = "minimumResolutionLabel";
103 | this.minimumResolutionLabel.Size = new System.Drawing.Size(122, 15);
104 | this.minimumResolutionLabel.TabIndex = 3;
105 | this.minimumResolutionLabel.Text = "Minimum Resolution:";
106 | //
107 | // maximumResolutionLabel
108 | //
109 | this.maximumResolutionLabel.AutoSize = true;
110 | this.maximumResolutionLabel.BackColor = System.Drawing.Color.Transparent;
111 | this.maximumResolutionLabel.Location = new System.Drawing.Point(62, 66);
112 | this.maximumResolutionLabel.Name = "maximumResolutionLabel";
113 | this.maximumResolutionLabel.Size = new System.Drawing.Size(124, 15);
114 | this.maximumResolutionLabel.TabIndex = 4;
115 | this.maximumResolutionLabel.Text = "Maximum Resolution:";
116 | //
117 | // textChanger
118 | //
119 | this.textChanger.Enabled = true;
120 | this.textChanger.Interval = 1000;
121 | this.textChanger.Tick += new System.EventHandler(this.textChanger_Tick);
122 | //
123 | // wantedResolutionLabel
124 | //
125 | this.wantedResolutionLabel.AutoSize = true;
126 | this.wantedResolutionLabel.BackColor = System.Drawing.Color.Transparent;
127 | this.wantedResolutionLabel.Location = new System.Drawing.Point(68, 95);
128 | this.wantedResolutionLabel.Name = "wantedResolutionLabel";
129 | this.wantedResolutionLabel.Size = new System.Drawing.Size(110, 15);
130 | this.wantedResolutionLabel.TabIndex = 5;
131 | this.wantedResolutionLabel.Text = "Wanted Resolution:";
132 | //
133 | // timerResolutionBox
134 | //
135 | this.timerResolutionBox.BackColor = System.Drawing.Color.White;
136 | this.timerResolutionBox.ForeColor = System.Drawing.SystemColors.ControlText;
137 | this.timerResolutionBox.Location = new System.Drawing.Point(185, 92);
138 | this.timerResolutionBox.MaxLength = 7;
139 | this.timerResolutionBox.Name = "timerResolutionBox";
140 | this.timerResolutionBox.ShortcutsEnabled = false;
141 | this.timerResolutionBox.Size = new System.Drawing.Size(60, 23);
142 | this.timerResolutionBox.TabIndex = 6;
143 | this.timerResolutionBox.TextChanged += new System.EventHandler(this.timerResolutionBox_TextChanged);
144 | this.timerResolutionBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.timerResolutionBox_KeyPress);
145 | //
146 | // warningLabel
147 | //
148 | this.warningLabel.AutoSize = true;
149 | this.warningLabel.BackColor = System.Drawing.Color.Transparent;
150 | this.warningLabel.ForeColor = System.Drawing.Color.Red;
151 | this.warningLabel.Location = new System.Drawing.Point(23, 124);
152 | this.warningLabel.Name = "warningLabel";
153 | this.warningLabel.Size = new System.Drawing.Size(289, 30);
154 | this.warningLabel.TabIndex = 7;
155 | this.warningLabel.Text = "WARNING! YOU SHOULDN\'T USE THIS VALUE!\r\nUSE 0.50 IF YOU DON\'T KNOW WHAT YOU\'RE DO" +
156 | "ING!";
157 | this.warningLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
158 | this.warningLabel.Visible = false;
159 | //
160 | // intervalComboBox
161 | //
162 | this.intervalComboBox.BackColor = System.Drawing.Color.White;
163 | this.intervalComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
164 | this.intervalComboBox.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
165 | this.intervalComboBox.FormattingEnabled = true;
166 | this.intervalComboBox.Items.AddRange(new object[] {
167 | "1000ms",
168 | "500ms",
169 | "125ms",
170 | "50ms"});
171 | this.intervalComboBox.Location = new System.Drawing.Point(164, 202);
172 | this.intervalComboBox.Name = "intervalComboBox";
173 | this.intervalComboBox.Size = new System.Drawing.Size(121, 23);
174 | this.intervalComboBox.TabIndex = 8;
175 | this.intervalComboBox.SelectedIndexChanged += new System.EventHandler(this.intervalComboBox_SelectedIndexChanged);
176 | //
177 | // textIntervalLabel
178 | //
179 | this.textIntervalLabel.AutoSize = true;
180 | this.textIntervalLabel.Location = new System.Drawing.Point(41, 205);
181 | this.textIntervalLabel.Name = "textIntervalLabel";
182 | this.textIntervalLabel.Size = new System.Drawing.Size(114, 15);
183 | this.textIntervalLabel.TabIndex = 9;
184 | this.textIntervalLabel.Text = "Text Update Interval:";
185 | //
186 | // minimizeIcon
187 | //
188 | this.minimizeIcon.ContextMenuStrip = this.minimizeIconContextMenu;
189 | this.minimizeIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("minimizeIcon.Icon")));
190 | this.minimizeIcon.Text = "OpenTimerResolution";
191 | this.minimizeIcon.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.minimizeIcon_MouseClick);
192 | //
193 | // minimizeIconContextMenu
194 | //
195 | this.minimizeIconContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
196 | this.quitToolStripMenuItem});
197 | this.minimizeIconContextMenu.Name = "minimizeIconContextMenu";
198 | this.minimizeIconContextMenu.Size = new System.Drawing.Size(98, 26);
199 | this.minimizeIconContextMenu.Text = "OpenTimerResolution";
200 | //
201 | // quitToolStripMenuItem
202 | //
203 | this.quitToolStripMenuItem.Name = "quitToolStripMenuItem";
204 | this.quitToolStripMenuItem.Size = new System.Drawing.Size(97, 22);
205 | this.quitToolStripMenuItem.Text = "Quit";
206 | this.quitToolStripMenuItem.Click += new System.EventHandler(this.quitStripMenu_Click);
207 | //
208 | // creatorLabel
209 | //
210 | this.creatorLabel.AutoSize = true;
211 | this.creatorLabel.BackColor = System.Drawing.Color.Transparent;
212 | this.creatorLabel.ForeColor = System.Drawing.Color.Gray;
213 | this.creatorLabel.Location = new System.Drawing.Point(725, 3);
214 | this.creatorLabel.Name = "creatorLabel";
215 | this.creatorLabel.Size = new System.Drawing.Size(54, 15);
216 | this.creatorLabel.TabIndex = 10;
217 | this.creatorLabel.Text = "© TorniX";
218 | //
219 | // installScheduleButton
220 | //
221 | this.installScheduleButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
222 | this.installScheduleButton.Location = new System.Drawing.Point(23, 240);
223 | this.installScheduleButton.Name = "installScheduleButton";
224 | this.installScheduleButton.Size = new System.Drawing.Size(289, 23);
225 | this.installScheduleButton.TabIndex = 11;
226 | this.installScheduleButton.Text = "Install start-up schedule";
227 | this.installScheduleButton.UseVisualStyleBackColor = true;
228 | this.installScheduleButton.Click += new System.EventHandler(this.installScheduleButton_Click);
229 | //
230 | // logButton
231 | //
232 | this.logButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
233 | this.logButton.Location = new System.Drawing.Point(23, 269);
234 | this.logButton.Name = "logButton";
235 | this.logButton.Size = new System.Drawing.Size(289, 26);
236 | this.logButton.TabIndex = 12;
237 | this.logButton.Text = "Start logging actual resolution";
238 | this.logButton.UseVisualStyleBackColor = false;
239 | this.logButton.Click += new System.EventHandler(this.logButton_Click);
240 | //
241 | // timerLogger
242 | //
243 | this.timerLogger.Interval = 300;
244 | this.timerLogger.Tick += new System.EventHandler(this.timerLogger_Tick);
245 | //
246 | // darkModeBox
247 | //
248 | this.darkModeBox.AutoSize = true;
249 | this.darkModeBox.Location = new System.Drawing.Point(23, 301);
250 | this.darkModeBox.Name = "darkModeBox";
251 | this.darkModeBox.Size = new System.Drawing.Size(84, 19);
252 | this.darkModeBox.TabIndex = 13;
253 | this.darkModeBox.Text = "Dark Mode";
254 | this.darkModeBox.UseVisualStyleBackColor = true;
255 | this.darkModeBox.CheckedChanged += new System.EventHandler(this.darkModeBox_CheckedChanged);
256 | //
257 | // purgeCacheButton
258 | //
259 | this.purgeCacheButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
260 | this.purgeCacheButton.Location = new System.Drawing.Point(479, 170);
261 | this.purgeCacheButton.Name = "purgeCacheButton";
262 | this.purgeCacheButton.Size = new System.Drawing.Size(170, 25);
263 | this.purgeCacheButton.TabIndex = 14;
264 | this.purgeCacheButton.Text = "Purge memory cache";
265 | this.purgeCacheButton.UseVisualStyleBackColor = true;
266 | this.purgeCacheButton.Click += new System.EventHandler(this.purgeCacheButton_Click);
267 | //
268 | // freeMemoryText
269 | //
270 | this.freeMemoryText.AutoSize = true;
271 | this.freeMemoryText.BackColor = System.Drawing.Color.Transparent;
272 | this.freeMemoryText.Location = new System.Drawing.Point(393, 106);
273 | this.freeMemoryText.Name = "freeMemoryText";
274 | this.freeMemoryText.Size = new System.Drawing.Size(80, 15);
275 | this.freeMemoryText.TabIndex = 17;
276 | this.freeMemoryText.Text = "Free memory:";
277 | //
278 | // cacheSizeText
279 | //
280 | this.cacheSizeText.AutoSize = true;
281 | this.cacheSizeText.BackColor = System.Drawing.Color.Transparent;
282 | this.cacheSizeText.Location = new System.Drawing.Point(393, 78);
283 | this.cacheSizeText.Name = "cacheSizeText";
284 | this.cacheSizeText.Size = new System.Drawing.Size(65, 15);
285 | this.cacheSizeText.TabIndex = 16;
286 | this.cacheSizeText.Text = "Cache size:";
287 | //
288 | // totalSystemMemoryText
289 | //
290 | this.totalSystemMemoryText.AutoSize = true;
291 | this.totalSystemMemoryText.BackColor = System.Drawing.Color.Transparent;
292 | this.totalSystemMemoryText.Location = new System.Drawing.Point(393, 50);
293 | this.totalSystemMemoryText.Name = "totalSystemMemoryText";
294 | this.totalSystemMemoryText.Size = new System.Drawing.Size(123, 15);
295 | this.totalSystemMemoryText.TabIndex = 15;
296 | this.totalSystemMemoryText.Text = "Total system memory:";
297 | //
298 | // automaticCacheCleanBox
299 | //
300 | this.automaticCacheCleanBox.AutoSize = true;
301 | this.automaticCacheCleanBox.Location = new System.Drawing.Point(522, 199);
302 | this.automaticCacheCleanBox.Name = "automaticCacheCleanBox";
303 | this.automaticCacheCleanBox.Size = new System.Drawing.Size(82, 19);
304 | this.automaticCacheCleanBox.TabIndex = 18;
305 | this.automaticCacheCleanBox.Text = "Automatic";
306 | this.automaticCacheCleanBox.UseVisualStyleBackColor = true;
307 | this.automaticCacheCleanBox.CheckedChanged += new System.EventHandler(this.automaticCacheCleanBox_CheckedChanged);
308 | //
309 | // totalTimesCleanText
310 | //
311 | this.totalTimesCleanText.AutoSize = true;
312 | this.totalTimesCleanText.BackColor = System.Drawing.Color.Transparent;
313 | this.totalTimesCleanText.Location = new System.Drawing.Point(393, 133);
314 | this.totalTimesCleanText.Name = "totalTimesCleanText";
315 | this.totalTimesCleanText.Size = new System.Drawing.Size(111, 15);
316 | this.totalTimesCleanText.TabIndex = 19;
317 | this.totalTimesCleanText.Text = "Total times cleaned:";
318 | //
319 | // automaticMemoryPurger
320 | //
321 | this.automaticMemoryPurger.Interval = 1000;
322 | this.automaticMemoryPurger.Tick += new System.EventHandler(this.automaticMemoryPurger_Tick);
323 | //
324 | // updateConfigButton
325 | //
326 | this.updateConfigButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
327 | this.updateConfigButton.Location = new System.Drawing.Point(674, 297);
328 | this.updateConfigButton.Name = "updateConfigButton";
329 | this.updateConfigButton.Size = new System.Drawing.Size(105, 29);
330 | this.updateConfigButton.TabIndex = 20;
331 | this.updateConfigButton.Text = "Update config";
332 | this.updateConfigButton.UseVisualStyleBackColor = true;
333 | this.updateConfigButton.Click += new System.EventHandler(this.updateConfigButton_Click);
334 | //
335 | // updateText
336 | //
337 | this.updateText.AutoSize = true;
338 | this.updateText.Font = new System.Drawing.Font("Segoe UI", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
339 | this.updateText.Location = new System.Drawing.Point(324, 241);
340 | this.updateText.Name = "updateText";
341 | this.updateText.Size = new System.Drawing.Size(339, 80);
342 | this.updateText.TabIndex = 21;
343 | this.updateText.Text = "Updating... (be patient)\r\n(do not close)";
344 | this.updateText.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
345 | this.updateText.Visible = false;
346 | //
347 | // MainWindow
348 | //
349 | this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
350 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
351 | this.BackColor = System.Drawing.Color.White;
352 | this.ClientSize = new System.Drawing.Size(783, 330);
353 | this.Controls.Add(this.updateText);
354 | this.Controls.Add(this.updateConfigButton);
355 | this.Controls.Add(this.totalTimesCleanText);
356 | this.Controls.Add(this.automaticCacheCleanBox);
357 | this.Controls.Add(this.freeMemoryText);
358 | this.Controls.Add(this.cacheSizeText);
359 | this.Controls.Add(this.totalSystemMemoryText);
360 | this.Controls.Add(this.purgeCacheButton);
361 | this.Controls.Add(this.darkModeBox);
362 | this.Controls.Add(this.logButton);
363 | this.Controls.Add(this.installScheduleButton);
364 | this.Controls.Add(this.creatorLabel);
365 | this.Controls.Add(this.textIntervalLabel);
366 | this.Controls.Add(this.intervalComboBox);
367 | this.Controls.Add(this.warningLabel);
368 | this.Controls.Add(this.timerResolutionBox);
369 | this.Controls.Add(this.wantedResolutionLabel);
370 | this.Controls.Add(this.maximumResolutionLabel);
371 | this.Controls.Add(this.minimumResolutionLabel);
372 | this.Controls.Add(this.currentResolutionLabel);
373 | this.Controls.Add(this.stopButton);
374 | this.Controls.Add(this.startButton);
375 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
376 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
377 | this.MaximizeBox = false;
378 | this.Name = "MainWindow";
379 | this.Text = "OpenTimerResolution";
380 | this.Load += new System.EventHandler(this.MainWindow_Load);
381 | this.Resize += new System.EventHandler(this.MainWindow_Resize);
382 | this.minimizeIconContextMenu.ResumeLayout(false);
383 | this.ResumeLayout(false);
384 | this.PerformLayout();
385 |
386 | }
387 |
388 | #endregion
389 |
390 | private Button startButton;
391 | private Button stopButton;
392 | private Label currentResolutionLabel;
393 | private Label minimumResolutionLabel;
394 | private Label maximumResolutionLabel;
395 | private System.Windows.Forms.Timer textChanger;
396 | private Label wantedResolutionLabel;
397 | private TextBox timerResolutionBox;
398 | private Label warningLabel;
399 | private ComboBox intervalComboBox;
400 | private Label textIntervalLabel;
401 | private NotifyIcon minimizeIcon;
402 | private ContextMenuStrip minimizeIconContextMenu;
403 | private ToolStripMenuItem quitToolStripMenuItem;
404 | private Label creatorLabel;
405 | private Button installScheduleButton;
406 | private Button logButton;
407 | private System.Windows.Forms.Timer timerLogger;
408 | private CheckBox darkModeBox;
409 | private Button purgeCacheButton;
410 | private Label freeMemoryText;
411 | private Label cacheSizeText;
412 | private Label totalSystemMemoryText;
413 | private CheckBox automaticCacheCleanBox;
414 | private Label totalTimesCleanText;
415 | private System.Windows.Forms.Timer automaticMemoryPurger;
416 | private Button updateConfigButton;
417 | private Label updateText;
418 | }
419 | }
420 |
--------------------------------------------------------------------------------