Skip to content

Commit

Permalink
Use invariant culture for floats
Browse files Browse the repository at this point in the history
  • Loading branch information
Disquse committed Nov 13, 2021
1 parent 1238e75 commit 768e4da
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
15 changes: 8 additions & 7 deletions Core/OnimFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using CodeWalker.GameFiles;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
Expand Down Expand Up @@ -142,7 +143,7 @@ public void Load(Animation crAnim, string onimfile)
Flags FLAG_0 FLAG_4 FLAG_5 FLAG_6 FLAG_7 FLAG_8
Frames {crAnim.Frames}
SequenceFrameLimit {crAnim.SequenceFrameLimit}
Duration {crAnim.Frames / 30.0}
Duration {(crAnim.Frames / 30.0).ToString(CultureInfo.InvariantCulture)}
_f10 285410817
ExtraFlags
Sequences {string.Join(" ", seqs.Select(f => f.ToString()))}
Expand Down Expand Up @@ -241,13 +242,13 @@ string ChannelData(AnimChannel chan, bool singleChannel)
{
var q = seq.Sequences[i].EvaluateQuaternionType7(0);

return $"{prefix} {q[index]}\r\n";
return $"{prefix} {q[index].ToString(CultureInfo.InvariantCulture)}\r\n";
}

StringBuilder db = new StringBuilder();
for (int f = 0; f < seq.NumFrames; f++)
{
db.AppendLine($"{prefix} {seq.Sequences[i].EvaluateQuaternionType7(f)[index]}");
db.AppendLine($"{prefix} {seq.Sequences[i].EvaluateQuaternionType7(f)[index].ToString(CultureInfo.InvariantCulture)}");
}

return db.ToString();
Expand All @@ -256,17 +257,17 @@ string ChannelData(AnimChannel chan, bool singleChannel)
switch (chan)
{
case AnimChannelStaticFloat sf:
return $"{prefix} {sf.Value}\r\n";
return $"{prefix} {sf.Value.ToString(CultureInfo.InvariantCulture)}\r\n";
case AnimChannelStaticVector3 v3:
return $"{prefix} {v3.Value[0]} {v3.Value[1]} {v3.Value[2]}\r\n";
return $"{prefix} {v3.Value[0].ToString(CultureInfo.InvariantCulture)} {v3.Value[1].ToString(CultureInfo.InvariantCulture)} {v3.Value[2].ToString(CultureInfo.InvariantCulture)}\r\n";
case AnimChannelStaticQuaternion q3:
return $"{prefix} {q3.Value[0]} {q3.Value[1]} {q3.Value[2]} {q3.Value[3]}\r\n";
return $"{prefix} {q3.Value[0].ToString(CultureInfo.InvariantCulture)} {q3.Value[1].ToString(CultureInfo.InvariantCulture)} {q3.Value[2].ToString(CultureInfo.InvariantCulture)} {q3.Value[3].ToString(CultureInfo.InvariantCulture)}\r\n";
default:
{
StringBuilder db = new StringBuilder();
for (int f = 0; f < seq.NumFrames; f++)
{
db.AppendLine($"{prefix} {chan.EvaluateFloat(f)}");
db.AppendLine($"{prefix} {chan.EvaluateFloat(f).ToString(CultureInfo.InvariantCulture)}");
}

return db.ToString();
Expand Down
2 changes: 1 addition & 1 deletion UI/Updater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace AnimKit.UI
{
internal static class Updater
{
public static Version CurrentVersion { get; } = new(1, 0, 2);
public static Version CurrentVersion { get; } = new(1, 0, 3);

public static Version ActualVersion => Utils.ActualVersions.UI;

Expand Down
2 changes: 1 addition & 1 deletion VERSIONS.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"UI": "1.0.2",
"UI": "1.0.3",
"CLI": "1.0.0",
"Plugin": "1.0.0"
}

0 comments on commit 768e4da

Please sign in to comment.