Decode() public static method

解码protobuf消息
public static Decode ( byte data, PBChannel t_query, object &msg, int &id ) : bool
data byte 字节数据
t_query PBChannel 消息(id->type)查询函数
msg object 返回的消息object
id int 返回的消息id
return bool
Ejemplo n.º 1
0
        public IMessage Decode(byte[] data)
        {
            uint     id;
            IMessage msg;

            PBCodec.Decode(data, msgtype_query_, out msg, out id);
            return(msg);
        }
Ejemplo n.º 2
0
        public object Decode(byte[] data)
        {
            int    id;
            object msg;

            PBCodec.Decode(data, msgtype_query_, out msg, out id);
            return(msg);
        }
Ejemplo n.º 3
0
        public void Dispatch(int from_handle, uint seq, byte[] data)
        {
            uint     id;
            IMessage msg;

            if (PBCodec.Decode(data, msgtype_query_, out msg, out id))
            {
                IPBHandler h;
                if (handlers_.TryGetValue(id, out h))
                {
                    h.Execute(msg, this, from_handle, seq);
                }
                else if (null != default_handler_)
                {
                    default_handler_(msg, this, from_handle, seq);
                }
            }
        }