Releases: Kermalis/EndianBinaryIO
Releases · Kermalis/EndianBinaryIO
v2.1.1 - .NET 7.0 + .NET 8.0
v2.1.0 - .NET 7.0
Version 2.1.0 Changelog:
- .NET 7.0 support only.
- Added methods for reading/writing
Int128/UInt128. - Added
TrimNullTerminators(ref ReadOnlySpan<char> chars)toEndianBinaryPrimitives. - Added "unsafe" methods to
EndianBinaryPrimitivesthat read/write to/fromReadOnlySpan<T>/Span<T>. These are similar to their non-_Unsafecounterparts, aside from the fact that they don't check for errors. Their goal is performance.
No breaking changes from v2.0.1
v2.0.1
Version 2.0.1 Changelog:
- Added
TrimNullTerminators(ref char[] chars)andTrimNullTerminators(ref Span<char> chars)toEndianBinaryPrimitiveswhich will remove all '\0' from the end - Added
ReadSBytes(ReadOnlySpan<byte> src, Span<sbyte> dest)andWriteSBytes(Span<byte> dest, ReadOnlySpan<sbyte> src)toEndianBinaryPrimitives - Added heavily optimized enum methods to
EndianBinaryPrimitivesthat use the same optimization techniques as the ones inEndianBinaryReaderandEndianBinaryWriter - Added
PeekBytes(Span<byte> dest)toEndianBinaryReader
No breaking changes from v2.0.0
v2.0.0 - .NET 6.0
Version 2.0.0 Changelog:
- Rewritten with
Span<T>and performance in mind. No allocations unless absolutely necessary - The compiler will now inline certain methods. For example,
ReadEnum<TEnum>()will only include code that will be executed for the given enum size. So passing aTEnumthat is the size of a byte will condense down to just aReadByte()call with no size/type checks - Implemented reading and writing for
Half,DateOnly,TimeOnly,Vector2,Vector3,Vector4,Quaternion, andMatrix4x4 - Removed bloated overloads (with array offset/count, alternate
Encoding/BooleanSize, null termination, etc.). The reader/writer now respects its state (such as whether to use ASCII, and whichBooleanSizeto use) which you can change at any time decimalint order now matches with .net APIs- Removed
EndianBitConverterin favor ofEndianBinaryPrimitives, which has similar API while using modern programming likeSpan<T> - API uses nullable notations
- You can now
ReadObject()andWriteObject()with primitives and other supported types likeDateTime,Vector3, etc. - Removed
Encodingusage. The whole thing was very complicated before, and it barely functioned. Now you have ASCII and .net (UTF16-LE) support by default, and can add your own requirements either by extension methods or inheriting the reader/writer
v1.1.2
This release fixes problems with surrogate pairs when encoding/decoding chars/strings.
- All characters covered under the encoding should be fair game now.
charCountstill refers to the amount ofUTF16chars it'd take to store the string. For example, an emoji inUTF32is oneUTF32char, but twoUTF16chars. For that emoji,charCountshould be2when reading and writing.- In the future, I'd like to have methods of reading by a specific number of bytes or by a specific number of text elements (so a surrogate pair will count as 1 text element despite occupying 2 chars)
v1.1.1
v1.1.0
This release is called v1.1.0 instead of v1.0.4 because it has a few breaking changes; hopefully these are the only breaking changes I will introduce for a really long time.
Additions
EndianBitConverterstatic class. Very similar toSystem.BitConverterprovided with .NET. It has a property that represents the system's endianness and has methods to convert to/from data types with specified endianness. This means the library does not need to be used with a stream every time you just want a few conversions.BinaryStringTrimNullTerminatorsAttribute- If you apply this attribute to string or char[] properties in an object, the resulting string/char[] will remove chars starting from the first '\0'. This attribute is optional and is not compatible withBinaryStringNullTerminatedAttribute.
Nice
- Attributes optimized
- You will now get an
ArgumentOutOfRangeExceptionwhen passing in invalidBooleanSize,Endianness, orEncodingTypeenum values - You will now get more descriptive errors with null arrays or invalid array count/index combinations
Fixes
- Strings should no longer completely broken on Big Endian systems (cannot test)
- Big Endian Unicode should work as intended on Big Endian systems (cannot test)
- Decimal should now work on Big Endian systems (cannot test)
Breaking changes
- All array methods in
EndianBinaryWriterhave had theindexparameter renamed tostartIndex. If you were manually referring to the parameter by its name, then you will need to change it. - char[] methods and string methods that needed a charCount now have a new parameter indicating whether the result should remove chars starting from the first '\0'. For example,
EndianBinaryReader.ReadChars(int count)is nowEndianBinaryReader.ReadChars(int count, bool trimNullTerminated)
v1.0.3
v1.0.2
- Fixes reading decimals
- Allows reading/writing DateTimes automatically in
EndianBinaryReader.ReadIntoObject(object)andEndianBinaryWriter.Write(object) - Two overloads for reading/writing
IBinarySerializable, although you should just callobj.Read()andobj.Write()instead
v1.0.1
This release adds some methods to write strings with a specified number of chars. The string will be truncated to the char count if too many are present, and \0 will be added until the string is the length of the number of chars if the string was too short.
Also included are a few optimizations to EndianBinaryReader.ReadIntoObject() and EndianBinaryWriter.WriteObject().