Giter VIP home page Giter VIP logo

kermalis / endianbinaryio Goto Github PK

View Code? Open in Web Editor NEW
27.0 27.0 5.0 237 KB

A C# library that can read and write primitives, enums, arrays, and strings to streams and byte arrays with specified endianness, string encoding, and boolean sizes.

License: MIT License

C# 100.00%
big-endian csharp csharp-library endian endianbinaryio endianness little-endian serialization serialization-library serialize-objects serializer

endianbinaryio's People

Contributors

kermalis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

endianbinaryio's Issues

Oversights with ReadObject and WriteObject

Every property is checked for attributes even if the types will not use the attributes. This is very slow.

String null termination checking should be better; currently it will default to null termination unless there's a string length attribute. Attributes should be enforced.

Add alternative methods of reading/writing strings via count

The char counts used are for C# strings, which are UTF16 by default. Therefore, a surrogate pair in a UTF16 C# string is 2 chars, but 1 char in UTF32. Writing will write 2 chars technically, and you'd want to read 1 UTF32 char. However, it will only be the first half of the surrogate pair when converted to a string, since the char array will be shrunk down to 1

Reading and writing abstract "Enum" type will crash

Reading should throw an error on EndianBinaryIO's side because the underlying type would be unknown.
Writing should not throw; it instead should use value.GetType() instead of typeof(TEnum) to fetch the correct type rather than Enum itself in this case

String/char questions

Should String and char[] be flipped with endianness (note BigEndianUnicode)?
Will the current implementation always work? Encoding sizes for each char might be different depending on the char, so I think PeekChar and ReadChar will be broken under some circumstances.

Remove "IDisposable"

Dispose only disposes of the underlying stream, which the user should be doing.

License

What license of this library under? It would be good to add a license file to the project - either publish it under a permissive license, or, alternately, under LGPL license (the library is being used by https://github.com/Kermalis/VGMusicStudio project, whose source code is under LGPL license).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.