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:
parent
8e72dddd41
commit
d1de181194
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using BizHawk.Common.NumberExtensions;
|
||||
|
||||
|
@ -46,10 +47,15 @@ namespace BizHawk.Client.Common
|
|||
.Trim()
|
||||
.Replace("v", "");
|
||||
|
||||
var result = double.TryParse(versionStr, out double version);
|
||||
if (result)
|
||||
if (double.TryParse(versionStr, NumberStyles.Float, CultureInfo.InvariantCulture, out var parsedWithPeriod))
|
||||
{
|
||||
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;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
@ -19,7 +20,7 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
Branches = new TasBranchCollection(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.CollectionChanged += Markers_CollectionChanged;
|
||||
Markers.Add(0, "Power on");
|
||||
|
|
Loading…
Reference in New Issue