Terraria v1.4.4.9
Terraria source code documentation
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros

◆ CheckTotalAndFractionDigits()

Exception System.Xml.Schema.Numeric10FacetsChecker.CheckTotalAndFractionDigits ( decimal value,
int totalDigits,
int fractionDigits,
bool checkTotal,
bool checkFraction )
inlinepackage

Definition at line 95 of file Numeric10FacetsChecker.cs.

96 {
97 decimal num = FacetsChecker.Power(10, totalDigits) - 1m;
98 int num2 = 0;
99 if (value < 0m)
100 {
101 value = decimal.Negate(value);
102 }
103 while (decimal.Truncate(value) != value)
104 {
105 value *= 10m;
106 num2++;
107 }
108 if (checkTotal && (value > num || num2 > totalDigits))
109 {
110 return new XmlSchemaException(System.SR.Sch_TotalDigitsConstraintFailed, string.Empty);
111 }
113 {
114 return new XmlSchemaException(System.SR.Sch_FractionDigitsConstraintFailed, string.Empty);
115 }
116 return null;
117 }
static string Sch_TotalDigitsConstraintFailed
Definition SR.cs:704
static string Sch_FractionDigitsConstraintFailed
Definition SR.cs:706
Definition SR.cs:7

References System.Xml.Dictionary, System.Xml.Schema.FacetsChecker.Power(), System.SR.Sch_FractionDigitsConstraintFailed, System.SR.Sch_TotalDigitsConstraintFailed, and System.value.

Referenced by System.Xml.Schema.Numeric10FacetsChecker.CheckValueFacets(), and System.Xml.Schema.Datatype_fixed.TryParseValue().