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

◆ CheckValueFacets() [11/13]

Exception System.Xml.Schema.StringFacetsChecker.CheckValueFacets ( string value,
XmlSchemaDatatype datatype,
bool verifyUri )
inlinepackage

Definition at line 35 of file StringFacetsChecker.cs.

36 {
37 int length = value.Length;
38 RestrictionFacets restriction = datatype.Restriction;
39 RestrictionFlags restrictionFlags = restriction?.Flags ?? ((RestrictionFlags)0);
40 Exception ex = CheckBuiltInFacets(value, datatype.TypeCode, verifyUri);
41 if (ex != null)
42 {
43 return ex;
44 }
45 if (restrictionFlags != 0)
46 {
47 if ((restrictionFlags & RestrictionFlags.Length) != 0 && restriction.Length != length)
48 {
49 return new XmlSchemaException(System.SR.Sch_LengthConstraintFailed, string.Empty);
50 }
51 if ((restrictionFlags & RestrictionFlags.MinLength) != 0 && length < restriction.MinLength)
52 {
53 return new XmlSchemaException(System.SR.Sch_MinLengthConstraintFailed, string.Empty);
54 }
55 if ((restrictionFlags & RestrictionFlags.MaxLength) != 0 && restriction.MaxLength < length)
56 {
57 return new XmlSchemaException(System.SR.Sch_MaxLengthConstraintFailed, string.Empty);
58 }
59 if ((restrictionFlags & RestrictionFlags.Enumeration) != 0 && !MatchEnumeration(value, restriction.Enumeration, datatype))
60 {
61 return new XmlSchemaException(System.SR.Sch_EnumerationConstraintFailed, string.Empty);
62 }
63 }
64 return null;
65 }
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
Exception CheckBuiltInFacets(string s, XmlTypeCode typeCode, bool verifyUri)
override bool MatchEnumeration(object value, ArrayList enumeration, XmlSchemaDatatype datatype)

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