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

◆ CheckValueFacets() [12/12]

override Exception System.Xml.Schema.QNameFacetsChecker.CheckValueFacets ( XmlQualifiedName value,
XmlSchemaDatatype datatype )
inlinepackagevirtual

Reimplemented from System.Xml.Schema.FacetsChecker.

Definition at line 13 of file QNameFacetsChecker.cs.

14 {
15 RestrictionFacets restriction = datatype.Restriction;
16 RestrictionFlags restrictionFlags = restriction?.Flags ?? ((RestrictionFlags)0);
17 if (restrictionFlags != 0)
18 {
19 string text = value.ToString();
20 int length = text.Length;
21 if ((restrictionFlags & RestrictionFlags.Length) != 0 && restriction.Length != length)
22 {
23 return new XmlSchemaException(System.SR.Sch_LengthConstraintFailed, string.Empty);
24 }
25 if ((restrictionFlags & RestrictionFlags.MinLength) != 0 && length < restriction.MinLength)
26 {
27 return new XmlSchemaException(System.SR.Sch_MinLengthConstraintFailed, string.Empty);
28 }
29 if ((restrictionFlags & RestrictionFlags.MaxLength) != 0 && restriction.MaxLength < length)
30 {
31 return new XmlSchemaException(System.SR.Sch_MaxLengthConstraintFailed, string.Empty);
32 }
33 if ((restrictionFlags & RestrictionFlags.Enumeration) != 0 && !MatchEnumeration(value, restriction.Enumeration))
34 {
35 return new XmlSchemaException(System.SR.Sch_EnumerationConstraintFailed, string.Empty);
36 }
37 }
38 return null;
39 }
static string Sch_LengthConstraintFailed
Definition SR.cs:686
static string Sch_MinLengthConstraintFailed
Definition SR.cs:688
static string Sch_EnumerationConstraintFailed
Definition SR.cs:694
static string Sch_MaxLengthConstraintFailed
Definition SR.cs:690
Definition SR.cs:7
override bool MatchEnumeration(object value, ArrayList enumeration, XmlSchemaDatatype datatype)

References System.Xml.Dictionary, System.Xml.Schema.RestrictionFacets.Flags, System.length, System.Xml.Schema.QNameFacetsChecker.MatchEnumeration(), System.Xml.Schema.XmlSchemaDatatype.Restriction, System.SR.Sch_EnumerationConstraintFailed, System.SR.Sch_LengthConstraintFailed, System.SR.Sch_MaxLengthConstraintFailed, System.SR.Sch_MinLengthConstraintFailed, System.text, and System.value.