Skip to content

Commit

Permalink
Merge pull request #3 from jrunestone/develop
Browse files Browse the repository at this point in the history
Culture invariant datarefs
  • Loading branch information
jrunestone authored Apr 3, 2020
2 parents d02df1a + 2a84029 commit 38da223
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
bin/
obj/
*.userprefs
*.userprefs
.vs/
2 changes: 1 addition & 1 deletion Commands/SetDataRefCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected override string FormatParameters()
value = string.Format(CultureInfo.InvariantCulture, "[{0}]", string.Join(",", arrayValues));
}
else
value = Value.ToString();
value = Convert.ToString(Value, CultureInfo.InvariantCulture);

return string.Format(CultureInfo.InvariantCulture, "{0} {1}", DataRef, value);
}
Expand Down
5 changes: 3 additions & 2 deletions DataRef.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Globalization;
using System.Linq;

namespace ExtPlaneNet
Expand Down Expand Up @@ -62,12 +63,12 @@ public static object ParseValue(string rawValue, Type type)
Array array = Array.CreateInstance(type.GetElementType(), elements.Length);

for (int i = 0; i < array.Length; i++)
array.SetValue(Convert.ChangeType(elements[i], type.GetElementType()), i);
array.SetValue(Convert.ChangeType(elements[i], type.GetElementType(), CultureInfo.InvariantCulture), i);

value = array;
}
else
value = Convert.ChangeType(rawValue, type);
value = Convert.ChangeType(rawValue, type, CultureInfo.InvariantCulture);

return value;
}
Expand Down
Binary file modified build/ExtPlaneNet.dll
Binary file not shown.
Binary file modified build/ExtPlaneNet.pdb
Binary file not shown.

0 comments on commit 38da223

Please sign in to comment.