Skip to content

Provides streaming operations similar and interoperate to C# in binary

License

Notifications You must be signed in to change notification settings

Silencersn/BinaryIO

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

BinaryIO

Provides streaming operations similar and interoperate to C# in binary.

Including classes: BinaryWriter, BinaryReader and BinaryPrimitives.

Types

byte

typedef uint8_t byte;

sbyte

typedef int8_t sbyte;

half

struct CSharpHalf
{
	uint16_t _value;
};
typedef CSharpHalf half;

decimal

struct CSharpDecimal
{
	int32_t _flags;
	uint32_t _hi32;
	uint64_t _lo64;
};
typedef CSharpDecimal decimal;

BinaryWriter

BinaryIO C# Notes
Wirte(sbyte) Wirte(sbyte)
Wirte(byte) Wirte(byte)
Wirte(int16_t) Wirte(short)
Wirte(uint16_t) Wirte(ushort)
Wirte(int32_t) Wirte(int)
Wirte(uint32_t) Wirte(uint)
Wirte(int64_t) Wirte(long)
Wirte(uint64_t) Wirte(ulong)
Wirte(bool) Wirte(bool)
Write(const byte*, std::streamsize, std::streamsize) Write(byte[], int, int)
Write(const char*, std::streamsize, std::streamsize) Write(byte[], int, int)
Write(const byte*, std::streamsize) Write(byte[], int, int) index is 0
Write(const char*, std::streamsize) Write(byte[], int, int) index is 0
Write(const char*) Write(string) ignores encoding
Write(std::string) Write(string) ignores encoding
Write7BitEncodedInt(int32_t) Write7BitEncodedInt(int)
Write7BitEncodedInt64(int64_t) Write7BitEncodedInt64(long)
Wirte(half) Wirte(Half) marshaled as Half in C#
Wirte(decimal) Wirte(decimal) marshaled as decimal in C#
WriteUnaligned(T) same as Unsafe.WriteUnaligned(T)
Flush() Flush()
Seek(std::streamoff, std::ios_base::seekdir) Seek(int, SeekOrigin)

BinaryPrimitives

BinaryIO C# Notes
ReadSByte() ReadSByte()
ReadByte() ReadByte()
ReadInt16() ReadInt16()
ReadUInt16() ReadUInt16()
ReadInt32() ReadInt32()
ReadUInt32() ReadUInt32()
ReadInt64() ReadInt64()
ReadUInt64() ReadUInt64()
ReadBoolean() ReadBoolean()
Read(byte*, std::streamsize, std::streamsize) Read(byte[], int, int)
Read(char*, std::streamsize, std::streamsize) Read(byte[], int, int)
Read(byte*, std::streamsize) Read(byte[], int, int) index is 0
Read(char*, std::streamsize) Read(byte[], int, int) index is 0
ReadString() ReadString() ignore encoding
Read7BitEncodedInt() Read7BitEncodedInt()
Read7BitEncodedInt64() Read7BitEncodedInt64()
ReadHalf() ReadHalf() marshaled as Half in C#
ReadDecimal() ReadDecimal() marshaled as decimal in C#
ReadUnaligned() same as Unsafe.ReadUnaligned()

BinaryPrimitives

BinaryIO C# Notes
ReadUInt16LittleEndian(const byte*) ReadUInt16LittleEndian(ReadOnlySpan)
ReadUInt32LittleEndian(const byte*) ReadUInt32LittleEndian(ReadOnlySpan)
ReadUInt64LittleEndian(const byte*) ReadUInt64LittleEndian(ReadOnlySpan)
ReadInt16LittleEndian(const byte*) ReadInt16LittleEndian(ReadOnlySpan)
ReadInt32LittleEndian(const byte*) ReadInt32LittleEndian(ReadOnlySpan)
ReadInt64LittleEndian(const byte*) ReadInt64LittleEndian(ReadOnlySpan)
ReadSingleLittleEndian(const byte*) ReadSingleLittleEndian(ReadOnlySpan)
ReadDoubleLittleEndian(const byte*) ReadDoubleLittleEndian(ReadOnlySpan)
ReadUInt16BigEndian(const byte*) ReadUInt16BigEndian(ReadOnlySpan)
ReadUInt32BigEndian(const byte*) ReadUInt32BigEndian(ReadOnlySpan)
ReadUInt64BigEndian(const byte*) ReadUInt64BigEndian(ReadOnlySpan)
ReadInt16BigEndian(const byte*) ReadInt16BigEndian(ReadOnlySpan)
ReadInt32BigEndian(const byte*) ReadInt32BigEndian(ReadOnlySpan)
ReadInt64BigEndian(const byte*) ReadInt64BigEndian(ReadOnlySpan)
ReadSingleBigEndian(const byte*) ReadSingleBigEndian(ReadOnlySpan)
ReadDoubleBigEndian(const byte*) ReadDoubleBigEndian(ReadOnlySpan)
WriteUInt16LittleEndian(byte*, uint16_t) WriteUInt16LittleEndian(Span, ushort)
WriteUInt32LittleEndian(byte*, uint32_t) WriteUInt32LittleEndian(Span, uint)
WriteUInt64LittleEndian(byte*, uint64_t) WriteUInt64LittleEndian(Span, ulong)
WriteInt16LittleEndian(byte*, int16_t) WriteInt16LittleEndian(Span, short)
WriteInt32LittleEndian(byte*, int32_t) WriteInt32LittleEndian(Span, int)
WriteInt64LittleEndian(byte*, int64_t) WriteInt64LittleEndian(Span, long)
WriteSingleLittleEndian(byte*, float) WriteSingleLittleEndian(Span, float)
WriteDoubleLittleEndian(byte*, double) WriteDoubleLittleEndian(Span, double)
WriteUInt16BigEndian(byte*, uint16_t) WriteUInt16BigEndian(Span, ushort)
WriteUInt32BigEndian(byte*, uint32_t) WriteUInt32BigEndian(Span, uint)
WriteUInt64BigEndian(byte*, uint64_t) WriteUInt64BigEndian(Span, ulong)
WriteInt16BigEndian(byte*, int16_t) WriteInt16BigEndian(Span, short)
WriteInt32BigEndian(byte*, int32_t) WriteInt32BigEndian(Span, int)
WriteInt64BigEndian(byte*, int64_t) WriteInt64BigEndian(Span, long)
WriteSingleBigEndian(byte*, float) WriteSingleBigEndian(Span, float)
WriteDoubleBigEndian(byte*, double) WriteDoubleBigEndian(Span, double)
ReverseEndianness(uint16_t) ReverseEndianness(ushort)
ReverseEndianness(uint32_t) ReverseEndianness(uint)
ReverseEndianness(uint64_t) ReverseEndianness(ulong)
ReverseEndianness(int16_t) ReverseEndianness(short)
ReverseEndianness(int32_t) ReverseEndianness(int)
ReverseEndianness(int64_t) ReverseEndianness(long)

About

Provides streaming operations similar and interoperate to C# in binary

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published