Esempio n. 1
0
        private static bool HaveSameReferenceNumber(SmsPdu pdu1, SmsPdu pdu2)
        {
            bool flag = false;

            if (SmartMessageDecoder.IsPartOfConcatMessage(pdu1) && SmartMessageDecoder.IsPartOfConcatMessage(pdu2))
            {
                IConcatenationInfo concatenationInfo  = SmartMessageDecoder.GetConcatenationInfo(pdu1);
                IConcatenationInfo concatenationInfo1 = SmartMessageDecoder.GetConcatenationInfo(pdu2);
                if (concatenationInfo.ReferenceNumber == concatenationInfo1.ReferenceNumber)
                {
                    flag = true;
                }
            }
            return(flag);
        }
Esempio n. 2
0
        private static SortedList <IConcatenationInfo, SmsPdu> SortConcatMessageParts(IList <SmsPdu> parts)
        {
            IConcatenationInfo concatenationInfo;
            IConcatenationInfo concatenationInfo1 = null;
            SortedList <IConcatenationInfo, SmsPdu> concatenationInfos = new SortedList <IConcatenationInfo, SmsPdu>(new ConcatInfoComparer());

            foreach (SmsPdu part in parts)
            {
                if (concatenationInfo1 != null)
                {
                    if (!SmartMessageDecoder.IsPartOfConcatMessage(part))
                    {
                        throw new ArgumentException("A non-concatenated message part is present at an invalid position.", "parts");
                    }
                    else
                    {
                        concatenationInfo = SmartMessageDecoder.GetConcatenationInfo(part);
                        if (concatenationInfo1.ReferenceNumber == concatenationInfo.ReferenceNumber)
                        {
                            if (concatenationInfo1.TotalMessages != concatenationInfo.TotalMessages)
                            {
                                throw new ArgumentException("The number of total messages differs between the message parts.", "parts");
                            }
                        }
                        else
                        {
                            throw new ArgumentException("The reference numbers differ between the message parts.", "parts");
                        }
                    }
                }
                else
                {
                    concatenationInfo = SmartMessageDecoder.GetConcatenationInfo(part);
                }
                concatenationInfos.Add(concatenationInfo, part);
                concatenationInfo1 = concatenationInfo;
            }
            return(concatenationInfos);
        }
Esempio n. 3
0
 /// <summary>
 /// Determines whether a message is part of a concatenated message.
 /// </summary>
 /// <param name="pdu">The message.</param>
 /// <returns>true if the message is part of a concatenated message, false otherwise.</returns>
 public static bool IsPartOfConcatMessage(SmsPdu pdu)
 {
     return(SmartMessageDecoder.GetConcatenationInfo(pdu) != null);
 }