Decode() 공개 정적인 메소드

解码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
리턴 bool
예제 #1
0
        public IMessage Decode(byte[] data)
        {
            uint     id;
            IMessage msg;

            PBCodec.Decode(data, msgtype_query_, out msg, out id);
            return(msg);
        }
예제 #2
0
        public object Decode(byte[] data)
        {
            int    id;
            object msg;

            PBCodec.Decode(data, msgtype_query_, out msg, out id);
            return(msg);
        }
예제 #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);
                }
            }
        }