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

◆ ImportStructLikeMapping()

StructMapping System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping ( StructModel model,
string ns,
bool openModel,
XmlAttributes a,
RecursionLimiter limiter )
inlineprivate

Definition at line 709 of file XmlReflectionImporter.cs.

710 {
711 if (model.TypeDesc.Kind == TypeKind.Root)
712 {
713 return GetRootMapping();
714 }
715 if (a == null)
716 {
718 }
719 string text = ns;
720 if (a.XmlType != null && a.XmlType.Namespace != null)
721 {
722 text = a.XmlType.Namespace;
723 }
724 else if (a.XmlRoot != null && a.XmlRoot.Namespace != null)
725 {
726 text = a.XmlRoot.Namespace;
727 }
728 string name = (IsAnonymousType(a, ns) ? null : XsdTypeName(model.Type, a, model.TypeDesc.Name));
729 name = XmlConvert.EncodeLocalName(name);
730 StructMapping structMapping = (StructMapping)GetTypeMapping(name, text, model.TypeDesc, _types, model.Type);
731 if (structMapping == null)
732 {
733 structMapping = new StructMapping();
734 structMapping.TypeDesc = model.TypeDesc;
737 if (!structMapping.IsAnonymousType)
738 {
740 }
741 else
742 {
744 }
745 if (a.XmlType != null)
746 {
747 structMapping.IncludeInSchema = a.XmlType.IncludeInSchema;
748 }
749 if (limiter.IsExceededLimit)
750 {
751 limiter.DeferredWorkItems.Add(new ImportStructWorkItem(model, structMapping));
752 return structMapping;
753 }
754 limiter.Depth++;
756 while (limiter.DeferredWorkItems.Count > 0)
757 {
759 ImportStructWorkItem importStructWorkItem = limiter.DeferredWorkItems[index];
761 {
762 limiter.DeferredWorkItems.RemoveAt(index);
763 }
764 }
765 limiter.Depth--;
766 }
767 return structMapping;
768 }
void Add(TKey key, TValue value)
void Add(XmlQualifiedName qname, object value)
Definition NameTable.cs:57
TypeMapping GetTypeMapping(string typeName, string ns, TypeDesc typeDesc, NameTable typeLib, Type type)
bool InitializeStructMembers(StructMapping mapping, StructModel model, bool openModel, string typeName, RecursionLimiter limiter)
static bool IsAnonymousType(XmlAttributes a, string contextNs)
XmlAttributes GetAttributes(Type type, bool canBeSimpleType)

References System.Xml.Serialization.XmlReflectionImporter._anonymous, System.Xml.Serialization.XmlReflectionImporter._types, System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.Xml.Serialization.NameTable.Add(), System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Xml.Dictionary, System.Xml.XmlConvert.EncodeLocalName(), System.Xml.Serialization.XmlReflectionImporter.GetAttributes(), System.Xml.Serialization.XmlReflectionImporter.GetRootMapping(), System.Xml.Serialization.XmlReflectionImporter.GetTypeMapping(), System.index, System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers(), System.Xml.Serialization.XmlReflectionImporter.IsAnonymousType(), System.text, and System.Xml.Serialization.XmlReflectionImporter.XsdTypeName().

Referenced by System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(), and System.Xml.Serialization.XmlReflectionImporter.InitializeStructMembers().