Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
RangeContentValidator.cs
Go to the documentation of this file.
3
4namespace System.Xml.Schema;
5
7{
8 private readonly BitSet _firstpos;
9
10 private readonly BitSet[] _followpos;
11
13
14 private readonly SymbolsDictionary _symbols;
15
16 private readonly Positions _positions;
17
18 private readonly int _minMaxNodesCount;
19
20 private readonly int _endMarkerPos;
21
33
34 public override void InitValidation(ValidationState context)
35 {
37 if (list == null)
38 {
40 }
41 else
42 {
43 list.Clear();
44 }
48 list.Add(item);
51 }
52
53 public override object ValidateElement(XmlQualifiedName name, ValidationState context, out int errorCode)
54 {
55 errorCode = 0;
56 int num = _symbols[name];
57 bool flag = false;
60 int i = 0;
61 int num2 = -1;
62 int num3 = -1;
63 bool flag2 = false;
64 for (; i < numberOfRunningPos; i++)
65 {
66 BitSet curpos = runningPositions[i].curpos;
67 for (int num4 = curpos.NextSet(-1); num4 != -1; num4 = curpos.NextSet(num4))
68 {
69 if (num == _positions[num4].symbol)
70 {
71 num2 = num4;
72 if (num3 == -1)
73 {
74 num3 = i;
75 }
76 flag2 = true;
77 break;
78 }
79 }
80 if (flag2 && _positions[num2].particle is XmlSchemaElement)
81 {
82 break;
83 }
84 }
85 if (i == numberOfRunningPos && num2 != -1)
86 {
87 i = num3;
88 }
89 if (i < numberOfRunningPos)
90 {
91 if (i != 0)
92 {
93 runningPositions.RemoveRange(0, i);
94 }
96 i = 0;
97 while (i < numberOfRunningPos)
98 {
100 if (value.curpos.Get(num2))
101 {
104 i++;
105 continue;
106 }
108 if (numberOfRunningPos > 0)
109 {
113 }
114 }
115 }
116 else
117 {
119 }
120 if (numberOfRunningPos > 0)
121 {
122 if (numberOfRunningPos >= 10000)
123 {
124 context.TooComplex = true;
126 }
127 for (i = numberOfRunningPos - 1; i >= 0; i--)
128 {
129 int index = i;
130 BitSet curpos2 = runningPositions[i].curpos;
131 flag = flag || curpos2.Get(_endMarkerPos);
132 while (numberOfRunningPos < 10000 && curpos2.Intersects(_positionsWithRangeTerminals))
133 {
134 BitSet bitSet = curpos2.Clone();
136 int num5 = bitSet.NextSet(-1);
140 {
143 }
145 if (value3.rangeCounters == null)
146 {
148 }
149 Array.Copy(value.rangeCounters, value3.rangeCounters, value.rangeCounters.Length);
150 decimal num6 = ++value3.rangeCounters[leafRangeNode.Pos];
151 if (num6 == leafRangeNode.Max)
152 {
154 value3.rangeCounters[leafRangeNode.Pos] = default(decimal);
157 }
158 else
159 {
160 if (num6 < leafRangeNode.Min)
161 {
162 value3.curpos = leafRangeNode.NextIteration;
165 break;
166 }
167 value3.curpos = leafRangeNode.NextIteration;
171 if (value3.rangeCounters == null)
172 {
174 }
175 Array.Copy(value.rangeCounters, value3.rangeCounters, value.rangeCounters.Length);
177 value3.rangeCounters[leafRangeNode.Pos] = default(decimal);
180 }
182 flag = flag || curpos2.Get(_endMarkerPos);
183 }
184 }
185 context.HasMatched = flag;
187 return _positions[num2].particle;
188 }
189 errorCode = -1;
191 return null;
192 }
193
194 public override bool CompleteValidation(ValidationState context)
195 {
196 return context.HasMatched;
197 }
198
200 {
201 ArrayList arrayList = null;
202 if (context.RunningPositions != null)
203 {
206 for (int num = context.CurrentState.NumberOfRunningPos - 1; num >= 0; num--)
207 {
208 bitSet.Or(runningPositions[num].curpos);
209 }
210 for (int num2 = bitSet.NextSet(-1); num2 != -1; num2 = bitSet.NextSet(num2))
211 {
212 if (arrayList == null)
213 {
214 arrayList = new ArrayList();
215 }
216 int symbol = _positions[num2].symbol;
217 if (symbol >= 0)
218 {
220 {
221 string text = _symbols.NameOf(_positions[num2].symbol);
222 if (text.Length != 0)
223 {
225 }
226 }
227 else
228 {
229 string nameString = xmlSchemaParticle.NameString;
231 {
233 }
234 }
235 }
236 }
237 }
238 return arrayList;
239 }
240
242 {
244 if (context.RunningPositions != null)
245 {
248 for (int num = context.CurrentState.NumberOfRunningPos - 1; num >= 0; num--)
249 {
250 bitSet.Or(runningPositions[num].curpos);
251 }
252 for (int num2 = bitSet.NextSet(-1); num2 != -1; num2 = bitSet.NextSet(num2))
253 {
254 int symbol = _positions[num2].symbol;
255 if (symbol >= 0 && _positions[num2].particle is XmlSchemaParticle p)
256 {
258 }
259 }
260 }
261 return arrayList;
262 }
263}
static unsafe void Copy(Array sourceArray, Array destinationArray, int length)
Definition Array.cs:624
bool ICollection< KeyValuePair< TKey, TValue > >. Contains(KeyValuePair< TKey, TValue > keyValuePair)
void Add(TKey key, TValue value)
int NextSet(int startFrom)
Definition BitSet.cs:68
bool Get(int index)
Definition BitSet.cs:57
static void AddParticleToExpected(XmlSchemaParticle p, XmlSchemaSet schemaSet, ArrayList particles)
override bool CompleteValidation(ValidationState context)
override ArrayList ExpectedElements(ValidationState context, bool isRequiredOnly)
RangeContentValidator(BitSet firstpos, BitSet[] followpos, SymbolsDictionary symbols, Positions positions, int endMarkerPos, XmlSchemaContentType contentType, bool isEmptiable, BitSet positionsWithRangeTerminals, int minmaxNodesCount)
override object ValidateElement(XmlQualifiedName name, ValidationState context, out int errorCode)
override ArrayList ExpectedParticles(ValidationState context, bool isRequiredOnly, XmlSchemaSet schemaSet)
override void InitValidation(ValidationState context)
List< RangePositionInfo > RunningPositions