msgpack-cliでcustom serializationをする

Posted on 2017年09月13日(水) in unity • Tagged with Unity, Android, iOS, msgpack

何かEnumをSerializeするときにErrorが起きたので以下のように対応した.

これが正しい対応かどうかはかなり怪しいが一旦はこれで対応していく.

以下を参照し、作成した.

https://github.com/msgpack/msgpack-cli/wiki/Custom-serialization

  1. CustomSerializationを作る
public class TargetTypeSerializer : MessagePackSerializer<TargetType>
{

    protected TargetTypeSerializer (SerializationContext ownerContext) : base (ownerContext)
    {
    }

    #region implemented abstract members of MessagePackSerializer

    protected override void PackToCore (MsgPack.Packer packer, TargetType objectTree)
    {
        packer.Pack ((int)objectTree);
    }

    protected override TargetType UnpackFromCore (MsgPack.Unpacker unpacker)
    {
        var ...

Continue reading