Skip to content

Commit 5d8995b

Browse files
committed
fix #3, made the thread run on the en-US culture
(works)
1 parent 03f9f17 commit 5d8995b

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

src/MainWindow.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public partial class MainWindow : Form
3838
private uint NtActualResolution = 0;
3939

4040
private readonly static bool emptyBuildVersion = Assembly.GetEntryAssembly().GetName().Version.Build == -1;
41-
private readonly string ProgramVersion = emptyBuildVersion ? Assembly.GetEntryAssembly().GetName().Version.Build.ToString() : "1.0.3.7";
41+
private readonly string ProgramVersion = emptyBuildVersion ? Assembly.GetEntryAssembly().GetName().Version.Build.ToString() : "1.0.3.8";
4242

4343
private static Dictionary<string, int> Logger = new();
4444

@@ -107,7 +107,7 @@ public MainWindow()
107107
if (bool.TryParse(ConfigurationManager.AppSettings["StartPurgingAutomatically"], out purgeAutomatically))
108108
automaticCacheCleanBox.Checked = purgeAutomatically;
109109

110-
float.TryParse(ConfigurationManager.AppSettings["DesiredResjolution"], NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out desiredResolution);
110+
float.TryParse(ConfigurationManager.AppSettings["DesiredResjolution"], out desiredResolution);
111111

112112
if (desiredResolution == 0)
113113
desiredResolution = 0.50f;
@@ -166,7 +166,7 @@ private void timerResolutionBox_TextChanged(object sender, EventArgs e)
166166
{
167167
if (timerResolutionBox.Text != string.Empty && timerResolutionBox.Text.Last() != '.')
168168
{
169-
warningLabel.Visible = (double.Parse(timerResolutionBox.Text, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture) > 15.6250d) ? true : false;
169+
warningLabel.Visible = (double.Parse(timerResolutionBox.Text) > 15.6250d) ? true : false;
170170
}
171171
}
172172

@@ -197,7 +197,7 @@ private void startButton_Click(object sender, EventArgs e)
197197
if (timerResolutionBox.Text == string.Empty)
198198
return;
199199

200-
var result = NtSetTimerResolution((int)(float.Parse(timerResolutionBox.Text, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture) * 10000f), true, out NtCurrentResolution);
200+
var result = NtSetTimerResolution((int)(float.Parse(timerResolutionBox.Text) * 10000f), true, out NtCurrentResolution);
201201

202202
if (result != NtStatus.Success)
203203
{
@@ -217,7 +217,7 @@ private void stopButton_Click(object sender, EventArgs e)
217217
if (timerResolutionBox.Text == string.Empty)
218218
return;
219219

220-
var result = NtSetTimerResolution((int)(float.Parse(timerResolutionBox.Text, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture) * 10000f), false, out NtCurrentResolution);
220+
var result = NtSetTimerResolution((int)(float.Parse(timerResolutionBox.Text) * 10000f), false, out NtCurrentResolution);
221221

222222
if (result != NtStatus.Success)
223223
{
@@ -309,7 +309,7 @@ private void MainWindow_Load(object sender, EventArgs e)
309309
{
310310
if (Program.startMinimized)
311311
{
312-
var result = NtSetTimerResolution((int)(float.Parse(timerResolutionBox.Text, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture) * 10000f), true, out NtCurrentResolution);
312+
var result = NtSetTimerResolution((int)(float.Parse(timerResolutionBox.Text) * 10000f), true, out NtCurrentResolution);
313313

314314
if (result != NtStatus.Success)
315315
MessageBox.Show($"Error code: {result}", "OpenTimerResolution", MessageBoxButtons.OK, MessageBoxIcon.Error);

src/OpenTimerResolution.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
<StartupObject>OpenTimerResolution.Program</StartupObject>
99
<ApplicationIcon>program.ico</ApplicationIcon>
1010
<ApplicationManifest>app.manifest</ApplicationManifest>
11-
<AssemblyVersion>1.0.3.7</AssemblyVersion>
12-
<FileVersion>1.0.3.7</FileVersion>
13-
<Version>1.0.3.7</Version>
11+
<AssemblyVersion>1.0.3.8</AssemblyVersion>
12+
<FileVersion>1.0.3.8</FileVersion>
13+
<Version>1.0.3.8</Version>
1414
<DebugType>embedded</DebugType>
1515
<Product>OpenTimerResolution</Product>
1616
<Description>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.</Description>

src/Program.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Configuration;
2+
using System.Globalization;
23

34
namespace OpenTimerResolution
45
{
@@ -15,6 +16,10 @@ internal static class Program
1516
[STAThread]
1617
static void Main()
1718
{
19+
CultureInfo ci = new CultureInfo("en-US");
20+
Thread.CurrentThread.CurrentCulture = ci;
21+
Thread.CurrentThread.CurrentUICulture = ci;
22+
1823
if (System.Diagnostics.Process.GetProcessesByName(System.Diagnostics.Process.GetCurrentProcess().ProcessName).Length > 1)
1924
{
2025
MessageBox.Show("OpenTimerResolution is already running. Only one instance of this application is allowed.", "OpenTimerResolution");

0 commit comments

Comments
 (0)