|
1 |
| -#pragma warning disable CA1305 // Specify IFormatProvider |
2 |
| - |
3 | 1 | using System;
|
| 2 | +using System.Globalization; |
4 | 3 | using Hazel;
|
5 | 4 | using Hazel.Udp;
|
6 | 5 | using UnityEngine;
|
@@ -45,19 +44,19 @@ public static void Write(this MessageWriter writer, Enum value)
|
45 | 44 | var underlyingType = enumType.GetEnumUnderlyingType();
|
46 | 45 |
|
47 | 46 | if (underlyingType == typeof(byte))
|
48 |
| - writer.Write(Convert.ToByte(value)); |
| 47 | + writer.Write(Convert.ToByte(value, NumberFormatInfo.InvariantInfo)); |
49 | 48 | else if (underlyingType == typeof(sbyte))
|
50 |
| - writer.Write(Convert.ToSByte(value)); |
| 49 | + writer.Write(Convert.ToSByte(value, NumberFormatInfo.InvariantInfo)); |
51 | 50 | else if (underlyingType == typeof(short))
|
52 |
| - writer.Write(Convert.ToInt16(value)); |
| 51 | + writer.Write(Convert.ToInt16(value, NumberFormatInfo.InvariantInfo)); |
53 | 52 | else if (underlyingType == typeof(ushort))
|
54 |
| - writer.Write(Convert.ToUInt16(value)); |
| 53 | + writer.Write(Convert.ToUInt16(value, NumberFormatInfo.InvariantInfo)); |
55 | 54 | else if (underlyingType == typeof(ulong))
|
56 |
| - writer.Write(Convert.ToUInt64(value)); |
| 55 | + writer.Write(Convert.ToUInt64(value, NumberFormatInfo.InvariantInfo)); |
57 | 56 | else if (underlyingType == typeof(uint))
|
58 |
| - writer.WritePacked(Convert.ToUInt32(value)); |
| 57 | + writer.WritePacked(Convert.ToUInt32(value, NumberFormatInfo.InvariantInfo)); |
59 | 58 | else if (underlyingType == typeof(int))
|
60 |
| - writer.WritePacked(Convert.ToInt32(value)); |
| 59 | + writer.WritePacked(Convert.ToInt32(value, NumberFormatInfo.InvariantInfo)); |
61 | 60 | else if (underlyingType == typeof(long))
|
62 | 61 | throw new NotSupportedException("long enum types are not supported at the moment.");
|
63 | 62 | else
|
|
0 commit comments