Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
Numeric10FacetsChecker.cs
Go to the documentation of this file.
3
4namespace System.Xml.Schema;
5
6internal sealed class Numeric10FacetsChecker : FacetsChecker
7{
8 private readonly decimal _maxValue;
9
10 private readonly decimal _minValue;
11
12 internal Numeric10FacetsChecker(decimal minVal, decimal maxVal)
13 {
16 }
17
18 internal override Exception CheckValueFacets(object value, XmlSchemaDatatype datatype)
19 {
20 decimal value2 = datatype.ValueConverter.ToDecimal(value);
21 return CheckValueFacets(value2, datatype);
22 }
23
24 internal override Exception CheckValueFacets(decimal value, XmlSchemaDatatype datatype)
25 {
29 if (value > _maxValue || value < _minValue)
30 {
32 }
33 if (restrictionFlags != 0)
34 {
35 if ((restrictionFlags & RestrictionFlags.MaxInclusive) != 0 && value > valueConverter.ToDecimal(restriction.MaxInclusive))
36 {
38 }
39 if ((restrictionFlags & RestrictionFlags.MaxExclusive) != 0 && value >= valueConverter.ToDecimal(restriction.MaxExclusive))
40 {
42 }
43 if ((restrictionFlags & RestrictionFlags.MinInclusive) != 0 && value < valueConverter.ToDecimal(restriction.MinInclusive))
44 {
46 }
47 if ((restrictionFlags & RestrictionFlags.MinExclusive) != 0 && value <= valueConverter.ToDecimal(restriction.MinExclusive))
48 {
50 }
51 if ((restrictionFlags & RestrictionFlags.Enumeration) != 0 && !MatchEnumeration(value, restriction.Enumeration, valueConverter))
52 {
54 }
55 return CheckTotalAndFractionDigits(value, restriction.TotalDigits, restriction.FractionDigits, (restrictionFlags & RestrictionFlags.TotalDigits) != 0, (restrictionFlags & RestrictionFlags.FractionDigits) != 0);
56 }
57 return null;
58 }
59
60 internal override Exception CheckValueFacets(long value, XmlSchemaDatatype datatype)
61 {
62 decimal value2 = value;
63 return CheckValueFacets(value2, datatype);
64 }
65
66 internal override Exception CheckValueFacets(int value, XmlSchemaDatatype datatype)
67 {
68 decimal value2 = value;
69 return CheckValueFacets(value2, datatype);
70 }
71
72 internal override Exception CheckValueFacets(short value, XmlSchemaDatatype datatype)
73 {
74 decimal value2 = value;
75 return CheckValueFacets(value2, datatype);
76 }
77
78 internal override bool MatchEnumeration(object value, ArrayList enumeration, XmlSchemaDatatype datatype)
79 {
81 }
82
84 {
85 for (int i = 0; i < enumeration.Count; i++)
86 {
87 if (value == valueConverter.ToDecimal(enumeration[i]))
88 {
89 return true;
90 }
91 }
92 return false;
93 }
94
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 {
111 }
113 {
115 }
116 return null;
117 }
118}
static CultureInfo InvariantCulture
static string XmlConvert_Overflow
Definition SR.cs:372
static string Sch_MinInclusiveConstraintFailed
Definition SR.cs:700
static string Sch_MaxInclusiveConstraintFailed
Definition SR.cs:696
static string Sch_MinExclusiveConstraintFailed
Definition SR.cs:702
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string Sch_MaxExclusiveConstraintFailed
Definition SR.cs:698
static string Sch_EnumerationConstraintFailed
Definition SR.cs:694
static string Sch_TotalDigitsConstraintFailed
Definition SR.cs:704
static string Sch_FractionDigitsConstraintFailed
Definition SR.cs:706
Definition SR.cs:7
static decimal Power(int x, int y)
override Exception CheckValueFacets(decimal value, XmlSchemaDatatype datatype)
override Exception CheckValueFacets(short value, XmlSchemaDatatype datatype)
Exception CheckTotalAndFractionDigits(decimal value, int totalDigits, int fractionDigits, bool checkTotal, bool checkFraction)
bool MatchEnumeration(decimal value, ArrayList enumeration, XmlValueConverter valueConverter)
override Exception CheckValueFacets(int value, XmlSchemaDatatype datatype)
override Exception CheckValueFacets(long value, XmlSchemaDatatype datatype)
override Exception CheckValueFacets(object value, XmlSchemaDatatype datatype)
override bool MatchEnumeration(object value, ArrayList enumeration, XmlSchemaDatatype datatype)
Numeric10FacetsChecker(decimal minVal, decimal maxVal)
decimal ToDecimal(string value)