Exemple #1
0
        protected string Decode7BitText()
        {
            string s      = TextDataConverter.OctetsToSeptetsStr(this.userData);
            int    length = s.Length;

            return(TextDataConverter.SevenBitToString(s, true));
        }
Exemple #2
0
        public static string GetSafeText(string data, out bool lengthCorrected, out bool charsCorrected)
        {
            string str;
            string str2;

            lengthCorrected = false;
            charsCorrected  = false;
            if (data.Length > 160)
            {
                str             = data.Substring(0, 160);
                lengthCorrected = true;
            }
            else
            {
                str = data;
            }
            do
            {
                bool flag;
                str2 = TextDataConverter.StringTo7Bit(str, false, out flag);
                if (flag)
                {
                    charsCorrected = true;
                }
                if (str2.Length > 160)
                {
                    str             = data.Substring(0, str.Length - 1);
                    lengthCorrected = true;
                }
            }while (str2.Length > 160);
            return(TextDataConverter.SevenBitToString(str2));
        }
Exemple #3
0
 protected string CreateAddressOfType(string address, byte type)
 {
     if (address != string.Empty)
     {
         if ((type == 0x91) && !address.StartsWith("+"))
         {
             return("+" + address);
         }
         AddressType type2 = new AddressType(type);
         if (type2.Ton == 5)
         {
             string s = BcdWorker.EncodeSemiOctets(address);
             return(TextDataConverter.SevenBitToString(TextDataConverter.OctetsToSeptetsStr(BcdWorker.GetBytes(s, 0, BcdWorker.CountBytes(s))), false));
         }
     }
     return(address);
 }
Exemple #4
0
        /// <summary>
        /// Decodes the text from 7-Bit user data.
        /// </summary>
        /// <param name="userData">The user data to decode. Must contain an encoded GSM 7-Bit default text packed into octets.</param>
        /// <returns>The decoded user data.</returns>
        public static string Decode7BitText(byte[] userData)
        {
            string septetsStr = TextDataConverter.OctetsToSeptetsStr(userData);

            return(TextDataConverter.SevenBitToString(septetsStr, true));
        }