/// <summary> /// Decodes a user data header into information elements. /// </summary> /// <param name="userDataHeader">The user data header to be decoded.</param> /// <returns>The elements found as an array of <see cref="T:GsmComm.PduConverter.SmartMessaging.InformationElement" /> objects.</returns> /// <remarks> /// <para>Known information elements are decoded into their respective objects, while unknown /// information elements are stored in generic <see cref="T:GsmComm.PduConverter.SmartMessaging.UnknownInformationElement" /> objects.</para> /// <para>The list of known information elements consists of elements used within Smart Messaging, /// and does not aim to be a complete set of all existing elements.</para> /// <para>The currently recognized elements are:</para> /// <list type="bullet"> /// <item><description><see cref="T:GsmComm.PduConverter.SmartMessaging.ConcatMessageElement8" /></description></item> /// <item><description><see cref="T:GsmComm.PduConverter.SmartMessaging.ConcatMessageElement16" /></description></item> /// <item><description><see cref="T:GsmComm.PduConverter.SmartMessaging.PortAddressElement16" /></description></item> /// </list> /// </remarks> public static InformationElement[] DecodeUserDataHeader(byte[] userDataHeader) { InformationElement unknownInformationElement; List <InformationElement> informationElements = new List <InformationElement>(); byte num = 0; byte num1 = userDataHeader[0]; if (num1 > 0) { num = (byte)(num + 1); do { byte num2 = num; num = (byte)(num2 + 1); byte num3 = userDataHeader[num2]; byte num4 = num; num = (byte)(num4 + 1); byte num5 = userDataHeader[num4]; byte[] numArray = new byte[num5 + 2]; Array.Copy(userDataHeader, num - 2, numArray, 0, num5 + 2); num = (byte)(num + num5); if (num3 != 0) { if (num3 != 8) { if (num3 != 5) { unknownInformationElement = new UnknownInformationElement(numArray); } else { unknownInformationElement = new PortAddressElement16(numArray); } } else { unknownInformationElement = new ConcatMessageElement16(numArray); } } else { unknownInformationElement = new ConcatMessageElement8(numArray); } informationElements.Add(unknownInformationElement); }while (num < num1); } return(informationElements.ToArray()); }
/// <summary> /// Decodes a user data header into information elements. /// </summary> /// <param name="userDataHeader">The user data header to be decoded.</param> /// <returns>The elements found as an array of <see cref="T:GsmComm.PduConverter.SmartMessaging.InformationElement" /> objects.</returns> /// <remarks> /// <para>Known information elements are decoded into their respective objects, while unknown /// information elements are stored in generic <see cref="T:GsmComm.PduConverter.SmartMessaging.UnknownInformationElement" /> objects.</para> /// <para>The list of known information elements consists of elements used within Smart Messaging, /// and does not aim to be a complete set of all existing elements.</para> /// <para>The currently recognized elements are:</para> /// <list type="bullet"> /// <item><description><see cref="T:GsmComm.PduConverter.SmartMessaging.ConcatMessageElement8" /></description></item> /// <item><description><see cref="T:GsmComm.PduConverter.SmartMessaging.ConcatMessageElement16" /></description></item> /// <item><description><see cref="T:GsmComm.PduConverter.SmartMessaging.PortAddressElement16" /></description></item> /// </list> /// </remarks> public static InformationElement[] DecodeUserDataHeader(byte[] userDataHeader) { InformationElement unknownInformationElement; List<InformationElement> informationElements = new List<InformationElement>(); byte num = 0; byte num1 = userDataHeader[0]; if (num1 > 0) { num = (byte)(num + 1); do { byte num2 = num; num = (byte)(num2 + 1); byte num3 = userDataHeader[num2]; byte num4 = num; num = (byte)(num4 + 1); byte num5 = userDataHeader[num4]; byte[] numArray = new byte[num5 + 2]; Array.Copy(userDataHeader, num - 2, numArray, 0, num5 + 2); num = (byte)(num + num5); if (num3 != 0) { if (num3 != 8) { if (num3 != 5) { unknownInformationElement = new UnknownInformationElement(numArray); } else { unknownInformationElement = new PortAddressElement16(numArray); } } else { unknownInformationElement = new ConcatMessageElement16(numArray); } } else { unknownInformationElement = new ConcatMessageElement8(numArray); } informationElements.Add(unknownInformationElement); } while (num < num1); } return informationElements.ToArray(); }