namespace AsiaINFO.SMS.CMPP2 { using System; using System.Text; public class CMPP_QUERY { private MessageHeader _Header; private string _Query_Code; private uint _Query_Type; private string _Reserve; private string _Time; public const int BodyLength = 0x1b; public CMPP_QUERY(DateTime Time, uint Query_Type, string Query_Code, string Reserve, uint Sequence_Id) { this._Time = Util.Get_YYYYMMDD_String(Time); this._Query_Type = Query_Type; this._Query_Code = Query_Code; this._Reserve = Reserve; this._Header = new MessageHeader(0x27, CMPP_Command_Id.CMPP_QUERY, Sequence_Id); } public byte[] ToBytes() { int index = 0; byte[] array = new byte[0x27]; byte[] buffer2 = new byte[12]; this._Header.ToBytes().CopyTo(array, 0); index += 12; buffer2 = new byte[10]; Encoding.ASCII.GetBytes(this._Time).CopyTo(array, index); index += 8; array[index++] = (byte) this._Query_Type; buffer2 = new byte[10]; Encoding.ASCII.GetBytes(this._Query_Code).CopyTo(array, index); index += 10; buffer2 = new byte[8]; Encoding.ASCII.GetBytes(this._Reserve).CopyTo(array, index); return array; } public override string ToString() { return ("[\r\n" + this._Header.ToString() + "\r\n" + string.Format("\tMessageBody:\r\n\t\tQuery_Code: {0}\r\n\t\tQuery_Type: {1}\r\n\t\tReserve: {2}\r\n\t\tTime: {3}\r\n]", new object[] { this._Query_Code, this._Query_Type, this._Reserve, this._Time }) + "\r\n]"); } public MessageHeader Header { get { return this._Header; } } public string Query_Code { get { return this._Query_Code; } } public uint Query_Type { get { return this._Query_Type; } } public string Reserve { get { return this._Reserve; } } public string Time { get { return this._Time; } } } }