Skip to content

ysogata/MiniMessagePack

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MiniMessagePack.cs

Build Status

MiniMessagePack decodes and encodes MessagePack binaries. Handy for parsing MessagePack from inside Unity3d. It is possible to easily replace the MiniJSON.

Install

To install this, copy MiniMessagePack/MiniMessagePacker.cs to Assets folder in your project.

Usage

Decoding

using MiniMessagePack;

// it means {"compact":true,"schema":0} in JSON
var msgpack = new byte[] {
    0x82, 0xa7, 0x63, 0x6f, 0x6d, 0x70, 0x61, 0x63, 0x74, 0xc3,
    0xa6, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x00
};

var packer = new MiniMessagePacker ();
object unpacked_data = packer.Unpack (msgpack);
/*
unpacked_data = new Dictionary<string, object> {
    { "compact", true },
	{ "schema", 0},
};
*/

Encoding

using MiniMessagePack;

var unpacked_data = new Dictionary<string, object> {
    { "compact", true },
	{ "schema", 0},
};

var packer = new MiniMessagePacker ();
bytep[] msgpack = packer.Pack (unpacked_data);
// msgpack = new byte[] { 0x82, 0xa7, ...};

See Also

About

MiniMessagePack decodes and encodes MessagePack binaries. Handy for parsing MessagePack from inside Unity3d. It is possible to easily replace the MiniJSON.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C# 100.0%