Beispiel #1
0
        public static Message ParseFromData(byte[] data, int datalength)
        {
            int  tpid  = (((int)(data[4])) << 8) | data[5];
            Type msgty = null;

            if (!MsgDic.TryGetValue(tpid, out msgty))
            {
                return(null);
            }
            Message       msg = Activator.CreateInstance(msgty) as Message;
            MsgDataStream ds  = new MsgDataStream(data, datalength);

            msg.ReadData(ds);
            ds.Dispose();
            return(msg);
        }