Skip to content

A simple msgpack encode & decode for C# / msgpack.org[C#]

Notifications You must be signed in to change notification settings

highras/msgpack-csharp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

FPNN MsgPack Implement

Compatibility Version:

C# .Net Standard 2.0

For Packer:

  • input kinds:

    null, bool, sbyte, byte, short, ushort, Int32, UInt32, Int64, Uint64, float, double, string

    Decimal, Tuple

    byte[], DateTime, IEnumerable (such as List, Dictionary, List<object>, Dictionary<object, object>, ...)

  • usage:

      using com.fpnn.msgpack;
      void MsgPacker.Pack(Stream stream, Object obj);
    

For Unpacker:

  • output kinds:

    Object, which maybe the following kinds:

    null, bool, sbyte, byte, short, ushort, Int32, UInt32, Int64, Uint64, float, double, string

    byte[], DateTime, List<object>, Dictionary<object, object>

  • usage:

      using com.fpnn.msgpack;
      Dictionary<Object, Object> MsgUnpacker.Unpack(byte[] binary);
    
      Dictionary<Object, Object> MsgUnpacker.Unpack(byte[] binary, int offset, int length = 0);
    
      //-- unpack one object.
      Object MsgUnpacker.Unpack(byte[] binary, int offset, out int endOffset);
    

Exception:

    using com.fpnn.msgpack;
    public class MsgPackException: Exception;
    public class UnsupportedTypeException : MsgPackException;
    public class UnrecognizedDataException : MsgPackException;
    public class InsufficientException : MsgPackException;
    public class InvalidDataException : MsgPackException;