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

◆ CannonicalizePointlessRoot()

XmlSchemaParticle System.Xml.Schema.Compiler.CannonicalizePointlessRoot ( XmlSchemaParticle particle)
inlineprivate

Definition at line 1325 of file Compiler.cs.

1326 {
1327 if (particle == null)
1328 {
1329 return null;
1330 }
1331 decimal num = 1m;
1332 if (particle is XmlSchemaSequence xmlSchemaSequence)
1333 {
1334 XmlSchemaObjectCollection items = xmlSchemaSequence.Items;
1335 int count = items.Count;
1336 if (count == 1 && xmlSchemaSequence.MinOccurs == num && xmlSchemaSequence.MaxOccurs == num)
1337 {
1338 return (XmlSchemaParticle)items[0];
1339 }
1340 }
1341 else if (particle is XmlSchemaChoice xmlSchemaChoice)
1342 {
1343 XmlSchemaObjectCollection items2 = xmlSchemaChoice.Items;
1344 switch (items2.Count)
1345 {
1346 case 1:
1347 if (xmlSchemaChoice.MinOccurs == num && xmlSchemaChoice.MaxOccurs == num)
1348 {
1349 return (XmlSchemaParticle)items2[0];
1350 }
1351 break;
1352 case 0:
1353 return XmlSchemaParticle.Empty;
1354 }
1355 }
1356 else if (particle is XmlSchemaAll xmlSchemaAll)
1357 {
1358 XmlSchemaObjectCollection items3 = xmlSchemaAll.Items;
1359 int count2 = items3.Count;
1360 if (count2 == 1 && xmlSchemaAll.MinOccurs == num && xmlSchemaAll.MaxOccurs == num)
1361 {
1362 return (XmlSchemaParticle)items3[0];
1363 }
1364 }
1365 return particle;
1366 }

References System.Collections.CollectionBase.Count, System.count, System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Xml.Dictionary, and System.Xml.Schema.XmlSchemaParticle.Empty.

Referenced by System.Xml.Schema.Compiler.CheckParticleDerivation(), and System.Xml.Schema.Compiler.CheckParticleDerivation().