public CMPP_MSG_QUERY_RESP(byte[] bs) { header = new CMPP_MSG_Header(bs); int index = CMPP_MSG_Header.HeaderLength; _time = BitConverter.ToString(bs, index, 8); index = index + 8; this._queryType = bs[index++]; this._queryCode = BitConverter.ToString(bs, index, 10); index = index + 10; this._MT_TLMsg = BIConvert.Bytes2UInt(bs, index); index = index + 4; this._MT_Tlusr = BIConvert.Bytes2UInt(bs, index); index = index + 4; this._MT_Scs = BIConvert.Bytes2UInt(bs, index); index = index + 4; this._MT_WT = BIConvert.Bytes2UInt(bs, index); index = index + 4; this._MT_FL = BIConvert.Bytes2UInt(bs, index); index = index + 4; this._MO_Scs = BIConvert.Bytes2UInt(bs, index); index = index + 4; this._MO_WT = BIConvert.Bytes2UInt(bs, index); index = index + 4; this._MO_FL = BIConvert.Bytes2UInt(bs, index); }
public CMPP_MSG_DELIVER(byte[] bs) { header = new CMPP_MSG_Header(bs); int index = CMPP_MSG_Header.HeaderLength; this._msgid = BitConverter.ToUInt64(bs, index); index += 8; this._destid = Encoding.ASCII.GetString(bs, index, 21); index = index + 21; this._svccode = Encoding.ASCII.GetString(bs, index, 10); index = index + 10; this._tpid = (int)bs[index++]; this._udhi = (int)bs[index++]; this._msgfmt = (int)bs[index++]; this._srctid = Encoding.ASCII.GetString(bs, index, 21); index += 21; if (bs[index++] == 1) { this._isReport = true; } else { this._isReport = false; } this._msglength = (int)bs[index++]; if (!this._isReport) { switch (this._msgfmt) { case (int)Msg_Format.ASCII: this._msg = Encoding.ASCII.GetString(bs, index, this._msglength); index += this._msglength; break; case (int)Msg_Format.BINARY: this._msg = Encoding.Default.GetString(bs, index, this._msglength); index += this._msglength; break; case (int)Msg_Format.GB2312: this._msg = Encoding.Default.GetString(bs, index, this._msglength); index += this._msglength; break; case (int)Msg_Format.UCS2: this._msg = Encoding.BigEndianUnicode.GetString(bs, index, this._msglength); index += this._msglength; break; default: break; } } else {//状态报告 this._reportForMsgid = BitConverter.ToUInt64(bs, index); index += 8; this._reportState = BitConverter.ToString(bs, index, 7); index += 7; this._submitTime = BitConverter.ToString(bs, index, 10); index += 10; this._doneTime = BitConverter.ToString(bs, index, 10); index += 10; this._reportDesttid = BitConverter.ToString(bs, index, 21); index += 21; this._smscSequence = (int)BIConvert.Bytes2UInt(bs, index); } }