Skip to content

MsgPack implementation with additional debugging and validation tool including Fiddler plugin / msgpack.org[C#]

License

Notifications You must be signed in to change notification settings

mlsomers/LsMsgPack

Repository files navigation

LsMsgPack

MsgPack debugging and validation tool also usable as Fiddler plugin

More info about this application (and screenshots) can be found at: http://www.infotopie.nl/open-source/msgpack-explorer

.NET

Library Usage Example

Although the original was optimised for debugging and analysing, a lightweight version of the lib is included which does not keep track of all offsets and other overhead needed for debugging. It can be used in your code.

Add LsMsgPackL.dll as a reference.

public class MyClass
{
    public string Name { get; set; }
    public int Quantity { get; set; }
    public List<object> Anything { get; set; }
}

public void Test()
{
    MyClass message = new MyClass()
    {
        Name = "Test message",
        Quantity = 100,
        Anything = new List<object>(new object[] { "first", 2, false, null, 4.2d, "last" })
    };
    
    // Serialize
    byte[] buffer = MsgPackSerializer.Serialize(message);
    
    // Deserialize
    MyClass returnMsg = MsgPackSerializer.Deserialize<MyClass>(buffer);
}

I have never run any benchmarks so I have no idea how it will perform against other implementations.

Fiddler Integration

In order to use this tool as a Fiddler plugin, copy the following files to the Fiddler Inspectors directory (usually C:\Program Files\Fiddler2\Inspectors):

  • MsgPackExplorer.exe
  • LsMsgPackFiddlerInspector.dll
  • LsMsgPack.dll

Restart fiddler and you should see a MsgPack option in the Inspectors list.

Source documentation

Modules

LsMsgPack.dll

This module contains the "parser" and generator of MsgPack Packages. It breaks down the binary file into a hirarchical structure, keeping track of offsets and errors. And it can also be used to generate MsgPack files.

MsgPackExplorer.exe

The main winforms executable, containing a MsgPackExplorer UserControl (so it can easily be integrated into other tools such as Fiddler).

LsMsgPackFiddlerInspector.dll

A tiny wrapper enabling the use of MsgPack Explorer as a Fiddler Inspector.

LsMsgPackUnitTests.dll

Some unit tests on the core LsMsgPack.dll. No full coverage yet, but at least it's a start.

LsMsgPackNetStandard.dll & LsMsgPackNetStandardUnitTests.dll

A light version of the serializer. The parsing and generating methods are almost identical to the LsMsgPack lib, but with allot of overhead removed that comes with keeping track of offsets, original types and other debugging info. I'm planning to use this version in my projects that use the MsgPack format.

Architecture

Object-model

Hierarchy

Each class can serialize/deserialize the associated MsgPack type. Types that have a variable length inherit from MsgPackVarLen.

Worker classes (or services)

Hierarchy

The MsgPackSerializer and MsgPackSettings are the ones that end-users are supposed to use (entry points).

About

MsgPack implementation with additional debugging and validation tool including Fiddler plugin / msgpack.org[C#]

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages