/// <summary> /// Initializes a new <see cref="T:GSMCommunication.PDUDecoder.SmsDeliverPdu" /> instance using default values. /// </summary> public SmsDeliverPdu() { this.messageFlags = new SmsDeliverMessageFlags(); this.originatingAddress = string.Empty; this.originatingAddressType = 0; this.scTimestamp = SmsTimestamp.None; }
/// <summary> /// Initializes a new <see cref="T:GSMCommunication.PDUDecoder.SmsStatusReportPdu" /> instance using default values. /// </summary> public SmsStatusReportPdu() { this.messageFlags = new SmsStatusReportMessageFlags(); this.messageReference = 0; this.RecipientAddress = string.Empty; this.scTimestamp = SmsTimestamp.None; this.dischargeTime = SmsTimestamp.None; this.status = 0; this.parameterIndicator = null; }
static SmsTimestamp() { SmsTimestamp.None = new SmsTimestamp(new DateTime(1900, 1, 1), 0); }
/// <summary> /// Compares this instance to a specified object and returns an indication of their relative values. /// </summary> /// <param name="value">An object to compare, or a null reference</param> /// <returns> /// <list type="bullet"> /// <item>less than zero = the instance is less than value.</item> /// <item>zero = the instance is equal to value.</item> /// <item>greater than zero = The instance is grater than value -or- value is a null reference.</item> /// </list> /// </returns> /// <exception cref="T:System.ArgumentException">value is not an <see cref="T:GSMCommunication.PDUDecoder.SmsTimestamp" />.</exception> public int CompareTo(object value) { if (!(value is SmsTimestamp)) { if (value != null) { throw new ArgumentException("value is not an SmsTimestamp."); } else { return(1); } } else { SmsTimestamp smsTimestamp = (SmsTimestamp)value; int num = this.year.CompareTo(smsTimestamp.Year); if (num == 0) { num = this.month.CompareTo(smsTimestamp.Month); if (num == 0) { num = this.day.CompareTo(smsTimestamp.Day); if (num == 0) { num = this.hour.CompareTo(smsTimestamp.Hour); if (num == 0) { num = this.minute.CompareTo(smsTimestamp.Minute); if (num == 0) { num = this.second.CompareTo(smsTimestamp.Second); if (num == 0) { num = this.timeZoneOffset.CompareTo(smsTimestamp.TimeZoneOffset); return(num); } else { return(num); } } else { return(num); } } else { return(num); } } else { return(num); } } else { return(num); } } else { return(num); } } }
/// <summary> /// Initializes a new instance of the <see cref="T:GSMCommunication.PDUDecoder.SmsDeliverPdu" /> class /// using the specified PDU string. /// </summary> /// <param name="pdu">The PDU string to convert.</param> /// <param name="includesSmscData">Specifies if the string contains /// SMSC data octets at the beginning.</param> /// <param name="actualLength">Specifies the actual PDU length, that is the length in bytes without /// the SMSC header. Set to -1 if unknown.</param> /// <remarks> /// <para>This constructor assumes that the string contains an <b>SMS-DELIVER</b> /// PDU data stream as specified by GSM 07.05.</para> /// </remarks> public SmsDeliverPdu(string pdu, bool includesSmscData, int actualLength) { string str = null; byte num = 0; byte num1 = 0; byte[] numArray = null; if (pdu != string.Empty) { bool flag = actualLength >= 0; int num2 = actualLength; if (!flag || num2 > 0) { int num3 = 0; if (includesSmscData) { PduParts.DecodeSmscAddress(pdu, ref num3, out str, out num); base.SetSmscAddress(str, num); } int num4 = num3; num3 = num4 + 1; this.messageFlags = new SmsDeliverMessageFlags(BcdWorker.GetByte(pdu, num4)); if (flag) { num2--; if (num2 <= 0) { base.ConstructLength = num3 * 2; return; } } PduParts.DecodeGeneralAddress(pdu, ref num3, out this.originatingAddress, out this.originatingAddressType); if (num3 * 2 < pdu.Length) { int num5 = num3; num3 = num5 + 1; base.ProtocolID = BcdWorker.GetByte(pdu, num5); int num6 = num3; num3 = num6 + 1; base.DataCodingScheme = BcdWorker.GetByte(pdu, num6); this.scTimestamp = new SmsTimestamp(pdu, ref num3); PduParts.DecodeUserData(pdu, ref num3, base.DataCodingScheme, out num1, out numArray); base.SetUserData(numArray, num1); base.ConstructLength = num3 * 2; return; } else { this.scTimestamp = SmsTimestamp.None; base.ProtocolID = 145; base.DataCodingScheme = 137; base.ConstructLength = num3 * 2; return; } } else { return; } } else { throw new ArgumentException("pdu must not be an empty string."); } }
/// <summary> /// Initializes a new instance of the <see cref="T:GSMCommunication.PDUDecoder.SmsStatusReportPdu" /> class /// using the specified PDU string. /// </summary> /// <param name="pdu">The PDU string to convert.</param> /// <param name="includesSmscData">Specifies if the string contains /// SMSC data octets at the beginning.</param> /// <param name="actualLength">Specifies the actual PDU length, that is the length in bytes without /// the SMSC header. Set to -1 if unknown.</param> /// <remarks> /// <para>This constructor assumes that the string contains an <b>SMS-STATUS-REPORT</b> /// PDU data stream as specified /// by GSM 07.05.</para> /// </remarks> public SmsStatusReportPdu(string pdu, bool includesSmscData, int actualLength) { string str = null; byte num = 0; ParameterIndicator parameterIndicator; byte num1 = 0; byte[] numArray = null; if (pdu != string.Empty) { bool flag = actualLength >= 0; int num2 = actualLength; if (!flag || num2 > 0) { int num3 = 0; if (includesSmscData) { PduParts.DecodeSmscAddress(pdu, ref num3, out str, out num); base.SetSmscAddress(str, num); } int num4 = num3; num3 = num4 + 1; this.messageFlags = new SmsStatusReportMessageFlags(BcdWorker.GetByte(pdu, num4)); if (flag) { num2--; if (num2 <= 0) { base.ConstructLength = num3 * 2; return; } } int num5 = num3; num3 = num5 + 1; this.messageReference = BcdWorker.GetByte(pdu, num5); PduParts.DecodeGeneralAddress(pdu, ref num3, out this.recipientAddress, out this.recipientAddressType); if (num3 * 2 < pdu.Length) { this.scTimestamp = new SmsTimestamp(pdu, ref num3); this.dischargeTime = new SmsTimestamp(pdu, ref num3); int num6 = num3; num3 = num6 + 1; this.status = BcdWorker.GetByte(pdu, num6); int num7 = BcdWorker.CountBytes(pdu); if (num3 < num7) { int num8 = num3; num3 = num8 + 1; this.parameterIndicator = new ParameterIndicator(BcdWorker.GetByte(pdu, num8)); if (this.parameterIndicator.Extension) { do { int num9 = BcdWorker.CountBytes(pdu); if (num3 < num9) { int num10 = num3; num3 = num10 + 1; parameterIndicator = new ParameterIndicator(BcdWorker.GetByte(pdu, num10)); } else { base.ConstructLength = num3 * 2; return; } } while (parameterIndicator.Extension); } if (this.parameterIndicator.TP_PID) { int num11 = num3; num3 = num11 + 1; base.ProtocolID = BcdWorker.GetByte(pdu, num11); } if (this.parameterIndicator.TP_DCS) { int num12 = num3; num3 = num12 + 1; base.DataCodingScheme = BcdWorker.GetByte(pdu, num12); } if (this.parameterIndicator.TP_UDL) { PduParts.DecodeUserData(pdu, ref num3, base.DataCodingScheme, out num1, out numArray); base.SetUserData(numArray, num1); } base.ConstructLength = num3 * 2; return; } else { base.ConstructLength = num3 * 2; return; } } else { base.ProtocolID = 145; base.DataCodingScheme = 137; this.SCTimestamp = SmsTimestamp.None; this.DischargeTime = SmsTimestamp.None; base.ConstructLength = num3 * 2; return; } } else { return; } } else { throw new ArgumentException("pdu must not be an empty string."); } }
/// <summary> /// Initializes a new instance of the <see cref="T:GSMCommunication.PDUDecoder.SmsStatusReportPdu" /> class /// using the specified PDU string. /// </summary> /// <param name="pdu">The PDU string to convert.</param> /// <param name="includesSmscData">Specifies if the string contains /// SMSC data octets at the beginning.</param> /// <param name="actualLength">Specifies the actual PDU length, that is the length in bytes without /// the SMSC header. Set to -1 if unknown.</param> /// <remarks> /// <para>This constructor assumes that the string contains an <b>SMS-STATUS-REPORT</b> /// PDU data stream as specified /// by GSM 07.05.</para> /// </remarks> public SmsStatusReportPdu(string pdu, bool includesSmscData, int actualLength) { string str = null; byte num = 0; ParameterIndicator parameterIndicator; byte num1 = 0; byte[] numArray = null; if (pdu != string.Empty) { bool flag = actualLength >= 0; int num2 = actualLength; if (!flag || num2 > 0) { int num3 = 0; if (includesSmscData) { PduParts.DecodeSmscAddress(pdu, ref num3, out str, out num); base.SetSmscAddress(str, num); } int num4 = num3; num3 = num4 + 1; this.messageFlags = new SmsStatusReportMessageFlags(BcdWorker.GetByte(pdu, num4)); if (flag) { num2--; if (num2 <= 0) { base.ConstructLength = num3 * 2; return; } } int num5 = num3; num3 = num5 + 1; this.messageReference = BcdWorker.GetByte(pdu, num5); PduParts.DecodeGeneralAddress(pdu, ref num3, out this.recipientAddress, out this.recipientAddressType); if (num3 * 2 < pdu.Length) { this.scTimestamp = new SmsTimestamp(pdu, ref num3); this.dischargeTime = new SmsTimestamp(pdu, ref num3); int num6 = num3; num3 = num6 + 1; this.status = BcdWorker.GetByte(pdu, num6); int num7 = BcdWorker.CountBytes(pdu); if (num3 < num7) { int num8 = num3; num3 = num8 + 1; this.parameterIndicator = new ParameterIndicator(BcdWorker.GetByte(pdu, num8)); if (this.parameterIndicator.Extension) { do { int num9 = BcdWorker.CountBytes(pdu); if (num3 < num9) { int num10 = num3; num3 = num10 + 1; parameterIndicator = new ParameterIndicator(BcdWorker.GetByte(pdu, num10)); } else { base.ConstructLength = num3 * 2; return; } }while (parameterIndicator.Extension); } if (this.parameterIndicator.TP_PID) { int num11 = num3; num3 = num11 + 1; base.ProtocolID = BcdWorker.GetByte(pdu, num11); } if (this.parameterIndicator.TP_DCS) { int num12 = num3; num3 = num12 + 1; base.DataCodingScheme = BcdWorker.GetByte(pdu, num12); } if (this.parameterIndicator.TP_UDL) { PduParts.DecodeUserData(pdu, ref num3, base.DataCodingScheme, out num1, out numArray); base.SetUserData(numArray, num1); } base.ConstructLength = num3 * 2; return; } else { base.ConstructLength = num3 * 2; return; } } else { base.ProtocolID = 145; base.DataCodingScheme = 137; this.SCTimestamp = SmsTimestamp.None; this.DischargeTime = SmsTimestamp.None; base.ConstructLength = num3 * 2; return; } } else { return; } } else { throw new ArgumentException("pdu must not be an empty string."); } }