diff options
| author | a1xd <[email protected]> | 2021-08-29 19:44:48 -0400 |
|---|---|---|
| committer | a1xd <[email protected]> | 2021-08-29 19:44:48 -0400 |
| commit | ec4997c6be3f794699eebf00bbe795c23626f9c7 (patch) | |
| tree | 6ad42e07dfad10177fd0d1f6f68317a2aabdf5f0 | |
| parent | add validation checks for jump mode (diff) | |
| download | rawaccel-ec4997c6be3f794699eebf00bbe795c23626f9c7.tar.xz rawaccel-ec4997c6be3f794699eebf00bbe795c23626f9c7.zip | |
remove culture specific float parsing
make app/default culture invariant
| -rw-r--r-- | grapher/Models/Fields/Field.cs | 8 | ||||
| -rw-r--r-- | grapher/Program.cs | 4 |
2 files changed, 5 insertions, 7 deletions
diff --git a/grapher/Models/Fields/Field.cs b/grapher/Models/Fields/Field.cs index fe5171b..a75882d 100644 --- a/grapher/Models/Fields/Field.cs +++ b/grapher/Models/Fields/Field.cs @@ -275,15 +275,9 @@ namespace grapher } } - public static bool TryParseDouble(string s, out double res) - { - return double.TryParse(s, Constants.FloatStyle, NumberFormatInfo.CurrentInfo, out res) || - double.TryParse(s, Constants.FloatStyle, NumberFormatInfo.InvariantInfo, out res); - } - private void TextToData() { - if (TryParseDouble(Box.Text, out double value) && + if (double.TryParse(Box.Text, out double value) && value <= MaxData && value >= MinData) { _data = value; diff --git a/grapher/Program.cs b/grapher/Program.cs index 894d1cd..bd7d2f9 100644 --- a/grapher/Program.cs +++ b/grapher/Program.cs @@ -1,4 +1,5 @@ using System; +using System.Globalization; using System.Windows.Forms; namespace grapher @@ -19,6 +20,9 @@ namespace grapher return; } + CultureInfo.DefaultThreadCurrentCulture = CultureInfo.InvariantCulture; + CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.InvariantCulture; + AppDomain.CurrentDomain.UnhandledException += GlobalUnhandledExceptionHandler; Application.EnableVisualStyles(); |