namespace AsiaINFO.SMS.CMPP2 { using System; using System.Text; public class CMPP_QUERY_RESP { private MessageHeader _Header; private uint _MO_FL; private uint _MO_Scs; private uint _MO_WT; private uint _MT_FL; private uint _MT_Scs; private uint _MT_TLMsg; private uint _MT_Tlusr; private uint _MT_WT; private string _Query_Code; private uint _Query_Type; private string _Time; public const int BodyLength = 0x33; public CMPP_QUERY_RESP(byte[] bytes) { int srcOffset = 0; byte[] dst = new byte[12]; Buffer.BlockCopy(bytes, 0, dst, 0, dst.Length); this._Header = new MessageHeader(dst); srcOffset += 12; dst = new byte[8]; Buffer.BlockCopy(bytes, srcOffset, dst, 0, dst.Length); this._Time = Encoding.ASCII.GetString(dst); srcOffset += 8; this._Query_Type = bytes[srcOffset++]; dst = new byte[10]; Buffer.BlockCopy(bytes, srcOffset, dst, 0, dst.Length); this._Query_Code = Encoding.ASCII.GetString(dst); srcOffset += 10; dst = new byte[4]; Buffer.BlockCopy(bytes, srcOffset, dst, 0, dst.Length); Array.Reverse(dst); this._MT_TLMsg = BitConverter.ToUInt32(dst, 0); srcOffset += 4; dst = new byte[4]; Buffer.BlockCopy(bytes, srcOffset, dst, 0, dst.Length); Array.Reverse(dst); this._MT_Tlusr = BitConverter.ToUInt32(dst, 0); srcOffset += 4; dst = new byte[4]; Buffer.BlockCopy(bytes, srcOffset, dst, 0, dst.Length); Array.Reverse(dst); this._MT_Scs = BitConverter.ToUInt32(dst, 0); srcOffset += 4; dst = new byte[4]; Buffer.BlockCopy(bytes, srcOffset, dst, 0, dst.Length); Array.Reverse(dst); this._MT_WT = BitConverter.ToUInt32(dst, 0); srcOffset += 4; dst = new byte[4]; Buffer.BlockCopy(bytes, srcOffset, dst, 0, dst.Length); Array.Reverse(dst); this._MT_FL = BitConverter.ToUInt32(dst, 0); srcOffset += 4; dst = new byte[4]; Buffer.BlockCopy(bytes, srcOffset, dst, 0, dst.Length); Array.Reverse(dst); this._MO_Scs = BitConverter.ToUInt32(dst, 0); srcOffset += 4; dst = new byte[4]; Buffer.BlockCopy(bytes, srcOffset, dst, 0, dst.Length); Array.Reverse(dst); this._MO_WT = BitConverter.ToUInt32(dst, 0); srcOffset += 4; dst = new byte[4]; Buffer.BlockCopy(bytes, srcOffset, dst, 0, dst.Length); Array.Reverse(dst); this._MO_FL = BitConverter.ToUInt32(dst, 0); } public override string ToString() { return ("[\r\n" + this._Header.ToString() + "\r\n" + string.Format("\tMessageBody:\r\n\t\tBodyLength: {0}\r\n\t\tMO_FL: {1}\r\n\t\tMO_Scs: {2}\r\n\t\tMO_WT: {3}\r\n\t\tMT_FL: {4}\r\n\t\tMT_Scs: {5}\r\n\t\tMT_TLMsg: {6}\r\n\t\tMT_Tlusr: {7}\r\n\t\tMT_WT: {8}\r\n\t\tQuery_Code: {9}\r\n\t\tQuery_Type: {10}\r\n\t\tTime: {11}", new object[] { 0x33, this._MO_FL, this._MO_Scs, this._MO_WT, this._MT_FL, this._MT_Scs, this._MT_TLMsg, this._MT_Tlusr, this._MT_WT, this._Query_Code, this._Query_Type, this._Time }) + "\r\n]"); } public MessageHeader Header { get { return this._Header; } } public uint MO_FL { get { return this._MO_FL; } } public uint MO_Scs { get { return this._MO_Scs; } } public uint MO_WT { get { return this._MO_WT; } } public uint MT_FL { get { return this._MT_FL; } } public uint Mt_Scs { get { return this._MT_Scs; } } public uint Mt_TlMsg { get { return this._MT_TLMsg; } } public uint Mt_Tlusr { get { return this._MT_Tlusr; } } public uint MT_WT { get { return this._MT_WT; } } public string Query_Code { get { return this._Query_Code; } } public uint Query_Type { get { return this._Query_Type; } } public string Time { get { return this._Time; } } } }