private TypeMapping ImportType(XmlSchemaComplexType type, string typeNs, string identifier, Type desiredMappingType, Type baseType, TypeFlags flags)
{
if (type.Redefined != null)
{
// we do not support redefine in the current version
throw new NotSupportedException(SR.Format(SR.XmlUnsupportedRedefine, type.Name, typeNs));
}
if (desiredMappingType == typeof(TypeMapping))
{
TypeMapping mapping = null;
if (baseType == null)
{
if ((mapping = ImportArrayMapping(type, identifier, typeNs, false)) == null)
{
mapping = ImportAnyMapping(type, identifier, typeNs, false);
}
}
if (mapping == null)
{
mapping = ImportStructType(type, typeNs, identifier, baseType, false);
if (mapping != null && type.Name != null && type.Name.Length != 0)
ImportDerivedTypes(new XmlQualifiedName(identifier, typeNs));
}
return mapping;
}
else if (desiredMappingType == typeof(MembersMapping))
return ImportMembersType(type, typeNs, identifier);
else
throw new ArgumentException(SR.XmlInternalError, nameof(desiredMappingType));
}