private bool IsCompleteStatusReportPduModeIndication(string input) { Regex regex = new Regex("\\+CDS: (\\d+)\\r\\n(\\w+)"); Match match = regex.Match(input); if (match.Success) { int num = int.Parse(match.Groups[1].Value); string value = match.Groups[2].Value; if (BcdWorker.CountBytes(value) <= 0) { return(false); } else { int num1 = BcdWorker.GetByte(value, 0); int num2 = num * 2 + num1 * 2 + 2; return(value.Length >= num2); } } else { return(false); } }
/// <summary> /// Creates an operator logo. /// </summary> /// <param name="otaBitmap">The OTA bitmap to use as the logo. Maximum size is 72x14 pixels.</param> /// <param name="mobileCountryCode">MCC. The operator's country code. Must be 3 digits long.</param> /// <param name="mobileNetworkCode">MNC. The operator's network code. Must be 2 digits long.</param> /// <returns>A byte array containing the generated operator logo.</returns> /// <exception cref="T:System.ArgumentNullException">otaBitmap is null.</exception> /// <exception cref="T:System.ArgumentException"><para>mobileCountryCode is not 3 digits long.</para><para> -or- </para> /// <para>mobileNetworkCode is not 2 digits long.</para> /// <para> -or- </para><para>The bitmap is larger than 72x14 pixels.</para> /// </exception> public static byte[] CreateOperatorLogo(OtaBitmap otaBitmap, string mobileCountryCode, string mobileNetworkCode) { if (otaBitmap != null) { if (otaBitmap.Width > 72 || otaBitmap.Height > 14) { string[] str = new string[5]; str[0] = "Bitmaps used as operator logos must not be larger than "; int num = 72; str[1] = num.ToString(); str[2] = "x"; int num1 = 14; str[3] = num1.ToString(); str[4] = " pixels."; throw new ArgumentException(string.Concat(str)); } else { if (mobileCountryCode.Length == 3) { if (mobileNetworkCode.Length == 2) { byte num2 = 48; byte[] numArray = Calc.HexToInt(BcdWorker.EncodeSemiOctets(mobileCountryCode.PadRight(4, 'F'))); byte[] numArray1 = Calc.HexToInt(BcdWorker.EncodeSemiOctets(mobileNetworkCode.PadRight(2, 'F'))); int length = 1 + (int)numArray.Length + (int)numArray1.Length + 1; int length1 = 0; byte[] numArray2 = new byte[length]; int num3 = length1; length1 = num3 + 1; numArray2[num3] = num2; numArray.CopyTo(numArray2, length1); length1 = length1 + (int)numArray.Length; numArray1.CopyTo(numArray2, length1); length1 = length1 + (int)numArray1.Length; int num4 = length1; length1 = num4 + 1; numArray2[num4] = 10; byte[] byteArray = otaBitmap.ToByteArray(); byte[] numArray3 = new byte[(int)numArray2.Length + (int)byteArray.Length]; numArray2.CopyTo(numArray3, 0); byteArray.CopyTo(numArray3, length1); return(numArray3); } else { throw new ArgumentException("mobileNetworkCode must be 2 digits long.", "mobileNetworkCode"); } } else { throw new ArgumentException("mobileCountryCode must be 3 digits long.", "mobileCountryCode"); } } } else { throw new ArgumentNullException("otaBitmap"); } }