Skip to content

Commit

Permalink
Export all floats culture invariant
Browse files Browse the repository at this point in the history
  • Loading branch information
Neodymium146 committed Jun 17, 2017
1 parent 7f2dde4 commit f68f1ed
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
9 changes: 5 additions & 4 deletions RageLib.GTA5/RBFWrappers/RbfXmlExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ THE SOFTWARE.
using RageLib.GTA5.RBF;
using RageLib.GTA5.RBF.Types;
using System;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml;
Expand Down Expand Up @@ -109,7 +110,7 @@ private void WriteStructureContentXml(RbfStructure value, XmlTextWriter writer)
{
writer.WriteStartElement(child.Name);
var floatChild = (RbfFloat)child;
var s1 = string.Format("{0:0.0###########}", floatChild.Value);
var s1 = string.Format(CultureInfo.InvariantCulture, "{0:0.0###########}", floatChild.Value);
writer.WriteAttributeString("value", s1);
writer.WriteEndElement();
}
Expand Down Expand Up @@ -158,9 +159,9 @@ private void WriteStructureContentXml(RbfStructure value, XmlTextWriter writer)
{
writer.WriteStartElement(child.Name);
var floatVectorChild = (RbfFloat3)child;
var s1 = string.Format("{0:0.0###########}", floatVectorChild.X);
var s2 = string.Format("{0:0.0###########}", floatVectorChild.Y);
var s3 = string.Format("{0:0.0###########}", floatVectorChild.Z);
var s1 = string.Format(CultureInfo.InvariantCulture, "{0:0.0###########}", floatVectorChild.X);
var s2 = string.Format(CultureInfo.InvariantCulture, "{0:0.0###########}", floatVectorChild.Y);
var s3 = string.Format(CultureInfo.InvariantCulture, "{0:0.0###########}", floatVectorChild.Z);
writer.WriteAttributeString("x", s1);
writer.WriteAttributeString("y", s2);
writer.WriteAttributeString("z", s3);
Expand Down
25 changes: 13 additions & 12 deletions RageLib.GTA5/ResourceWrappers/PC/Meta/MetaXmlExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ THE SOFTWARE.
using RageLib.GTA5.ResourceWrappers.PC.Meta.Types;
using RageLib.Resources.GTA5.PC.Meta;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Xml;
Expand Down Expand Up @@ -300,26 +301,26 @@ private void WriteUnsignedIntContent(XmlTextWriter writer, MetaInt32_B intValue)

private void WriteFloatContent(XmlTextWriter writer, MetaFloat floatValue)
{
var s1 = string.Format("{0:0.0###########}", floatValue.Value);
var s1 = string.Format(CultureInfo.InvariantCulture, "{0:0.0###########}", floatValue.Value);
writer.WriteAttributeString("value", s1);
}

private void WriteFloatXYZContent(XmlTextWriter writer, MetaFloat4_XYZ floatVectorValue)
{
var s1 = string.Format("{0:0.0###########}", floatVectorValue.X);
var s2 = string.Format("{0:0.0###########}", floatVectorValue.Y);
var s3 = string.Format("{0:0.0###########}", floatVectorValue.Z);
var s1 = string.Format(CultureInfo.InvariantCulture, "{0:0.0###########}", floatVectorValue.X);
var s2 = string.Format(CultureInfo.InvariantCulture, "{0:0.0###########}", floatVectorValue.Y);
var s3 = string.Format(CultureInfo.InvariantCulture, "{0:0.0###########}", floatVectorValue.Z);
writer.WriteAttributeString("x", s1);
writer.WriteAttributeString("y", s2);
writer.WriteAttributeString("z", s3);
}

private void WriteFloatXYZWContent(XmlTextWriter writer, MetaFloat4_XYZW floatVectorValue)
{
var s1 = string.Format("{0:0.0###########}", floatVectorValue.X);
var s2 = string.Format("{0:0.0###########}", floatVectorValue.Y);
var s3 = string.Format("{0:0.0###########}", floatVectorValue.Z);
var s4 = string.Format("{0:0.0###########}", floatVectorValue.W);
var s1 = string.Format(CultureInfo.InvariantCulture, "{0:0.0###########}", floatVectorValue.X);
var s2 = string.Format(CultureInfo.InvariantCulture, "{0:0.0###########}", floatVectorValue.Y);
var s3 = string.Format(CultureInfo.InvariantCulture, "{0:0.0###########}", floatVectorValue.Z);
var s4 = string.Format(CultureInfo.InvariantCulture, "{0:0.0###########}", floatVectorValue.W);
writer.WriteAttributeString("x", s1);
writer.WriteAttributeString("y", s2);
writer.WriteAttributeString("z", s3);
Expand Down Expand Up @@ -466,7 +467,7 @@ private void WriteFloatArrayContent(XmlTextWriter writer, MetaArray arrayValue)
StringBuilder b = new StringBuilder();
foreach (var k in arrayValue.Entries)
{
var s = string.Format("{0:0.0###########}", ((MetaFloat)k).Value);
var s = string.Format(CultureInfo.InvariantCulture, "{0:0.0###########}", ((MetaFloat)k).Value);
b.AppendLine(s);
}
writer.WriteString(b.ToString());
Expand All @@ -479,9 +480,9 @@ private void WriteFloatVectorArrayContent(XmlTextWriter writer, MetaArray arrayV
StringBuilder b = new StringBuilder();
foreach (var k in arrayValue.Entries)
{
var s1 = string.Format("{0:0.0###########}", ((MetaFloat4_XYZ)k).X);
var s2 = string.Format("{0:0.0###########}", ((MetaFloat4_XYZ)k).Y);
var s3 = string.Format("{0:0.0###########}", ((MetaFloat4_XYZ)k).Z);
var s1 = string.Format(CultureInfo.InvariantCulture, "{0:0.0###########}", ((MetaFloat4_XYZ)k).X);
var s2 = string.Format(CultureInfo.InvariantCulture, "{0:0.0###########}", ((MetaFloat4_XYZ)k).Y);
var s3 = string.Format(CultureInfo.InvariantCulture, "{0:0.0###########}", ((MetaFloat4_XYZ)k).Z);
b.AppendLine(s1 + " " + s2 + " " + s3);
}
writer.WriteString(b.ToString());
Expand Down

0 comments on commit f68f1ed

Please sign in to comment.