internal Exception CheckTotalAndFractionDigits(decimal value, int totalDigits, int fractionDigits, bool checkTotal, bool checkFraction) { decimal num = decimal.op_Decrement(FacetsChecker.Power(10, totalDigits)); int num2 = 0; if (value < 0M) { value = decimal.Negate(value); } while (decimal.Truncate(value) != value) { value *= 10M; num2++; } if (checkTotal && ((value > num) || (num2 > totalDigits))) { return(new XmlSchemaException("Sch_TotalDigitsConstraintFailed", string.Empty)); } if (checkFraction && (num2 > fractionDigits)) { return(new XmlSchemaException("Sch_FractionDigitsConstraintFailed", string.Empty)); } return(null); }