mirror of
https://github.com/SabreTools/SabreTools.IO.git
synced 2026-02-04 05:36:05 +00:00
Add both-endian exact read extensions
This commit is contained in:
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
using SabreTools.IO.Extensions;
|
||||
using SabreTools.IO.Numerics;
|
||||
using Xunit;
|
||||
|
||||
namespace SabreTools.IO.Test.Extensions
|
||||
@@ -61,6 +62,16 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.Equal(0x00, read);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadByteBothEndianTest()
|
||||
{
|
||||
var stream = new MemoryStream(_bytes);
|
||||
var br = new BinaryReader(stream);
|
||||
BothUInt8 read = br.ReadByteBothEndian();
|
||||
Assert.Equal(0x00, read.LittleEndian);
|
||||
Assert.Equal(0x01, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadBytesTest()
|
||||
{
|
||||
@@ -92,6 +103,16 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.Equal(0x00, read);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadSByteBothEndianTest()
|
||||
{
|
||||
var stream = new MemoryStream(_bytes);
|
||||
var br = new BinaryReader(stream);
|
||||
BothInt8 read = br.ReadSByteBothEndian();
|
||||
Assert.Equal(0x00, read.LittleEndian);
|
||||
Assert.Equal(0x01, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadCharTest()
|
||||
{
|
||||
@@ -128,6 +149,16 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.Equal(0x0100, read);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadInt16BothEndianTest()
|
||||
{
|
||||
var stream = new MemoryStream(_bytes);
|
||||
var br = new BinaryReader(stream);
|
||||
BothInt16 read = br.ReadInt16BothEndian();
|
||||
Assert.Equal(0x0100, read.LittleEndian);
|
||||
Assert.Equal(0x0203, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadUInt16Test()
|
||||
{
|
||||
@@ -155,6 +186,16 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.Equal(0x0100, read);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadUInt16BothEndianTest()
|
||||
{
|
||||
var stream = new MemoryStream(_bytes);
|
||||
var br = new BinaryReader(stream);
|
||||
BothUInt16 read = br.ReadUInt16BothEndian();
|
||||
Assert.Equal(0x0100, read.LittleEndian);
|
||||
Assert.Equal(0x0203, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadWORDTest()
|
||||
{
|
||||
@@ -182,6 +223,16 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.Equal(0x0100, read);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadWORDBothEndianTest()
|
||||
{
|
||||
var stream = new MemoryStream(_bytes);
|
||||
var br = new BinaryReader(stream);
|
||||
BothUInt16 read = br.ReadWORDBothEndian();
|
||||
Assert.Equal(0x0100, read.LittleEndian);
|
||||
Assert.Equal(0x0203, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadHalfTest()
|
||||
{
|
||||
@@ -283,6 +334,16 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.Equal(0x03020100, read);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadInt32BothEndianTest()
|
||||
{
|
||||
var stream = new MemoryStream(_bytes);
|
||||
var br = new BinaryReader(stream);
|
||||
BothInt32 read = br.ReadInt32BothEndian();
|
||||
Assert.Equal(0x03020100, read.LittleEndian);
|
||||
Assert.Equal(0x04050607, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadUInt32Test()
|
||||
{
|
||||
@@ -310,6 +371,16 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.Equal((uint)0x03020100, read);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadUInt32BothEndianTest()
|
||||
{
|
||||
var stream = new MemoryStream(_bytes);
|
||||
var br = new BinaryReader(stream);
|
||||
BothUInt32 read = br.ReadUInt32BothEndian();
|
||||
Assert.Equal((uint)0x03020100, read.LittleEndian);
|
||||
Assert.Equal((uint)0x04050607, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadDWORDTest()
|
||||
{
|
||||
@@ -337,6 +408,16 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.Equal((uint)0x03020100, read);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadDWORDBothEndianTest()
|
||||
{
|
||||
var stream = new MemoryStream(_bytes);
|
||||
var br = new BinaryReader(stream);
|
||||
BothUInt32 read = br.ReadDWORDBothEndian();
|
||||
Assert.Equal((uint)0x03020100, read.LittleEndian);
|
||||
Assert.Equal((uint)0x04050607, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadSingleTest()
|
||||
{
|
||||
@@ -438,6 +519,16 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.Equal(0x0706050403020100, read);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadInt64BothEndianTest()
|
||||
{
|
||||
var stream = new MemoryStream(_bytes);
|
||||
var br = new BinaryReader(stream);
|
||||
BothInt64 read = br.ReadInt64BothEndian();
|
||||
Assert.Equal(0x0706050403020100, read.LittleEndian);
|
||||
Assert.Equal(0x08090A0B0C0D0E0F, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadUInt64Test()
|
||||
{
|
||||
@@ -465,6 +556,16 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.Equal((ulong)0x0706050403020100, read);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadUInt64BothEndianTest()
|
||||
{
|
||||
var stream = new MemoryStream(_bytes);
|
||||
var br = new BinaryReader(stream);
|
||||
BothUInt64 read = br.ReadUInt64BothEndian();
|
||||
Assert.Equal((ulong)0x0706050403020100, read.LittleEndian);
|
||||
Assert.Equal((ulong)0x08090A0B0C0D0E0F, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadQWORDTest()
|
||||
{
|
||||
@@ -492,6 +593,16 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.Equal((ulong)0x0706050403020100, read);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadQWORDBothEndianTest()
|
||||
{
|
||||
var stream = new MemoryStream(_bytes);
|
||||
var br = new BinaryReader(stream);
|
||||
BothUInt64 read = br.ReadQWORDBothEndian();
|
||||
Assert.Equal((ulong)0x0706050403020100, read.LittleEndian);
|
||||
Assert.Equal((ulong)0x08090A0B0C0D0E0F, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadDoubleTest()
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
using SabreTools.IO.Extensions;
|
||||
using SabreTools.IO.Numerics;
|
||||
using Xunit;
|
||||
|
||||
namespace SabreTools.IO.Test.Extensions
|
||||
@@ -45,6 +46,15 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.Equal(0x00, read);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadByteBothEndianTest()
|
||||
{
|
||||
int offset = 0;
|
||||
BothUInt8 read = _bytes.ReadByteBothEndian(ref offset);
|
||||
Assert.Equal(0x00, read.LittleEndian);
|
||||
Assert.Equal(0x01, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadBytesTest()
|
||||
{
|
||||
@@ -62,6 +72,15 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.Equal(0x00, read);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadSByteBothEndianTest()
|
||||
{
|
||||
int offset = 0;
|
||||
BothInt8 read = _bytes.ReadSByteBothEndian(ref offset);
|
||||
Assert.Equal(0x00, read.LittleEndian);
|
||||
Assert.Equal(0x01, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadCharTest()
|
||||
{
|
||||
@@ -94,6 +113,15 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.Equal(0x0100, read);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadInt16BothEndianTest()
|
||||
{
|
||||
int offset = 0;
|
||||
BothInt16 read = _bytes.ReadInt16BothEndian(ref offset);
|
||||
Assert.Equal(0x0100, read.LittleEndian);
|
||||
Assert.Equal(0x0203, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadUInt16Test()
|
||||
{
|
||||
@@ -118,6 +146,15 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.Equal(0x0100, read);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadUInt16BothEndianTest()
|
||||
{
|
||||
int offset = 0;
|
||||
BothUInt16 read = _bytes.ReadUInt16BothEndian(ref offset);
|
||||
Assert.Equal(0x0100, read.LittleEndian);
|
||||
Assert.Equal(0x0203, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadWORDTest()
|
||||
{
|
||||
@@ -142,6 +179,15 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.Equal(0x0100, read);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadWORDBothEndianTest()
|
||||
{
|
||||
int offset = 0;
|
||||
BothUInt16 read = _bytes.ReadWORDBothEndian(ref offset);
|
||||
Assert.Equal(0x0100, read.LittleEndian);
|
||||
Assert.Equal(0x0203, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadHalfTest()
|
||||
{
|
||||
@@ -232,6 +278,15 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.Equal(0x03020100, read);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadInt32BothEndianTest()
|
||||
{
|
||||
int offset = 0;
|
||||
BothInt32 read = _bytes.ReadInt32BothEndian(ref offset);
|
||||
Assert.Equal(0x03020100, read.LittleEndian);
|
||||
Assert.Equal(0x04050607, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadUInt32Test()
|
||||
{
|
||||
@@ -256,6 +311,15 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.Equal((uint)0x03020100, read);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadUInt32BothEndianTest()
|
||||
{
|
||||
int offset = 0;
|
||||
BothUInt32 read = _bytes.ReadUInt32BothEndian(ref offset);
|
||||
Assert.Equal((uint)0x03020100, read.LittleEndian);
|
||||
Assert.Equal((uint)0x04050607, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadDWORDTest()
|
||||
{
|
||||
@@ -280,6 +344,15 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.Equal((uint)0x03020100, read);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadDWORDBothEndianTest()
|
||||
{
|
||||
int offset = 0;
|
||||
BothUInt32 read = _bytes.ReadDWORDBothEndian(ref offset);
|
||||
Assert.Equal((uint)0x03020100, read.LittleEndian);
|
||||
Assert.Equal((uint)0x04050607, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadSingleTest()
|
||||
{
|
||||
@@ -370,6 +443,15 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.Equal(0x0706050403020100, read);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadInt64BothEndianTest()
|
||||
{
|
||||
int offset = 0;
|
||||
BothInt64 read = _bytes.ReadInt64BothEndian(ref offset);
|
||||
Assert.Equal(0x0706050403020100, read.LittleEndian);
|
||||
Assert.Equal(0x08090A0B0C0D0E0F, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadUInt64Test()
|
||||
{
|
||||
@@ -394,6 +476,15 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.Equal((ulong)0x0706050403020100, read);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadUInt64BothEndianTest()
|
||||
{
|
||||
int offset = 0;
|
||||
BothUInt64 read = _bytes.ReadUInt64BothEndian(ref offset);
|
||||
Assert.Equal((ulong)0x0706050403020100, read.LittleEndian);
|
||||
Assert.Equal((ulong)0x08090A0B0C0D0E0F, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadQWORDTest()
|
||||
{
|
||||
@@ -418,6 +509,15 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.Equal((ulong)0x0706050403020100, read);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadQWORDBothEndianTest()
|
||||
{
|
||||
int offset = 0;
|
||||
BothUInt64 read = _bytes.ReadQWORDBothEndian(ref offset);
|
||||
Assert.Equal((ulong)0x0706050403020100, read.LittleEndian);
|
||||
Assert.Equal((ulong)0x08090A0B0C0D0E0F, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadDoubleTest()
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
using SabreTools.IO.Extensions;
|
||||
using SabreTools.IO.Numerics;
|
||||
using Xunit;
|
||||
|
||||
namespace SabreTools.IO.Test.Extensions
|
||||
@@ -58,6 +59,15 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.True(read.SequenceEqual(_bytes.Take(length)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadByteBothEndianTest()
|
||||
{
|
||||
var stream = new MemoryStream(_bytes);
|
||||
BothUInt8 read = stream.ReadByteBothEndian();
|
||||
Assert.Equal(0x00, read.LittleEndian);
|
||||
Assert.Equal(0x01, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadSByteTest()
|
||||
{
|
||||
@@ -66,6 +76,15 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.Equal(0x00, read);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadSByteBothEndianTest()
|
||||
{
|
||||
var stream = new MemoryStream(_bytes);
|
||||
BothInt8 read = stream.ReadSByteBothEndian();
|
||||
Assert.Equal(0x00, read.LittleEndian);
|
||||
Assert.Equal(0x01, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadCharTest()
|
||||
{
|
||||
@@ -98,6 +117,15 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.Equal(0x0100, read);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadInt16BothEndianTest()
|
||||
{
|
||||
var stream = new MemoryStream(_bytes);
|
||||
BothInt16 read = stream.ReadInt16BothEndian();
|
||||
Assert.Equal(0x0100, read.LittleEndian);
|
||||
Assert.Equal(0x0203, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadUInt16Test()
|
||||
{
|
||||
@@ -122,6 +150,15 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.Equal(0x0100, read);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadUInt16BothEndianTest()
|
||||
{
|
||||
var stream = new MemoryStream(_bytes);
|
||||
BothUInt16 read = stream.ReadUInt16BothEndian();
|
||||
Assert.Equal(0x0100, read.LittleEndian);
|
||||
Assert.Equal(0x0203, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadWORDTest()
|
||||
{
|
||||
@@ -146,6 +183,15 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.Equal(0x0100, read);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadWORDBothEndianTest()
|
||||
{
|
||||
var stream = new MemoryStream(_bytes);
|
||||
BothUInt16 read = stream.ReadWORDBothEndian();
|
||||
Assert.Equal(0x0100, read.LittleEndian);
|
||||
Assert.Equal(0x0203, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadHalfTest()
|
||||
{
|
||||
@@ -236,6 +282,15 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.Equal(0x03020100, read);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadInt32BothEndianTest()
|
||||
{
|
||||
var stream = new MemoryStream(_bytes);
|
||||
BothInt32 read = stream.ReadInt32BothEndian();
|
||||
Assert.Equal(0x03020100, read.LittleEndian);
|
||||
Assert.Equal(0x04050607, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadUInt32Test()
|
||||
{
|
||||
@@ -260,6 +315,15 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.Equal((uint)0x03020100, read);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadUInt32BothEndianTest()
|
||||
{
|
||||
var stream = new MemoryStream(_bytes);
|
||||
BothUInt32 read = stream.ReadUInt32BothEndian();
|
||||
Assert.Equal((uint)0x03020100, read.LittleEndian);
|
||||
Assert.Equal((uint)0x04050607, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadDWORDTest()
|
||||
{
|
||||
@@ -284,6 +348,15 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.Equal((uint)0x03020100, read);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadDWORDBothEndianTest()
|
||||
{
|
||||
var stream = new MemoryStream(_bytes);
|
||||
BothUInt32 read = stream.ReadDWORDBothEndian();
|
||||
Assert.Equal((uint)0x03020100, read.LittleEndian);
|
||||
Assert.Equal((uint)0x04050607, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadSingleTest()
|
||||
{
|
||||
@@ -374,6 +447,15 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.Equal(0x0706050403020100, read);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadInt64BothEndianTest()
|
||||
{
|
||||
var stream = new MemoryStream(_bytes);
|
||||
BothInt64 read = stream.ReadInt64BothEndian();
|
||||
Assert.Equal(0x0706050403020100, read.LittleEndian);
|
||||
Assert.Equal(0x08090A0B0C0D0E0F, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadUInt64Test()
|
||||
{
|
||||
@@ -398,6 +480,15 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.Equal((ulong)0x0706050403020100, read);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadUInt64BothEndianTest()
|
||||
{
|
||||
var stream = new MemoryStream(_bytes);
|
||||
BothUInt64 read = stream.ReadUInt64BothEndian();
|
||||
Assert.Equal((ulong)0x0706050403020100, read.LittleEndian);
|
||||
Assert.Equal((ulong)0x08090A0B0C0D0E0F, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadQWORDTest()
|
||||
{
|
||||
@@ -422,6 +513,15 @@ namespace SabreTools.IO.Test.Extensions
|
||||
Assert.Equal((ulong)0x0706050403020100, read);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadQWORDBothEndianTest()
|
||||
{
|
||||
var stream = new MemoryStream(_bytes);
|
||||
BothUInt64 read = stream.ReadQWORDBothEndian();
|
||||
Assert.Equal((ulong)0x0706050403020100, read.LittleEndian);
|
||||
Assert.Equal((ulong)0x08090A0B0C0D0E0F, read.BigEndian);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadDoubleTest()
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Numerics;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using SabreTools.IO.Numerics;
|
||||
|
||||
namespace SabreTools.IO.Extensions
|
||||
{
|
||||
@@ -17,6 +18,24 @@ namespace SabreTools.IO.Extensions
|
||||
{
|
||||
#region Exact Read
|
||||
|
||||
/// <inheritdoc cref="BinaryReader.ReadByte"/>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothUInt8 ReadByteBothEndian(this BinaryReader reader)
|
||||
{
|
||||
byte le = reader.ReadByte();
|
||||
byte be = reader.ReadByte();
|
||||
return new BothUInt8(le, be);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="BinaryReader.ReadSByte"/>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothInt8 ReadSByteBothEndian(this BinaryReader reader)
|
||||
{
|
||||
sbyte le = reader.ReadSByte();
|
||||
sbyte be = reader.ReadSByte();
|
||||
return new BothInt8(le, be);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="BinaryReader.ReadInt16"/>
|
||||
/// <remarks>Reads in big-endian format</remarks>
|
||||
public static short ReadInt16BigEndian(this BinaryReader reader)
|
||||
@@ -35,6 +54,15 @@ namespace SabreTools.IO.Extensions
|
||||
| (buffer[1] << 8));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="BinaryReader.ReadInt16"/>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothInt16 ReadInt16BothEndian(this BinaryReader reader)
|
||||
{
|
||||
short le = reader.ReadInt16();
|
||||
short be = reader.ReadInt16BigEndian();
|
||||
return new BothInt16(le, be);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="BinaryReader.ReadUInt16"/>
|
||||
/// <remarks>Reads in big-endian format</remarks>
|
||||
public static ushort ReadUInt16BigEndian(this BinaryReader reader)
|
||||
@@ -53,6 +81,15 @@ namespace SabreTools.IO.Extensions
|
||||
| (buffer[1] << 8));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="BinaryReader.ReadUInt16"/>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothUInt16 ReadUInt16BothEndian(this BinaryReader reader)
|
||||
{
|
||||
ushort le = reader.ReadUInt16();
|
||||
ushort be = reader.ReadUInt16BigEndian();
|
||||
return new BothUInt16(le, be);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a WORD (2-byte) from the base stream
|
||||
/// </summary>
|
||||
@@ -73,6 +110,13 @@ namespace SabreTools.IO.Extensions
|
||||
public static ushort ReadWORDLittleEndian(this BinaryReader reader)
|
||||
=> reader.ReadUInt16LittleEndian();
|
||||
|
||||
/// <summary>
|
||||
/// Read a WORD (2-byte) from the base stream
|
||||
/// </summary>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothUInt16 ReadWORDBothEndian(this BinaryReader reader)
|
||||
=> reader.ReadUInt16BothEndian();
|
||||
|
||||
// Half was introduced in net5.0 but doesn't have a BitConverter implementation until net6.0
|
||||
#if NET6_0_OR_GREATER
|
||||
/// <inheritdoc cref="BinaryReader.ReadHalf"/>
|
||||
@@ -179,6 +223,15 @@ namespace SabreTools.IO.Extensions
|
||||
| (buffer[3] << 24));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="BinaryReader.ReadInt32"/>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothInt32 ReadInt32BothEndian(this BinaryReader reader)
|
||||
{
|
||||
int le = reader.ReadInt32();
|
||||
int be = reader.ReadInt32BigEndian();
|
||||
return new BothInt32(le, be);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="BinaryReader.ReadUInt32"/>
|
||||
/// <remarks>Reads in big-endian format</remarks>
|
||||
public static uint ReadUInt32BigEndian(this BinaryReader reader)
|
||||
@@ -201,6 +254,15 @@ namespace SabreTools.IO.Extensions
|
||||
| (buffer[3] << 24));
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="BinaryReader.ReadUInt32"/>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothUInt32 ReadUInt32BothEndian(this BinaryReader reader)
|
||||
{
|
||||
uint le = reader.ReadUInt32();
|
||||
uint be = reader.ReadUInt32BigEndian();
|
||||
return new BothUInt32(le, be);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a DWORD (4-byte) from the base stream
|
||||
/// </summary>
|
||||
@@ -221,6 +283,13 @@ namespace SabreTools.IO.Extensions
|
||||
public static uint ReadDWORDLittleEndian(this BinaryReader reader)
|
||||
=> reader.ReadUInt32LittleEndian();
|
||||
|
||||
/// <summary>
|
||||
/// Read a DWORD (4-byte) from the base stream
|
||||
/// </summary>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothUInt32 ReadDWORDBothEndian(this BinaryReader reader)
|
||||
=> reader.ReadUInt32BothEndian();
|
||||
|
||||
/// <inheritdoc cref="BinaryReader.ReadSingle"/>
|
||||
/// <remarks>Reads in big-endian format</remarks>
|
||||
public static float ReadSingleBigEndian(this BinaryReader reader)
|
||||
@@ -344,6 +413,15 @@ namespace SabreTools.IO.Extensions
|
||||
| ((long)buffer[7] << 56);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="BinaryReader.ReadInt64"/>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothInt64 ReadInt64BothEndian(this BinaryReader reader)
|
||||
{
|
||||
long le = reader.ReadInt64();
|
||||
long be = reader.ReadInt64BigEndian();
|
||||
return new BothInt64(le, be);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="BinaryReader.ReadUInt64"/>
|
||||
/// <remarks>Reads in big-endian format</remarks>
|
||||
public static ulong ReadUInt64BigEndian(this BinaryReader reader)
|
||||
@@ -374,6 +452,15 @@ namespace SabreTools.IO.Extensions
|
||||
| ((ulong)buffer[7] << 56);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="BinaryReader.ReadUInt64"/>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothUInt64 ReadUInt64BothEndian(this BinaryReader reader)
|
||||
{
|
||||
ulong le = reader.ReadUInt64();
|
||||
ulong be = reader.ReadUInt64BigEndian();
|
||||
return new BothUInt64(le, be);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a QWORD (8-byte) from the base stream
|
||||
/// </summary>
|
||||
@@ -395,6 +482,13 @@ namespace SabreTools.IO.Extensions
|
||||
public static ulong ReadQWORDLittleEndian(this BinaryReader reader)
|
||||
=> reader.ReadUInt64LittleEndian();
|
||||
|
||||
/// <summary>
|
||||
/// Read a QWORD (8-byte) from the base stream
|
||||
/// </summary>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothUInt64 ReadQWORDBothEndian(this BinaryReader reader)
|
||||
=> reader.ReadUInt64BothEndian();
|
||||
|
||||
/// <inheritdoc cref="BinaryReader.ReadDouble"/>
|
||||
/// <remarks>Reads in big-endian format</remarks>
|
||||
public static double ReadDoubleBigEndian(this BinaryReader reader)
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Numerics;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using SabreTools.IO.Numerics;
|
||||
|
||||
namespace SabreTools.IO.Extensions
|
||||
{
|
||||
@@ -31,6 +32,17 @@ namespace SabreTools.IO.Extensions
|
||||
public static byte ReadByteValue(this byte[] content, ref int offset)
|
||||
=> content.ReadByte(ref offset);
|
||||
|
||||
/// <summary>
|
||||
/// Read a UInt8 and increment the pointer to an array
|
||||
/// </summary>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothUInt8 ReadByteBothEndian(this byte[] content, ref int offset)
|
||||
{
|
||||
byte le = content.ReadByte(ref offset);
|
||||
byte be = content.ReadByte(ref offset);
|
||||
return new BothUInt8(le, be);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a UInt8[] and increment the pointer to an array
|
||||
/// </summary>
|
||||
@@ -46,6 +58,17 @@ namespace SabreTools.IO.Extensions
|
||||
return (sbyte)buffer[0];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a Int8 and increment the pointer to an array
|
||||
/// </summary>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothInt8 ReadSByteBothEndian(this byte[] content, ref int offset)
|
||||
{
|
||||
sbyte le = content.ReadSByte(ref offset);
|
||||
sbyte be = content.ReadSByte(ref offset);
|
||||
return new BothInt8(le, be);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a Char and increment the pointer to an array
|
||||
/// </summary>
|
||||
@@ -89,6 +112,17 @@ namespace SabreTools.IO.Extensions
|
||||
| (buffer[1] << 8));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a Int16 and increment the pointer to an array
|
||||
/// </summary>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothInt16 ReadInt16BothEndian(this byte[] content, ref int offset)
|
||||
{
|
||||
short le = content.ReadInt16LittleEndian(ref offset);
|
||||
short be = content.ReadInt16BigEndian(ref offset);
|
||||
return new BothInt16(le, be);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a UInt16 and increment the pointer to an array
|
||||
/// </summary>
|
||||
@@ -123,6 +157,17 @@ namespace SabreTools.IO.Extensions
|
||||
| (buffer[1] << 8));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a UInt16 and increment the pointer to an array
|
||||
/// </summary>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothUInt16 ReadUInt16BothEndian(this byte[] content, ref int offset)
|
||||
{
|
||||
ushort le = content.ReadUInt16LittleEndian(ref offset);
|
||||
ushort be = content.ReadUInt16BigEndian(ref offset);
|
||||
return new BothUInt16(le, be);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a WORD (2-byte) and increment the pointer to an array
|
||||
/// </summary>
|
||||
@@ -144,6 +189,13 @@ namespace SabreTools.IO.Extensions
|
||||
public static ushort ReadWORDLittleEndian(this byte[] content, ref int offset)
|
||||
=> content.ReadUInt16LittleEndian(ref offset);
|
||||
|
||||
/// <summary>
|
||||
/// Read a WORD (2-byte) and increment the pointer to an array
|
||||
/// </summary>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothUInt16 ReadWORDBothEndian(this byte[] content, ref int offset)
|
||||
=> content.ReadUInt16BothEndian(ref offset);
|
||||
|
||||
// Half was introduced in net5.0 but doesn't have a BitConverter implementation until net6.0
|
||||
#if NET6_0_OR_GREATER
|
||||
/// <summary>
|
||||
@@ -278,6 +330,17 @@ namespace SabreTools.IO.Extensions
|
||||
| (buffer[3] << 24));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a Int32 and increment the pointer to an array
|
||||
/// </summary>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothInt32 ReadInt32BothEndian(this byte[] content, ref int offset)
|
||||
{
|
||||
int le = content.ReadInt32LittleEndian(ref offset);
|
||||
int be = content.ReadInt32BigEndian(ref offset);
|
||||
return new BothInt32(le, be);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a UInt32 and increment the pointer to an array
|
||||
/// </summary>
|
||||
@@ -316,6 +379,17 @@ namespace SabreTools.IO.Extensions
|
||||
| (buffer[3] << 24));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a UInt32 and increment the pointer to an array
|
||||
/// </summary>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothUInt32 ReadUInt32BothEndian(this byte[] content, ref int offset)
|
||||
{
|
||||
uint le = content.ReadUInt32LittleEndian(ref offset);
|
||||
uint be = content.ReadUInt32BigEndian(ref offset);
|
||||
return new BothUInt32(le, be);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a DWORD (4-byte) and increment the pointer to an array
|
||||
/// </summary>
|
||||
@@ -337,6 +411,13 @@ namespace SabreTools.IO.Extensions
|
||||
public static uint ReadDWORDLittleEndian(this byte[] content, ref int offset)
|
||||
=> content.ReadUInt32LittleEndian(ref offset);
|
||||
|
||||
/// <summary>
|
||||
/// Read a DWORD (4-byte) and increment the pointer to an array
|
||||
/// </summary>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothUInt32 ReadDWORDBothEndian(this byte[] content, ref int offset)
|
||||
=> content.ReadUInt32BothEndian(ref offset);
|
||||
|
||||
/// <summary>
|
||||
/// Read a Single and increment the pointer to an array
|
||||
/// </summary>
|
||||
@@ -488,6 +569,17 @@ namespace SabreTools.IO.Extensions
|
||||
| ((long)buffer[7] << 56);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a Int64 and increment the pointer to an array
|
||||
/// </summary>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothInt64 ReadInt64BothEndian(this byte[] content, ref int offset)
|
||||
{
|
||||
long le = content.ReadInt64LittleEndian(ref offset);
|
||||
long be = content.ReadInt64BigEndian(ref offset);
|
||||
return new BothInt64(le, be);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a UInt64 and increment the pointer to an array
|
||||
/// </summary>
|
||||
@@ -534,6 +626,17 @@ namespace SabreTools.IO.Extensions
|
||||
| ((ulong)buffer[7] << 56);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a UInt64 and increment the pointer to an array
|
||||
/// </summary>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothUInt64 ReadUInt64BothEndian(this byte[] content, ref int offset)
|
||||
{
|
||||
ulong le = content.ReadUInt64LittleEndian(ref offset);
|
||||
ulong be = content.ReadUInt64BigEndian(ref offset);
|
||||
return new BothUInt64(le, be);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a QWORD (8-byte) and increment the pointer to an array
|
||||
/// </summary>
|
||||
@@ -555,6 +658,13 @@ namespace SabreTools.IO.Extensions
|
||||
public static ulong ReadQWORDLittleEndian(this byte[] content, ref int offset)
|
||||
=> content.ReadUInt64LittleEndian(ref offset);
|
||||
|
||||
/// <summary>
|
||||
/// Read a QWORD (8-byte) and increment the pointer to an array
|
||||
/// </summary>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothUInt64 ReadQWORDBothEndian(this byte[] content, ref int offset)
|
||||
=> content.ReadUInt64BothEndian(ref offset);
|
||||
|
||||
/// <summary>
|
||||
/// Read a Double and increment the pointer to an array
|
||||
/// </summary>
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Numerics;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using SabreTools.IO.Numerics;
|
||||
|
||||
namespace SabreTools.IO.Extensions
|
||||
{
|
||||
@@ -26,6 +27,17 @@ namespace SabreTools.IO.Extensions
|
||||
return buffer[0];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a UInt8 from the stream
|
||||
/// </summary>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothUInt8 ReadByteBothEndian(this Stream stream)
|
||||
{
|
||||
byte le = stream.ReadByteValue();
|
||||
byte be = stream.ReadByteValue();
|
||||
return new BothUInt8(le, be);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a UInt8[] from the stream
|
||||
/// </summary>
|
||||
@@ -41,6 +53,17 @@ namespace SabreTools.IO.Extensions
|
||||
return (sbyte)buffer[0];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a UInt8 from the stream
|
||||
/// </summary>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothInt8 ReadSByteBothEndian(this Stream stream)
|
||||
{
|
||||
sbyte le = stream.ReadSByte();
|
||||
sbyte be = stream.ReadSByte();
|
||||
return new BothInt8(le, be);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a Char from the stream
|
||||
/// </summary>
|
||||
@@ -84,6 +107,17 @@ namespace SabreTools.IO.Extensions
|
||||
| (buffer[1] << 8));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a Int16 from the stream
|
||||
/// </summary>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothInt16 ReadInt16BothEndian(this Stream stream)
|
||||
{
|
||||
short le = stream.ReadInt16LittleEndian();
|
||||
short be = stream.ReadInt16BigEndian();
|
||||
return new BothInt16(le, be);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a UInt16 from the stream
|
||||
/// </summary>
|
||||
@@ -118,6 +152,17 @@ namespace SabreTools.IO.Extensions
|
||||
| (buffer[1] << 8));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a UInt16 from the stream
|
||||
/// </summary>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothUInt16 ReadUInt16BothEndian(this Stream stream)
|
||||
{
|
||||
ushort le = stream.ReadUInt16LittleEndian();
|
||||
ushort be = stream.ReadUInt16BigEndian();
|
||||
return new BothUInt16(le, be);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a WORD (2-byte) from the stream
|
||||
/// </summary>
|
||||
@@ -139,6 +184,13 @@ namespace SabreTools.IO.Extensions
|
||||
public static ushort ReadWORDLittleEndian(this Stream stream)
|
||||
=> stream.ReadUInt16LittleEndian();
|
||||
|
||||
/// <summary>
|
||||
/// Read a WORD (2-byte) from the stream
|
||||
/// </summary>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothUInt16 ReadWORDBothEndian(this Stream stream)
|
||||
=> stream.ReadUInt16BothEndian();
|
||||
|
||||
// Half was introduced in net5.0 but doesn't have a BitConverter implementation until net6.0
|
||||
#if NET6_0_OR_GREATER
|
||||
/// <summary>
|
||||
@@ -273,6 +325,17 @@ namespace SabreTools.IO.Extensions
|
||||
| (buffer[3] << 24));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a Int32 from the stream
|
||||
/// </summary>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothInt32 ReadInt32BothEndian(this Stream stream)
|
||||
{
|
||||
int le = stream.ReadInt32LittleEndian();
|
||||
int be = stream.ReadInt32BigEndian();
|
||||
return new BothInt32(le, be);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a UInt32 from the stream
|
||||
/// </summary>
|
||||
@@ -311,6 +374,17 @@ namespace SabreTools.IO.Extensions
|
||||
| (buffer[3] << 24));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a UInt32 from the stream
|
||||
/// </summary>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothUInt32 ReadUInt32BothEndian(this Stream stream)
|
||||
{
|
||||
uint le = stream.ReadUInt32LittleEndian();
|
||||
uint be = stream.ReadUInt32BigEndian();
|
||||
return new BothUInt32(le, be);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a DWORD (4-byte) from the stream
|
||||
/// </summary>
|
||||
@@ -332,6 +406,13 @@ namespace SabreTools.IO.Extensions
|
||||
public static uint ReadDWORDLittleEndian(this Stream stream)
|
||||
=> stream.ReadUInt32LittleEndian();
|
||||
|
||||
/// <summary>
|
||||
/// Read a DWORD (4-byte) from the stream
|
||||
/// </summary>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothUInt32 ReadDWORDBothEndian(this Stream stream)
|
||||
=> stream.ReadUInt32BothEndian();
|
||||
|
||||
/// <summary>
|
||||
/// Read a Single from the stream
|
||||
/// </summary>
|
||||
@@ -483,6 +564,17 @@ namespace SabreTools.IO.Extensions
|
||||
| ((long)buffer[7] << 56);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a Int64 from the stream
|
||||
/// </summary>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothInt64 ReadInt64BothEndian(this Stream stream)
|
||||
{
|
||||
long le = stream.ReadInt64LittleEndian();
|
||||
long be = stream.ReadInt64BigEndian();
|
||||
return new BothInt64(le, be);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a UInt64 from the stream
|
||||
/// </summary>
|
||||
@@ -529,6 +621,17 @@ namespace SabreTools.IO.Extensions
|
||||
| ((ulong)buffer[7] << 56);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a UInt64 from the stream
|
||||
/// </summary>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothUInt64 ReadUInt64BothEndian(this Stream stream)
|
||||
{
|
||||
ulong le = stream.ReadUInt64LittleEndian();
|
||||
ulong be = stream.ReadUInt64BigEndian();
|
||||
return new BothUInt64(le, be);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read a QWORD (8-byte) from the stream
|
||||
/// </summary>
|
||||
@@ -550,6 +653,13 @@ namespace SabreTools.IO.Extensions
|
||||
public static ulong ReadQWORDLittleEndian(this Stream stream)
|
||||
=> stream.ReadUInt64LittleEndian();
|
||||
|
||||
/// <summary>
|
||||
/// Read a QWORD (8-byte) from the stream
|
||||
/// </summary>
|
||||
/// <remarks>Reads in both-endian format</remarks>
|
||||
public static BothUInt64 ReadQWORDBothEndian(this Stream stream)
|
||||
=> stream.ReadUInt64BothEndian();
|
||||
|
||||
/// <summary>
|
||||
/// Read a Double from the stream
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user