internal BigInteger Decode(string value) { BigInteger r = 0; if (caseSensitive) { foreach (char c in value) { if (!this.baseEntities.Contains(c)) { throw NumericsThrowHelper.ObtainArgumentException(ArgumentWithException.value, ExceptionMessageId.NumericValueParseError, c.ToString()); } } for (byte b = 0; b < value.Length; b++) { r += ShiftBaseValue((int)baseEntities.IndexOf(value[b]), (byte)(value.Length - (b + 1))); } } else { value = value.ToUpper(); for (byte b = 0; b < value.Length; b++) { char c = value[b]; if (!this.baseEntities.Contains(c)) { throw NumericsThrowHelper.ObtainArgumentException(ArgumentWithException.value, ExceptionMessageId.NumericValueParseError, c.ToString()); } r += ShiftBaseValue((int)baseEntities.IndexOf(c), (byte)(value.Length - (b + 1))); } } return((BigInteger)r); }
/// <summary> /// Checks the <paramref name="array"/>, <paramref name="arrayIndex"/> and /// <paramref name="count"/> to make sure they are in bounds. /// </summary> /// <param name="array">The <see cref="Array"/> to check the <paramref name="arrayIndex"/> and <paramref name="Count"/> against.</param> /// <param name="arrayIndex">The <see cref="Int32"/> value which denotes where within the target <paramref name="array"/> /// to start the copy.</param> /// <param name="count">The <see cref="Int32"/> value denoting the number of elements to be copied /// into <paramref name="array"/>.</param> public static void CopyToCheck(Array array, int arrayIndex, int count) { if (array == null) { throw new ArgumentNullException(NumericsThrowHelper.GetArgumentName(ArgumentWithException.array)); } if (array.Length < count) { throw NumericsThrowHelper.ObtainArgumentException(ArgumentWithException.array, ExceptionMessageId.InsufficientSpaceForCopy); } if (arrayIndex < 0 || arrayIndex + count > array.Length) { throw new ArgumentOutOfRangeException("arrayIndex"); } }