Remove some nonsensical endian methods

This commit is contained in:
Matt Nadareski
2025-10-14 20:45:02 -04:00
parent 793168fbe5
commit 8fe404e732
3 changed files with 0 additions and 91 deletions

View File

@@ -41,17 +41,6 @@ namespace SabreTools.IO.Test.Extensions
Assert.True(arr.SequenceEqual(_bytes.Take(4)));
}
[Fact]
public void ReadByteArrayBigEndianTest()
{
byte[] arr = new byte[4];
var stream = new MemoryStream(_bytes);
var br = new BinaryReader(stream);
int read = br.ReadBigEndian(arr, 0, 4);
Assert.Equal(4, read);
Assert.True(arr.SequenceEqual(_bytes.Take(4).Reverse()));
}
[Fact]
public void ReadCharArrayTest()
{
@@ -63,17 +52,6 @@ namespace SabreTools.IO.Test.Extensions
Assert.True(arr.SequenceEqual(_bytes.Take(4).Select(b => (char)b)));
}
[Fact]
public void ReadCharArrayBigEndianTest()
{
char[] arr = new char[4];
var stream = new MemoryStream(_bytes);
var br = new BinaryReader(stream);
int read = br.ReadBigEndian(arr, 0, 4);
Assert.Equal(4, read);
Assert.True(arr.SequenceEqual(_bytes.Take(4).Select(b => (char)b).Reverse()));
}
[Fact]
public void ReadByteTest()
{
@@ -94,17 +72,6 @@ namespace SabreTools.IO.Test.Extensions
Assert.True(read.SequenceEqual(_bytes.Take(length)));
}
[Fact]
public void ReadBytesBigEndianTest()
{
var stream = new MemoryStream(_bytes);
var br = new BinaryReader(stream);
int length = 4;
byte[] read = br.ReadBytesBigEndian(length);
Assert.Equal(length, read.Length);
Assert.True(read.SequenceEqual(_bytes.Take(length).Reverse()));
}
[Fact]
public void ReadCharsTest()
{
@@ -116,17 +83,6 @@ namespace SabreTools.IO.Test.Extensions
Assert.True(read.SequenceEqual(_bytes.Take(length).Select(b => (char)b)));
}
[Fact]
public void ReadCharsBigEndianTest()
{
var stream = new MemoryStream(_bytes);
var br = new BinaryReader(stream);
int length = 4;
char[] read = br.ReadCharsBigEndian(length);
Assert.Equal(length, read.Length);
Assert.True(read.SequenceEqual(_bytes.Take(length).Select(b => (char)b).Reverse()));
}
[Fact]
public void ReadSByteTest()
{

View File

@@ -17,42 +17,6 @@ namespace SabreTools.IO.Extensions
{
#region Exact Read
/// <inheritdoc cref="BinaryReader.Read(byte[], int, int)"/>
/// <remarks>Reads in big-endian format</remarks>
public static int ReadBigEndian(this BinaryReader reader, byte[] buffer, int index, int count)
{
int retval = reader.Read(buffer, index, count);
Array.Reverse(buffer);
return retval;
}
/// <inheritdoc cref="BinaryReader.Read(char[], int, int)"/>
/// <remarks>Reads in big-endian format</remarks>
public static int ReadBigEndian(this BinaryReader reader, char[] buffer, int index, int count)
{
int retval = reader.Read(buffer, index, count);
Array.Reverse(buffer);
return retval;
}
/// <inheritdoc cref="BinaryReader.ReadBytes(int)"/>
/// <remarks>Reads in big-endian format</remarks>
public static byte[] ReadBytesBigEndian(this BinaryReader reader, int count)
{
byte[] buffer = reader.ReadBytes(count);
Array.Reverse(buffer);
return buffer;
}
/// <inheritdoc cref="BinaryReader.ReadChars(int)"/>
/// <remarks>Reads in big-endian format</remarks>
public static char[] ReadCharsBigEndian(this BinaryReader reader, int count)
{
char[] buffer = reader.ReadChars(count);
Array.Reverse(buffer);
return buffer;
}
/// <inheritdoc cref="BinaryReader.ReadInt16"/>
/// <remarks>Reads in big-endian format</remarks>
public static short ReadInt16BigEndian(this BinaryReader reader)

View File

@@ -37,17 +37,6 @@ namespace SabreTools.IO.Extensions
public static byte[] ReadBytes(this byte[] content, ref int offset, int count)
=> ReadExactlyToBuffer(content, ref offset, count);
/// <summary>
/// Read a UInt8[] and increment the pointer to an array
/// </summary>
/// <remarks>Reads in big-endian format</remarks>
public static byte[] ReadBytesBigEndian(this byte[] content, ref int offset, int count)
{
byte[] buffer = ReadExactlyToBuffer(content, ref offset, count);
Array.Reverse(buffer);
return buffer;
}
/// <summary>
/// Read an Int8 and increment the pointer to an array
/// </summary>