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

◆ CheckValueFacets() [4/12]

override Exception System.Xml.Schema.Numeric2FacetsChecker.CheckValueFacets ( double value,
XmlSchemaDatatype datatype )
inlinepackagevirtual

Reimplemented from System.Xml.Schema.FacetsChecker.

Definition at line 13 of file Numeric2FacetsChecker.cs.

14 {
15 RestrictionFacets restriction = datatype.Restriction;
16 RestrictionFlags restrictionFlags = restriction?.Flags ?? ((RestrictionFlags)0);
17 XmlValueConverter valueConverter = datatype.ValueConverter;
18 if ((restrictionFlags & RestrictionFlags.MaxInclusive) != 0 && value > valueConverter.ToDouble(restriction.MaxInclusive))
19 {
20 return new XmlSchemaException(System.SR.Sch_MaxInclusiveConstraintFailed, string.Empty);
21 }
22 if ((restrictionFlags & RestrictionFlags.MaxExclusive) != 0 && value >= valueConverter.ToDouble(restriction.MaxExclusive))
23 {
24 return new XmlSchemaException(System.SR.Sch_MaxExclusiveConstraintFailed, string.Empty);
25 }
26 if ((restrictionFlags & RestrictionFlags.MinInclusive) != 0 && value < valueConverter.ToDouble(restriction.MinInclusive))
27 {
28 return new XmlSchemaException(System.SR.Sch_MinInclusiveConstraintFailed, string.Empty);
29 }
30 if ((restrictionFlags & RestrictionFlags.MinExclusive) != 0 && value <= valueConverter.ToDouble(restriction.MinExclusive))
31 {
32 return new XmlSchemaException(System.SR.Sch_MinExclusiveConstraintFailed, string.Empty);
33 }
34 if ((restrictionFlags & RestrictionFlags.Enumeration) != 0 && !MatchEnumeration(value, restriction.Enumeration, valueConverter))
35 {
36 return new XmlSchemaException(System.SR.Sch_EnumerationConstraintFailed, string.Empty);
37 }
38 return null;
39 }
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 Sch_MaxExclusiveConstraintFailed
Definition SR.cs:698
static string Sch_EnumerationConstraintFailed
Definition SR.cs:694
Definition SR.cs:7
override bool MatchEnumeration(object value, ArrayList enumeration, XmlSchemaDatatype datatype)

References System.Xml.Dictionary, System.Xml.Schema.RestrictionFacets.Flags, System.Xml.Schema.Numeric2FacetsChecker.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.value, and System.Xml.Schema.XmlSchemaDatatype.ValueConverter.