diff --git a/RomRepoMgr.Core/Checksums/BigEndianBitConverter.cs b/RomRepoMgr.Core/Checksums/BigEndianBitConverter.cs index c3f8060..bc5e3d5 100644 --- a/RomRepoMgr.Core/Checksums/BigEndianBitConverter.cs +++ b/RomRepoMgr.Core/Checksums/BigEndianBitConverter.cs @@ -50,52 +50,52 @@ public static class BigEndianBitConverter /// Returns the specified Boolean value as an array of bytes. /// A Boolean value. /// An array of bytes with length 1. - public static byte[] GetBytes(bool value) => BitConverter.GetBytes(value).Reverse().ToArray(); + public static byte[] GetBytes(bool value) => Enumerable.ToArray(Enumerable.Reverse(BitConverter.GetBytes(value))); /// Returns the specified Unicode character value as an array of bytes. /// A character to convert. /// An array of bytes with length 2. - public static byte[] GetBytes(char value) => BitConverter.GetBytes(value).Reverse().ToArray(); + public static byte[] GetBytes(char value) => Enumerable.ToArray(Enumerable.Reverse(BitConverter.GetBytes(value))); /// Returns the specified double-precision floating point value as an array of bytes. /// The number to convert. /// An array of bytes with length 8. - public static byte[] GetBytes(double value) => BitConverter.GetBytes(value).Reverse().ToArray(); + public static byte[] GetBytes(double value) => Enumerable.ToArray(Enumerable.Reverse(BitConverter.GetBytes(value))); /// Returns the specified single-precision floating point value as an array of bytes. /// The number to convert. /// An array of bytes with length 4. - public static byte[] GetBytes(float value) => BitConverter.GetBytes(value).Reverse().ToArray(); + public static byte[] GetBytes(float value) => Enumerable.ToArray(Enumerable.Reverse(BitConverter.GetBytes(value))); /// Returns the specified 32-bit signed integer value as an array of bytes. /// The number to convert. /// An array of bytes with length 4. - public static byte[] GetBytes(int value) => BitConverter.GetBytes(value).Reverse().ToArray(); + public static byte[] GetBytes(int value) => Enumerable.ToArray(Enumerable.Reverse(BitConverter.GetBytes(value))); /// Returns the specified 64-bit signed integer value as an array of bytes. /// The number to convert. /// An array of bytes with length 8. - public static byte[] GetBytes(long value) => BitConverter.GetBytes(value).Reverse().ToArray(); + public static byte[] GetBytes(long value) => Enumerable.ToArray(Enumerable.Reverse(BitConverter.GetBytes(value))); /// Returns the specified 16-bit signed integer value as an array of bytes. /// The number to convert. /// An array of bytes with length 2. - public static byte[] GetBytes(short value) => BitConverter.GetBytes(value).Reverse().ToArray(); + public static byte[] GetBytes(short value) => Enumerable.ToArray(Enumerable.Reverse(BitConverter.GetBytes(value))); /// Returns the specified 32-bit unsigned integer value as an array of bytes. /// The number to convert. /// An array of bytes with length 4. - public static byte[] GetBytes(uint value) => BitConverter.GetBytes(value).Reverse().ToArray(); + public static byte[] GetBytes(uint value) => Enumerable.ToArray(Enumerable.Reverse(BitConverter.GetBytes(value))); /// Returns the specified 64-bit unsigned integer value as an array of bytes. /// The number to convert. /// An array of bytes with length 8. - public static byte[] GetBytes(ulong value) => BitConverter.GetBytes(value).Reverse().ToArray(); + public static byte[] GetBytes(ulong value) => Enumerable.ToArray(Enumerable.Reverse(BitConverter.GetBytes(value))); /// Returns the specified 16-bit unsigned integer value as an array of bytes. /// The number to convert. /// An array of bytes with length 2. - public static byte[] GetBytes(ushort value) => BitConverter.GetBytes(value).Reverse().ToArray(); + public static byte[] GetBytes(ushort value) => Enumerable.ToArray(Enumerable.Reverse(BitConverter.GetBytes(value))); /// Converts the specified 64-bit signed integer to a double-precision floating point number. /// The number to convert. @@ -154,7 +154,7 @@ public static class BigEndianBitConverter /// minus 1. /// public static short ToInt16(byte[] value, int startIndex) => - BitConverter.ToInt16(value.Reverse().ToArray(), value.Length - sizeof(short) - startIndex); + BitConverter.ToInt16(Enumerable.ToArray(Enumerable.Reverse(value)), value.Length - sizeof(short) - startIndex); /// Returns a 32-bit signed integer converted from four bytes at a specified position in a byte array. /// An array of bytes. @@ -170,7 +170,7 @@ public static class BigEndianBitConverter /// minus 1. /// public static int ToInt32(byte[] value, int startIndex) => - BitConverter.ToInt32(value.Reverse().ToArray(), value.Length - sizeof(int) - startIndex); + BitConverter.ToInt32(Enumerable.ToArray(Enumerable.Reverse(value)), value.Length - sizeof(int) - startIndex); /// Returns a 64-bit signed integer converted from eight bytes at a specified position in a byte array. /// An array of bytes. @@ -186,7 +186,7 @@ public static class BigEndianBitConverter /// length of value minus 1. /// public static long ToInt64(byte[] value, int startIndex) => - BitConverter.ToInt64(value.Reverse().ToArray(), value.Length - sizeof(long) - startIndex); + BitConverter.ToInt64(Enumerable.ToArray(Enumerable.Reverse(value)), value.Length - sizeof(long) - startIndex); /// /// Returns a single-precision floating point number converted from four bytes at a specified position in a byte @@ -205,7 +205,7 @@ public static class BigEndianBitConverter /// length of value minus 1. /// public static float ToSingle(byte[] value, int startIndex) => - BitConverter.ToSingle(value.Reverse().ToArray(), value.Length - sizeof(float) - startIndex); + BitConverter.ToSingle(Enumerable.ToArray(Enumerable.Reverse(value)), value.Length - sizeof(float) - startIndex); /// /// Converts the numeric value of each element of a specified array of bytes to its equivalent hexadecimal string @@ -217,7 +217,7 @@ public static class BigEndianBitConverter /// element in value; for example, "7F-2C-4A". /// /// value is null. - public static string ToString(byte[] value) => BitConverter.ToString(value.Reverse().ToArray()); + public static string ToString(byte[] value) => BitConverter.ToString(Enumerable.ToArray(Enumerable.Reverse(value))); /// /// Converts the numeric value of each element of a specified subarray of bytes to its equivalent hexadecimal @@ -235,7 +235,7 @@ public static class BigEndianBitConverter /// minus 1. /// public static string ToString(byte[] value, int startIndex) => - BitConverter.ToString(value.Reverse().ToArray(), startIndex); + BitConverter.ToString(Enumerable.ToArray(Enumerable.Reverse(value)), startIndex); /// /// Converts the numeric value of each element of a specified subarray of bytes to its equivalent hexadecimal @@ -258,7 +258,7 @@ public static class BigEndianBitConverter /// value; that is, the startIndex parameter is greater than the length of value minus the length parameter. /// public static string ToString(byte[] value, int startIndex, int length) => - BitConverter.ToString(value.Reverse().ToArray(), startIndex, length); + BitConverter.ToString(Enumerable.ToArray(Enumerable.Reverse(value)), startIndex, length); /// Returns a 16-bit unsigned integer converted from two bytes at a specified position in a byte array. /// The array of bytes. @@ -271,7 +271,7 @@ public static class BigEndianBitConverter /// minus 1. /// public static ushort ToUInt16(byte[] value, int startIndex) => - BitConverter.ToUInt16(value.Reverse().ToArray(), value.Length - sizeof(ushort) - startIndex); + BitConverter.ToUInt16(Enumerable.ToArray(Enumerable.Reverse(value)), value.Length - sizeof(ushort) - startIndex); /// Returns a 32-bit unsigned integer converted from four bytes at a specified position in a byte array. /// An array of bytes. @@ -287,7 +287,7 @@ public static class BigEndianBitConverter /// minus 1. /// public static uint ToUInt32(byte[] value, int startIndex) => - BitConverter.ToUInt32(value.Reverse().ToArray(), value.Length - sizeof(uint) - startIndex); + BitConverter.ToUInt32(Enumerable.ToArray(Enumerable.Reverse(value)), value.Length - sizeof(uint) - startIndex); /// Returns a 64-bit unsigned integer converted from eight bytes at a specified position in a byte array. /// An array of bytes. @@ -303,7 +303,7 @@ public static class BigEndianBitConverter /// minus 1. /// public static ulong ToUInt64(byte[] value, int startIndex) => - BitConverter.ToUInt64(value.Reverse().ToArray(), value.Length - sizeof(ulong) - startIndex); + BitConverter.ToUInt64(Enumerable.ToArray(Enumerable.Reverse(value)), value.Length - sizeof(ulong) - startIndex); public static Guid ToGuid(byte[] value, int startIndex) => new(ToUInt32(value, 0 + startIndex), ToUInt16(value, 4 + startIndex), diff --git a/SabreTools b/SabreTools index 4aeadaa..2e93fe3 160000 --- a/SabreTools +++ b/SabreTools @@ -1 +1 @@ -Subproject commit 4aeadaa153e3fb6bc7a9b06fb24df27ba19e1970 +Subproject commit 2e93fe340d2d77aac9027269a3c3ebdc3a56794e