using System.IO; using System.Text; using TBL.CSharp.Serialization.Marshal; namespace TBL.CSharp.Serialization.Utilities { public class BinaryReaderWithEndianConversion : BinaryReader { public BinaryReaderWithEndianConversion(Stream input, Encoding encoding, bool leaveOpen) : base(input, encoding, leaveOpen) { } public override decimal ReadDecimal() => base.ReadDecimal().EndianConvert(); public override double ReadDouble() => base.ReadDouble().EndianConvert(); public override short ReadInt16() => base.ReadInt16().EndianConvert(); public override int ReadInt32() => base.ReadInt32().EndianConvert(); public override long ReadInt64() => base.ReadInt64().EndianConvert(); public override float ReadSingle() => base.ReadSingle().EndianConvert(); public override ushort ReadUInt16() => base.ReadUInt16().EndianConvert(); public override uint ReadUInt32() => base.ReadUInt32().EndianConvert(); public override ulong ReadUInt64() => base.ReadUInt64().EndianConvert(); } }