Fix de/serialisation of .tasproj MovieVersion header (fixes #2377)

.tasproj files written from both American/global and European PCs will now load
anywhere. No new files will use ',' in the header, only '.'.
This commit is contained in:
YoshiRulz 2020-09-06 09:33:31 +10:00
parent 8e72dddd41
commit d1de181194
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
2 changed files with 11 additions and 4 deletions

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Linq; using System.Linq;
using BizHawk.Common.NumberExtensions; using BizHawk.Common.NumberExtensions;
@ -46,10 +47,15 @@ namespace BizHawk.Client.Common
.Trim() .Trim()
.Replace("v", ""); .Replace("v", "");
var result = double.TryParse(versionStr, out double version); if (double.TryParse(versionStr, NumberStyles.Float, CultureInfo.InvariantCulture, out var parsedWithPeriod))
if (result)
{ {
return version; return parsedWithPeriod;
}
// Accept .tasproj files written from <= 2.5 where the host culture settings used ','
if (double.TryParse(versionStr, NumberStyles.Float, CultureInfo.InvariantCulture, out var parsedWithComma))
{
return parsedWithComma;
} }
return 1.0F; return 1.0F;

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using BizHawk.Emulation.Common; using BizHawk.Emulation.Common;
@ -19,7 +20,7 @@ namespace BizHawk.Client.Common
{ {
Branches = new TasBranchCollection(this); Branches = new TasBranchCollection(this);
ChangeLog = new TasMovieChangeLog(this); ChangeLog = new TasMovieChangeLog(this);
Header[HeaderKeys.MovieVersion] = $"BizHawk v2.0 Tasproj v{CurrentVersion}"; Header[HeaderKeys.MovieVersion] = $"BizHawk v2.0 Tasproj v{CurrentVersion.ToString(CultureInfo.InvariantCulture)}";
Markers = new TasMovieMarkerList(this); Markers = new TasMovieMarkerList(this);
Markers.CollectionChanged += Markers_CollectionChanged; Markers.CollectionChanged += Markers_CollectionChanged;
Markers.Add(0, "Power on"); Markers.Add(0, "Power on");