Exemplo n.º 1
0
        public static MQDataInfo ResolveMQDataInfo(byte[] header, byte[] bodyBuffer, int offset, int length)
        {
            MQDataInfo mQData = new MQDataInfo();

            mQData.Head     = MQTools.ByteToChar(header[0], header[1]);
            mQData.PID      = header[2];
            mQData.Type     = header[3];
            mQData.MID      = BitConverter.ToInt32(header, 4);
            mQData.Code     = BitConverter.ToUInt16(header, 8);
            mQData.Reserved = BitConverter.ToUInt16(header, 10);
            mQData.Length   = BitConverter.ToUInt16(header, 12);
            if (mQData.Length > 0)
            {
                mQData.Body = bodyBuffer.CloneRange(offset, mQData.Length);
            }
            //mQData.CS = bodyBuffer[offset + mQData.Length];
            mQData.End = MQTools.ByteToChar(bodyBuffer[offset + mQData.Length], bodyBuffer[offset + mQData.Length + 1]);

            return(mQData);
        }
Exemplo n.º 2
0
        public static MQDataInfo ResolveMQDataInfo(byte[] buffer)
        {
            MQDataInfo mQData = new MQDataInfo();

            mQData.Head     = MQTools.ByteToChar(buffer[0], buffer[1]);
            mQData.PID      = buffer[2];
            mQData.Type     = buffer[3];
            mQData.MID      = BitConverter.ToInt32(buffer, 4);
            mQData.Code     = BitConverter.ToUInt16(buffer, 8);
            mQData.Reserved = BitConverter.ToUInt16(buffer, 10);
            mQData.Length   = BitConverter.ToUInt16(buffer, 12);
            if (mQData.Length > 0)
            {
                mQData.Body = buffer.CloneRange(14, mQData.Length);
            }
            // mQData.CS = buffer[14 + mQData.Length];
            mQData.End = MQTools.ByteToChar(buffer[14 + mQData.Length], buffer[14 + mQData.Length + 1]);

            return(mQData);
        }