Skip to content

Releases: Kermalis/EndianBinaryIO

v2.1.1 - .NET 7.0 + .NET 8.0

08 Jun 04:58
Compare
Choose a tag to compare

Version 2.1.1 Changelog:

  • .NET 7.0 and .NET 8.0 support.
  • Small optimization when reading empty strings.
  • Can set the Stream on EndianBinaryReader and EndianBinaryWriter.

No breaking changes from v2.1.0

v2.1.0 - .NET 7.0

03 Feb 05:27
fcabdb9
Compare
Choose a tag to compare

Version 2.1.0 Changelog:

  • .NET 7.0 support only.
  • Added methods for reading/writing Int128/UInt128.
  • Added TrimNullTerminators(ref ReadOnlySpan<char> chars) to EndianBinaryPrimitives.
  • Added "unsafe" methods to EndianBinaryPrimitives that read/write to/from ReadOnlySpan<T>/Span<T>. These are similar to their non-_Unsafe counterparts, 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

31 Aug 22:07
Compare
Choose a tag to compare

Version 2.0.1 Changelog:

  • Added TrimNullTerminators(ref char[] chars) and TrimNullTerminators(ref Span<char> chars) to EndianBinaryPrimitives which will remove all '\0' from the end
  • Added ReadSBytes(ReadOnlySpan<byte> src, Span<sbyte> dest) and WriteSBytes(Span<byte> dest, ReadOnlySpan<sbyte> src) to EndianBinaryPrimitives
  • Added heavily optimized enum methods to EndianBinaryPrimitives that use the same optimization techniques as the ones in EndianBinaryReader and EndianBinaryWriter
  • Added PeekBytes(Span<byte> dest) to EndianBinaryReader

No breaking changes from v2.0.0

v2.0.0 - .NET 6.0

30 Aug 20:07
f7581f8
Compare
Choose a tag to compare

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 a TEnum that is the size of a byte will condense down to just a ReadByte() call with no size/type checks
  • Implemented reading and writing for Half, DateOnly, TimeOnly, Vector2, Vector3, Vector4, Quaternion, and Matrix4x4
  • 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 which BooleanSize to use) which you can change at any time
  • decimal int order now matches with .net APIs
  • Removed EndianBitConverter in favor of EndianBinaryPrimitives, which has similar API while using modern programming like Span<T>
  • API uses nullable notations
  • You can now ReadObject() and WriteObject() with primitives and other supported types like DateTime, Vector3, etc.
  • Removed Encoding usage. 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

15 Sep 12:17
Compare
Choose a tag to compare

This release fixes problems with surrogate pairs when encoding/decoding chars/strings.

  • All characters covered under the encoding should be fair game now.
  • charCount still refers to the amount of UTF16 chars it'd take to store the string. For example, an emoji in UTF32 is one UTF32 char, but two UTF16 chars. For that emoji, charCount should be 2 when 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

11 Sep 09:20
Compare
Choose a tag to compare

Fixes critical bug #20

v1.1.0

11 Sep 08:45
Compare
Choose a tag to compare

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

  • EndianBitConverter static class. Very similar to System.BitConverter provided 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 with BinaryStringNullTerminatedAttribute.

Nice

  • Attributes optimized
  • You will now get an ArgumentOutOfRangeException when passing in invalid BooleanSize, Endianness, or EncodingType enum 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 EndianBinaryWriter have had the index parameter renamed to startIndex. 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 now EndianBinaryReader.ReadChars(int count, bool trimNullTerminated)

v1.0.3

08 Sep 22:50
Compare
Choose a tag to compare
  • Array sizes of 0 are now allowed
  • Array sizes are checked to be < 0 before they crash (better error message)
  • Read string[] and write string[] methods
  • ReadStringNullTerminated was optimized

v1.0.2

08 Sep 08:31
Compare
Choose a tag to compare
  • Fixes reading decimals
  • Allows reading/writing DateTimes automatically in EndianBinaryReader.ReadIntoObject(object) and EndianBinaryWriter.Write(object)
  • Two overloads for reading/writing IBinarySerializable, although you should just call obj.Read() and obj.Write() instead

v1.0.1

07 Sep 04:06
Compare
Choose a tag to compare

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().