using System.IO; using System.Text; using TBL.CSharp.Serialization.Marshal; namespace TBL.CSharp.Serialization.Utilities { public class BinaryWriterWithEndianConversion : BinaryWriter { public BinaryWriterWithEndianConversion(Stream output, Encoding encoding, bool leaveOpen) : base(output, encoding, leaveOpen) { } public override void Write(decimal value) => base.Write(value.EndianConvert()); public override void Write(double value) => base.Write(value.EndianConvert()); public override void Write(short value) => base.Write(value.EndianConvert()); public override void Write(int value) => base.Write(value.EndianConvert()); public override void Write(long value) => base.Write(value.EndianConvert()); public override void Write(float value) => base.Write(value.EndianConvert()); public override void Write(ushort value) => base.Write(value.EndianConvert()); public override void Write(uint value) => base.Write(value.EndianConvert()); public override void Write(ulong value) => base.Write(value.EndianConvert()); } }