diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2019-07-14 02:09:34 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2019-07-14 02:09:34 +0900 |
commit | 82fa0de99ac34bb8455a944582366b0e63b42862 (patch) | |
tree | 6b2742402fa60a866a26a4320c54b612a9641afc | |
parent | 6e41c54ca710b680e1e3c865ccc3af7c7bda5f40 (diff) | |
download | wf-clock-82fa0de99ac34bb8455a944582366b0e63b42862.tar.gz |
fix offset not displaying on systems where decimal point is comma
Thanks to DaRaSTM for helping debugging the issue.
-rw-r--r-- | WarframeClock/App.xaml.cs | 17 | ||||
-rw-r--r-- | WarframeClock/EeLogParser.cs | 2 |
2 files changed, 17 insertions, 2 deletions
diff --git a/WarframeClock/App.xaml.cs b/WarframeClock/App.xaml.cs index 5ea53f3..569e0d9 100644 --- a/WarframeClock/App.xaml.cs +++ b/WarframeClock/App.xaml.cs @@ -1,5 +1,7 @@ using System; using System.Diagnostics; +using System.Globalization; +using System.IO; using System.Linq; using System.Text.RegularExpressions; using System.Threading; @@ -14,14 +16,21 @@ namespace WarframeClock { public static readonly string VersionString = "Warframe Clock Overlay 2019-06-22"; public static readonly string WebsiteUriString = "https://poepoe.org/warframe/clock/"; + private static readonly bool DEBUG = false; public static readonly Uri WebsiteUri = new Uri(WebsiteUriString); public static readonly AppData AppData = new AppData(); private Timer _worldStateFetchTimer, _eeLogFetchTimer; + private string _debugTracePath; protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); + if (DEBUG) + { + _debugTracePath = Path.GetTempFileName(); + Trace.Listeners.Add(new TextWriterTraceListener(File.Create(_debugTracePath))); + } StartWorldStateFetchTimer(); StartEeLogFetchTimer(); } @@ -68,7 +77,8 @@ namespace WarframeClock if ((match = regexSyncingWorldStateJobs.Match(args.Content)).Success) { - var reset = args.DateTime.AddSeconds(double.Parse(match.Groups[1].Value)); + var reset = args.DateTime.AddSeconds( + double.Parse(match.Groups[1].Value, CultureInfo.InvariantCulture)); if (reset < DateTimeOffset.UtcNow) return; AppData.NextBountiesReset = reset; @@ -147,6 +157,11 @@ namespace WarframeClock _worldStateFetchTimer.Change(Timeout.Infinite, Timeout.Infinite); _eeLogFetchTimer.Change(Timeout.Infinite, Timeout.Infinite); MainWindow?.Close(); + if (DEBUG) + { + Trace.Flush(); + MessageBox.Show("Debug log file is located at: " + _debugTracePath); + } } } } diff --git a/WarframeClock/EeLogParser.cs b/WarframeClock/EeLogParser.cs index f7b1956..f038720 100644 --- a/WarframeClock/EeLogParser.cs +++ b/WarframeClock/EeLogParser.cs @@ -78,7 +78,7 @@ namespace WarframeClock pos = newLinePos + "\r\n".Length; // #.### XX [YY]: ZZ - var entryOffset = double.Parse(line.Substring(0, line.IndexOf(' '))); + var entryOffset = double.Parse(line.Substring(0, line.IndexOf(' ')), CultureInfo.InvariantCulture); var entryContent = line.Substring(line.IndexOf(':') + 2); if (_timeOffset == null && entryContent.StartsWith("Current time: ")) |