Terraria
v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
XmlSchemaParticle.cs
Go to the documentation of this file.
1
using
System.Xml.Serialization
;
2
3
namespace
System.Xml.Schema
;
4
5
public
abstract
class
XmlSchemaParticle
:
XmlSchemaAnnotated
6
{
7
[Flags]
8
private
enum
Occurs
9
{
10
None
= 0,
11
Min
= 1,
12
Max
= 2
13
}
14
15
private
sealed
class
EmptyParticle
:
XmlSchemaParticle
16
{
17
internal
override
bool
IsEmpty
=>
true
;
18
}
19
20
private
decimal
_minOccurs
= 1
m
;
21
22
private
decimal
_maxOccurs
= 1
m
;
23
24
private
Occurs
_flags
;
25
26
internal
static
readonly
XmlSchemaParticle
Empty
=
new
EmptyParticle
();
27
28
[
XmlAttribute
(
"minOccurs"
)]
29
public
string
?
MinOccursString
30
{
31
get
32
{
33
if
((
_flags
&
Occurs
.Min) != 0)
34
{
35
return
XmlConvert
.
ToString
(
_minOccurs
);
36
}
37
return
null
;
38
}
39
set
40
{
41
if
(
value
==
null
)
42
{
43
_minOccurs
= 1
m
;
44
_flags
&=
~Occurs
.Min;
45
return
;
46
}
47
_minOccurs
=
XmlConvert
.
ToInteger
(
value
);
48
if
(
_minOccurs
< 0
m
)
49
{
50
throw
new
XmlSchemaException
(
System
.
SR
.
Sch_MinOccursInvalidXsd
,
string
.Empty);
51
}
52
_flags
|=
Occurs
.Min;
53
}
54
}
55
56
[
XmlAttribute
(
"maxOccurs"
)]
57
public
string
?
MaxOccursString
58
{
59
get
60
{
61
if
((
_flags
&
Occurs
.Max) != 0)
62
{
63
if
(!(
_maxOccurs
== decimal.MaxValue))
64
{
65
return
XmlConvert
.
ToString
(
_maxOccurs
);
66
}
67
return
"unbounded"
;
68
}
69
return
null
;
70
}
71
set
72
{
73
if
(
value
==
null
)
74
{
75
_maxOccurs
= 1
m
;
76
_flags
&=
~Occurs
.Max;
77
return
;
78
}
79
if
(
value
==
"unbounded"
)
80
{
81
_maxOccurs
= decimal.MaxValue;
82
}
83
else
84
{
85
_maxOccurs
=
XmlConvert
.
ToInteger
(
value
);
86
if
(
_maxOccurs
< 0
m
)
87
{
88
throw
new
XmlSchemaException
(
System
.
SR
.
Sch_MaxOccursInvalidXsd
,
string
.Empty);
89
}
90
if
(
_maxOccurs
== 0
m
&& (
_flags
&
Occurs
.Min) == 0)
91
{
92
_minOccurs
=
default
(decimal);
93
}
94
}
95
_flags
|=
Occurs
.Max;
96
}
97
}
98
99
[XmlIgnore]
100
public
decimal
MinOccurs
101
{
102
get
103
{
104
return
_minOccurs
;
105
}
106
set
107
{
108
if
(
value
< 0
m
||
value
!= decimal.Truncate(
value
))
109
{
110
throw
new
XmlSchemaException
(
System
.
SR
.
Sch_MinOccursInvalidXsd
,
string
.Empty);
111
}
112
_minOccurs
=
value
;
113
_flags
|=
Occurs
.Min;
114
}
115
}
116
117
[XmlIgnore]
118
public
decimal
MaxOccurs
119
{
120
get
121
{
122
return
_maxOccurs
;
123
}
124
set
125
{
126
if
(
value
< 0
m
||
value
!= decimal.Truncate(
value
))
127
{
128
throw
new
XmlSchemaException
(
System
.
SR
.
Sch_MaxOccursInvalidXsd
,
string
.Empty);
129
}
130
_maxOccurs
=
value
;
131
if
(
_maxOccurs
== 0
m
&& (
_flags
&
Occurs
.Min) == 0)
132
{
133
_minOccurs
=
default
(decimal);
134
}
135
_flags
|=
Occurs
.Max;
136
}
137
}
138
139
internal
virtual
bool
IsEmpty
=>
_maxOccurs
== 0
m
;
140
141
internal
bool
IsMultipleOccurrence
=>
_maxOccurs
> 1
m
;
142
143
internal
virtual
string
NameString
=>
string
.Empty;
144
145
internal
XmlQualifiedName
GetQualifiedName
()
146
{
147
if
(
this
is
XmlSchemaElement
xmlSchemaElement
)
148
{
149
return
xmlSchemaElement
.QualifiedName;
150
}
151
if
(
this
is
XmlSchemaAny
xmlSchemaAny
)
152
{
153
string
@
namespace
=
xmlSchemaAny.Namespace
;
154
@
namespace
= ((@namespace ==
null
) ?
string
.
Empty
: @
namespace
.Trim());
155
return
new
XmlQualifiedName
(
"*"
, (@
namespace
.
Length
== 0) ?
"##any"
: @
namespace
);
156
}
157
return
XmlQualifiedName
.
Empty
;
158
}
159
}
System.Empty
Definition
Empty.cs:4
System.SR.Sch_MaxOccursInvalidXsd
static string Sch_MaxOccursInvalidXsd
Definition
SR.cs:752
System.SR.Sch_MinOccursInvalidXsd
static string Sch_MinOccursInvalidXsd
Definition
SR.cs:754
System.SR
Definition
SR.cs:7
System.Xml.Schema.XmlSchemaAnnotated
Definition
XmlSchemaAnnotated.cs:6
System.Xml.Schema.XmlSchemaAny
Definition
XmlSchemaAny.cs:8
System.Xml.Schema.XmlSchemaElement
Definition
XmlSchemaElement.cs:8
System.Xml.Schema.XmlSchemaException
Definition
XmlSchemaException.cs:10
System.Xml.Schema.XmlSchemaParticle.EmptyParticle.IsEmpty
override bool IsEmpty
Definition
XmlSchemaParticle.cs:17
System.Xml.Schema.XmlSchemaParticle.EmptyParticle
Definition
XmlSchemaParticle.cs:16
System.Xml.Schema.XmlSchemaParticle.IsMultipleOccurrence
bool IsMultipleOccurrence
Definition
XmlSchemaParticle.cs:141
System.Xml.Schema.XmlSchemaParticle.MinOccursString
string? MinOccursString
Definition
XmlSchemaParticle.cs:30
System.Xml.Schema.XmlSchemaParticle._minOccurs
decimal _minOccurs
Definition
XmlSchemaParticle.cs:20
System.Xml.Schema.XmlSchemaParticle.GetQualifiedName
XmlQualifiedName GetQualifiedName()
Definition
XmlSchemaParticle.cs:145
System.Xml.Schema.XmlSchemaParticle.Occurs
Occurs
Definition
XmlSchemaParticle.cs:9
System.Xml.Schema.XmlSchemaParticle.Occurs.Max
@ Max
System.Xml.Schema.XmlSchemaParticle.Occurs.None
@ None
System.Xml.Schema.XmlSchemaParticle.Occurs.Min
@ Min
System.Xml.Schema.XmlSchemaParticle.MaxOccursString
string? MaxOccursString
Definition
XmlSchemaParticle.cs:58
System.Xml.Schema.XmlSchemaParticle._maxOccurs
decimal _maxOccurs
Definition
XmlSchemaParticle.cs:22
System.Xml.Schema.XmlSchemaParticle.IsEmpty
virtual bool IsEmpty
Definition
XmlSchemaParticle.cs:139
System.Xml.Schema.XmlSchemaParticle.NameString
virtual string NameString
Definition
XmlSchemaParticle.cs:143
System.Xml.Schema.XmlSchemaParticle._flags
Occurs _flags
Definition
XmlSchemaParticle.cs:24
System.Xml.Schema.XmlSchemaParticle.MaxOccurs
decimal MaxOccurs
Definition
XmlSchemaParticle.cs:119
System.Xml.Schema.XmlSchemaParticle.MinOccurs
decimal MinOccurs
Definition
XmlSchemaParticle.cs:101
System.Xml.Schema.XmlSchemaParticle
Definition
XmlSchemaParticle.cs:6
System.Xml.XmlAttribute
Definition
XmlAttribute.cs:8
System.Xml.XmlConvert.ToString
static string ToString(bool value)
Definition
XmlConvert.cs:507
System.Xml.XmlConvert.ToInteger
static decimal ToInteger(string s)
Definition
XmlConvert.cs:727
System.Xml.XmlConvert
Definition
XmlConvert.cs:11
System.Xml.XmlQualifiedName.Empty
static readonly XmlQualifiedName Empty
Definition
XmlQualifiedName.cs:13
System.Xml.XmlQualifiedName
Definition
XmlQualifiedName.cs:6
System.Xml.Schema.FacetType.Length
@ Length
System.Xml.Schema
Definition
Extensions.cs:3
System.Xml.Serialization
Definition
DateTimeSerializationSection.cs:1
System.Xml.ValueHandleType.Dictionary
@ Dictionary
System.ExceptionArgument.value
@ value
System
Definition
BlockingCollection.cs:8
source
System.Private.Xml
System.Xml.Schema
XmlSchemaParticle.cs
Generated by
1.10.0