Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CheckValueFacets() [3/12]

override Exception System.Xml.Schema.Numeric10FacetsChecker.CheckValueFacets ( decimal value,
XmlSchemaDatatype datatype )
inlinepackagevirtual

Reimplemented from System.Xml.Schema.FacetsChecker.

Definition at line 24 of file Numeric10FacetsChecker.cs.

25 {
26 RestrictionFacets restriction = datatype.Restriction;
27 RestrictionFlags restrictionFlags = restriction?.Flags ?? ((RestrictionFlags)0);
28 XmlValueConverter valueConverter = datatype.ValueConverter;
29 if (value > _maxValue || value < _minValue)
30 {
31 return new OverflowException(System.SR.Format(System.SR.XmlConvert_Overflow, value.ToString(CultureInfo.InvariantCulture), datatype.TypeCodeString));
32 }
33 if (restrictionFlags != 0)
34 {
35 if ((restrictionFlags & RestrictionFlags.MaxInclusive) != 0 && value > valueConverter.ToDecimal(restriction.MaxInclusive))
36 {
37 return new XmlSchemaException(System.SR.Sch_MaxInclusiveConstraintFailed, string.Empty);
38 }
39 if ((restrictionFlags & RestrictionFlags.MaxExclusive) != 0 && value >= valueConverter.ToDecimal(restriction.MaxExclusive))
40 {
41 return new XmlSchemaException(System.SR.Sch_MaxExclusiveConstraintFailed, string.Empty);
42 }
43 if ((restrictionFlags & RestrictionFlags.MinInclusive) != 0 && value < valueConverter.ToDecimal(restriction.MinInclusive))
44 {
45 return new XmlSchemaException(System.SR.Sch_MinInclusiveConstraintFailed, string.Empty);
46 }
47 if ((restrictionFlags & RestrictionFlags.MinExclusive) != 0 && value <= valueConverter.ToDecimal(restriction.MinExclusive))
48 {
49 return new XmlSchemaException(System.SR.Sch_MinExclusiveConstraintFailed, string.Empty);
50 }
51 if ((restrictionFlags & RestrictionFlags.Enumeration) != 0 && !MatchEnumeration(value, restriction.Enumeration, valueConverter))
52 {
53 return new XmlSchemaException(System.SR.Sch_EnumerationConstraintFailed, string.Empty);
54 }
55 return CheckTotalAndFractionDigits(value, restriction.TotalDigits, restriction.FractionDigits, (restrictionFlags & RestrictionFlags.TotalDigits) != 0, (restrictionFlags & RestrictionFlags.FractionDigits) != 0);
56 }
57 return null;
58 }
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
Definition SR.cs:7
Exception CheckTotalAndFractionDigits(decimal value, int totalDigits, int fractionDigits, bool checkTotal, bool checkFraction)
override bool MatchEnumeration(object value, ArrayList enumeration, XmlSchemaDatatype datatype)

References System.Xml.Schema.Numeric10FacetsChecker._maxValue, System.Xml.Schema.Numeric10FacetsChecker._minValue, System.Xml.Schema.Numeric10FacetsChecker.CheckTotalAndFractionDigits(), System.Xml.Dictionary, System.Xml.Schema.RestrictionFacets.Flags, System.SR.Format(), System.Globalization.CultureInfo.InvariantCulture, System.Xml.Schema.Numeric10FacetsChecker.MatchEnumeration(), System.Xml.Schema.XmlSchemaDatatype.Restriction, System.SR.Sch_EnumerationConstraintFailed, System.SR.Sch_MaxExclusiveConstraintFailed, System.SR.Sch_MaxInclusiveConstraintFailed, System.SR.Sch_MinExclusiveConstraintFailed, System.SR.Sch_MinInclusiveConstraintFailed, System.Xml.Schema.XmlSchemaDatatype.TypeCodeString, System.value, System.Xml.Schema.XmlSchemaDatatype.ValueConverter, and System.SR.XmlConvert_Overflow.