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

◆ ExportTypeMembers()

void System.Xml.Serialization.XmlSchemaExporter.ExportTypeMembers ( XmlSchemaComplexType type,
MemberMapping[] members,
string name,
string ns,
bool hasSimpleContent,
bool openModel )
inlineprivate

Definition at line 1079 of file XmlSchemaExporter.cs.

1080 {
1082 TypeMapping typeMapping = null;
1083 foreach (MemberMapping memberMapping in members)
1084 {
1085 if (memberMapping.Ignore)
1086 {
1087 continue;
1088 }
1089 if (memberMapping.Text != null)
1090 {
1091 if (typeMapping != null)
1092 {
1094 }
1095 typeMapping = memberMapping.Text.Mapping;
1096 }
1097 if (memberMapping.Elements.Length != 0)
1098 {
1099 bool repeats = memberMapping.TypeDesc.IsArrayLike && (memberMapping.Elements.Length != 1 || !(memberMapping.Elements[0].Mapping is ArrayMapping));
1100 bool valueTypeOptional = memberMapping.CheckSpecified != 0 || memberMapping.CheckShouldPersist;
1102 }
1103 }
1104 if (xmlSchemaGroupBase.Items.Count > 0)
1105 {
1106 if (type.ContentModel != null)
1107 {
1108 if (type.ContentModel.Content is XmlSchemaComplexContentRestriction)
1109 {
1110 ((XmlSchemaComplexContentRestriction)type.ContentModel.Content).Particle = xmlSchemaGroupBase;
1111 }
1112 else
1113 {
1114 if (!(type.ContentModel.Content is XmlSchemaComplexContentExtension))
1115 {
1116 throw new InvalidOperationException(System.SR.Format(System.SR.XmlInvalidContent, type.ContentModel.Content.GetType().Name));
1117 }
1118 ((XmlSchemaComplexContentExtension)type.ContentModel.Content).Particle = xmlSchemaGroupBase;
1119 }
1120 }
1121 else
1122 {
1124 }
1125 }
1126 if (typeMapping != null)
1127 {
1128 if (hasSimpleContent)
1129 {
1130 if (typeMapping is PrimitiveMapping && xmlSchemaGroupBase.Items.Count == 0)
1131 {
1132 PrimitiveMapping primitiveMapping = (PrimitiveMapping)typeMapping;
1133 if (primitiveMapping.IsList)
1134 {
1135 type.IsMixed = true;
1136 }
1137 else
1138 {
1139 if (primitiveMapping.IsAnonymousType)
1140 {
1141 throw new InvalidOperationException(System.SR.Format(System.SR.XmlAnonymousBaseType, typeMapping.TypeDesc.Name, primitiveMapping.TypeDesc.Name, "AnonymousType", "false"));
1142 }
1147 }
1148 }
1149 }
1150 else
1151 {
1152 type.IsMixed = true;
1153 }
1154 }
1155 bool flag = false;
1156 for (int j = 0; j < members.Length; j++)
1157 {
1158 AttributeAccessor attribute = members[j].Attribute;
1159 if (attribute != null)
1160 {
1161 ExportAttributeAccessor(type, members[j].Attribute, members[j].CheckSpecified != 0 || members[j].CheckShouldPersist, ns);
1162 if (members[j].Attribute.Any)
1163 {
1164 flag = true;
1165 }
1166 }
1167 }
1168 if (openModel && !flag)
1169 {
1170 AttributeAccessor attributeAccessor = new AttributeAccessor();
1171 attributeAccessor.Any = true;
1173 }
1174 }
static string XmlInvalidContent
Definition SR.cs:1600
static string XmlAnonymousBaseType
Definition SR.cs:1616
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string XmlIllegalMultipleText
Definition SR.cs:1670
Definition SR.cs:7
void ExportAttributeAccessor(XmlSchemaComplexType type, AttributeAccessor accessor, bool valueTypeOptional, string ns)
XmlQualifiedName ExportPrimitiveMapping(PrimitiveMapping mapping, string ns)
void ExportElementAccessors(XmlSchemaGroupBase group, ElementAccessor[] accessors, bool repeats, bool valueTypeOptional, string ns)

References System.Xml.Dictionary, System.Xml.Serialization.XmlSchemaExporter.ExportAttributeAccessor(), System.Xml.Serialization.XmlSchemaExporter.ExportElementAccessors(), System.Xml.Serialization.XmlSchemaExporter.ExportPrimitiveMapping(), System.SR.Format(), System.type, System.SR.XmlAnonymousBaseType, System.SR.XmlIllegalMultipleText, and System.SR.XmlInvalidContent.

Referenced by System.Xml.Serialization.XmlSchemaExporter.ExportMembersMapping(), and System.Xml.Serialization.XmlSchemaExporter.ExportStructMapping().