Repository navigation
Globally use invariant culture for number parsing and display + Hardened numeric textboxes against bad input - #36
Merged
milankarman merged 3 commits intoNov 19, 2026
Conversation
On locales with a `,` decimal separator, `double.Parse` on the fps and minimum similarity fields broke when typing a `.` decimal, which `ForceDouble` allowed: `29.97` threw `FormatException` on `fr-CA`/`fr-FR`, and silently became `2997` on `de-DE`. Numbers were also displayed with a `,` (e.g. `29,97`). - Set global default culture configuration at `App` startup, so the conversion thread is covered too - Restrict `ForceDouble` to `[0-9.]`, since `,` is the thousands separator in the invariant culture - Enabled `AnalysisModeGlobalization` to catch more similar issues, with CA1304, CA1305 and CA1311 disabled as it's configured globally, rather than having to pass in at every call site.
Contributor
Author
|
I'd say either this, or bother with special casing and edge-cases to ensure that numbers such as Given that all speedrun timers and leaderboards (that I know of) use It also makes text output the same, for comparing results with another verifier who'd have a different locale. |
Avasam
force-pushed
the
Globally-use-invariant-culture-for-number-parsing-and-display
branch
from
November 17, 2026 16:41
5ed733f to
0ae9536
Compare
- Validate typed and pasted input against the resulting text, so `1.2` + `.5` is rejected - Map `,` to `.` in decimal fields, since the numpad decimal key types `,` on some keyboard layouts - Trim whitespace and newlines from pasted text - Restore the last valid value when a field loses focus empty or holding a lone `.` - Replace bare `int.Parse`/`double.Parse` with `TryParse` fallbacks. Clearing `txtVideoFrame` or closing `MainWindow` with an empty step size no longer crashes - Fix `OverflowException` crash when typing a number too large for an `int`, e.g. in the conversion start/end time or start/end frame fields. `ClampInteger` clamps it to the maximum instead - Compute step size frames as `fps * step / 1000`. A `0` step no longer divides by zero, and steps over 1000 ms no longer yield infinity. Results are unchanged for step sizes that divide 1000 - Add missing `ForceInteger` on `txtMinFrames` - Drop `ForceDouble` on read-only `txtFPS`
Avasam
force-pushed
the
Globally-use-invariant-culture-for-number-parsing-and-display
branch
from
November 17, 2026 16:47
0ae9536 to
d41c034
Compare
Avasam
deleted the
Globally-use-invariant-culture-for-number-parsing-and-display
branch
November 19, 2026 22:42
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On locales with a
,decimal separator,double.Parseon the fps and minimum similarity fields broke when typing a.decimal, whichForceDoubleallowed:29.97threwFormatExceptiononfr-CA/fr-FR, and silently became2997onde-DE. Numbers were also displayed with a,(e.g.29,97).Appstartup, so the conversion thread is covered tooForceDoubleto[0-9.], since,is the thousands separator in the invariant cultureAnalysisModeGlobalizationto catch more similar issues, with CA1304, CA1305 and CA1311 disabled as it's configured globally, rather than having to pass in at every call site.Hardened numeric textboxes against bad input:
1.2+.5is rejected,to.in decimal fields, since the numpad decimal key types,on some keyboard layouts.int.Parse/double.ParsewithTryParsefallbacks. ClearingtxtVideoFrameor closingMainWindowwith an empty step size no longer crashesOverflowExceptioncrash when typing a number too large for anint, e.g. in the conversion start/end time or start/end frame fields.ClampIntegerclamps it to the maximum insteadfps * step / 1000. A0step no longer divides by zero, and steps over 1000 ms no longer yield infinity. Results are unchanged for step sizes that divide 1000ForceIntegerontxtMinFramesForceDoubleon read-onlytxtFPS