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

◆ ImportArrayMapping()

ArrayMapping System.Xml.Serialization.XmlSchemaImporter.ImportArrayMapping ( XmlSchemaType type,
string identifier,
string ns,
bool repeats )
inlineprivate

Definition at line 1254 of file XmlSchemaImporter.cs.

1255 {
1257 {
1258 return null;
1259 }
1260 if (!type.DerivedFrom.IsEmpty)
1261 {
1262 return null;
1263 }
1264 if (IsMixed(type))
1265 {
1266 return null;
1267 }
1268 Mapping mapping = (Mapping)base.ImportedMappings[type];
1269 if (mapping != null)
1270 {
1271 if (mapping is ArrayMapping)
1272 {
1273 return (ArrayMapping)mapping;
1274 }
1275 return null;
1276 }
1277 TypeItems typeItems = GetTypeItems(type);
1278 if (typeItems.Attributes != null && typeItems.Attributes.Count > 0)
1279 {
1280 return null;
1281 }
1282 if (typeItems.AnyAttribute != null)
1283 {
1284 return null;
1285 }
1286 if (typeItems.Particle == null)
1287 {
1288 return null;
1289 }
1290 XmlSchemaGroupBase particle = typeItems.Particle;
1291 ArrayMapping arrayMapping = new ArrayMapping();
1294 if (particle is XmlSchemaChoice)
1295 {
1297 if (!xmlSchemaChoice.IsMultipleOccurrence)
1298 {
1299 return null;
1300 }
1301 bool needExplicitOrder = false;
1303 if (memberMapping.ChoiceIdentifier != null)
1304 {
1305 return null;
1306 }
1309 arrayMapping.TypeName = ((type.Name == null || type.Name.Length == 0) ? ("ArrayOf" + CodeIdentifier.MakePascal(arrayMapping.TypeDesc.Name)) : type.Name);
1310 }
1311 else
1312 {
1313 if (!(particle is XmlSchemaAll) && !(particle is XmlSchemaSequence))
1314 {
1315 return null;
1316 }
1317 if (particle.Items.Count != 1 || !(particle.Items[0] is XmlSchemaElement))
1318 {
1319 return null;
1320 }
1322 if (!xmlSchemaElement.IsMultipleOccurrence)
1323 {
1324 return null;
1325 }
1327 {
1328 return null;
1329 }
1330 ElementAccessor elementAccessor = ImportElement(xmlSchemaElement, identifier, typeof(TypeMapping), null, ns, topLevelElement: false);
1331 if (elementAccessor.Any)
1332 {
1333 return null;
1334 }
1335 arrayMapping.Elements = new ElementAccessor[1] { elementAccessor };
1336 arrayMapping.TypeDesc = elementAccessor.Mapping.TypeDesc.CreateArrayTypeDesc();
1337 arrayMapping.TypeName = ((type.Name == null || type.Name.Length == 0) ? ("ArrayOf" + CodeIdentifier.MakePascal(elementAccessor.Mapping.TypeDesc.Name)) : type.Name);
1338 }
1339 base.ImportedMappings[type] = arrayMapping;
1340 base.Scope.AddTypeMapping(arrayMapping);
1343 if (type.Name != null && type.Name.Length != 0)
1344 {
1345 ImportDerivedTypes(new XmlQualifiedName(identifier, ns));
1346 }
1347 return arrayMapping;
1348 }
static bool IsMixed(XmlSchemaType type)
ElementAccessor ImportElement(XmlQualifiedName name, Type desiredMappingType, Type baseType)
TypeItems GetTypeItems(XmlSchemaType type)
StructMapping ImportStructType(XmlSchemaType type, string typeNs, string identifier, Type baseType, bool arrayLike)
override void ImportDerivedTypes(XmlQualifiedName baseName)
bool IsCyclicReferencedType(XmlSchemaElement element, List< string > identifiers)
MemberMapping ImportChoiceGroup(XmlSchemaGroupBase group, string identifier, CodeIdentifiers members, CodeIdentifiers membersScope, INameScope elementsScope, string ns, bool groupRepeats, ref bool needExplicitOrder, bool allowDuplicates)

References System.Collections.CollectionBase.Count, System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Xml.Dictionary, System.Xml.Serialization.XmlSchemaImporter.GetTypeItems(), System.Xml.Serialization.XmlSchemaImporter.ImportChoiceGroup(), System.Xml.Serialization.XmlSchemaImporter.ImportDerivedTypes(), System.Xml.Serialization.XmlSchemaImporter.ImportElement(), System.Xml.Serialization.XmlSchemaImporter.ImportStructType(), System.Xml.Serialization.XmlSchemaImporter.IsCyclicReferencedType(), System.Xml.Serialization.XmlSchemaImporter.IsMixed(), System.Xml.Schema.XmlSchemaGroupBase.Items, System.Xml.Serialization.CodeIdentifier.MakePascal(), and System.type.

Referenced by System.Xml.Serialization.XmlSchemaImporter.ImportArray(), and System.Xml.Serialization.XmlSchemaImporter.ImportType().