Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
SchemaGraph.cs
Go to the documentation of this file.
4
6
7internal sealed class SchemaGraph
8{
9 private readonly ArrayList _empty = new ArrayList();
10
11 private readonly XmlSchemas _schemas;
12
13 private readonly Hashtable _scope;
14
15 private readonly int _items;
16
17 [RequiresUnreferencedCode("Calls Compile")]
18 internal SchemaGraph(Hashtable scope, XmlSchemas schemas)
19 {
20 _scope = scope;
21 schemas.Compile(null, fullCompile: false);
22 _schemas = schemas;
23 _items = 0;
24 foreach (XmlSchema schema in schemas)
25 {
26 _items += schema.Items.Count;
27 foreach (XmlSchemaObject item in schema.Items)
28 {
30 }
31 }
32 }
33
35 {
36 return new ArrayList(_scope.Keys);
37 }
38
40 {
41 if (o != null && !_schemas.IsReference(o) && o.Parent is XmlSchema xmlSchema)
42 {
43 string targetNamespace = xmlSchema.TargetNamespace;
44 if (!(targetNamespace == "http://www.w3.org/2001/XMLSchema") && !list.Contains(o))
45 {
46 list.Add(o);
47 }
48 }
49 }
50
52 {
53 if (item.Parent is XmlSchema)
54 {
55 if (_scope[item] != null)
56 {
57 return (ArrayList)_scope[item];
58 }
62 return arrayList;
63 }
64 return _empty;
65 }
66
68 {
69 if (item == null || _scope[item] != null)
70 {
71 return;
72 }
74 if (typeof(XmlSchemaType).IsAssignableFrom(type))
75 {
81 {
83 if (xmlSchemaComplexType.ContentModel != null)
84 {
85 XmlSchemaContent content = xmlSchemaComplexType.ContentModel.Content;
87 {
90 }
92 {
94 if (xmlSchemaSimpleContentRestriction.BaseType != null)
95 {
97 }
98 else
99 {
101 }
103 }
104 else if (content is XmlSchemaComplexContentExtension)
105 {
110 }
111 else if (content is XmlSchemaSimpleContentExtension)
112 {
116 }
117 }
118 else
119 {
122 }
124 {
127 }
129 {
131 }
132 }
133 else if (item is XmlSchemaSimpleType)
134 {
138 {
141 }
143 {
145 if (xmlSchemaSimpleTypeList.ItemTypeName != null && !xmlSchemaSimpleTypeList.ItemTypeName.IsEmpty)
146 {
148 }
149 if (xmlSchemaSimpleTypeList.ItemType != null)
150 {
152 }
153 }
155 {
157 if (memberTypes != null)
158 {
159 for (int i = 0; i < memberTypes.Length; i++)
160 {
162 AddRef(refs, o);
163 }
164 }
165 }
166 }
167 if (xmlSchemaType == null && !xmlQualifiedName.IsEmpty && xmlQualifiedName.Namespace != "http://www.w3.org/2001/XMLSchema")
168 {
170 }
171 if (xmlSchemaType != null)
172 {
174 }
175 if (xmlSchemaParticle != null)
176 {
178 }
179 if (xmlSchemaObjectCollection != null)
180 {
181 for (int j = 0; j < xmlSchemaObjectCollection.Count; j++)
182 {
184 }
185 }
186 }
187 else if (type == typeof(XmlSchemaElement))
188 {
190 if (!xmlSchemaElement.SubstitutionGroup.IsEmpty && xmlSchemaElement.SubstitutionGroup.Namespace != "http://www.w3.org/2001/XMLSchema")
191 {
193 AddRef(refs, o2);
194 }
195 if (!xmlSchemaElement.RefName.IsEmpty)
196 {
199 }
200 else if (!xmlSchemaElement.SchemaTypeName.IsEmpty)
201 {
203 AddRef(refs, o3);
204 }
205 else
206 {
207 Depends(xmlSchemaElement.SchemaType, refs);
208 }
209 }
210 else if (type == typeof(XmlSchemaGroup))
211 {
212 Depends(((XmlSchemaGroup)item).Particle);
213 }
214 else if (type == typeof(XmlSchemaGroupRef))
215 {
217 AddRef(refs, o4);
218 }
219 else if (typeof(XmlSchemaGroupBase).IsAssignableFrom(type))
220 {
221 foreach (XmlSchemaObject item2 in ((XmlSchemaGroupBase)item).Items)
222 {
224 }
225 }
227 {
229 AddRef(refs, o5);
230 }
232 {
233 foreach (XmlSchemaObject attribute in ((XmlSchemaAttributeGroup)item).Attributes)
234 {
236 }
237 }
238 else if (type == typeof(XmlSchemaAttribute))
239 {
241 if (!xmlSchemaAttribute.RefName.IsEmpty)
242 {
245 }
246 else if (!xmlSchemaAttribute.SchemaTypeName.IsEmpty)
247 {
249 AddRef(refs, o6);
250 }
251 else
252 {
253 Depends(xmlSchemaAttribute.SchemaType, refs);
254 }
255 }
256 if (!typeof(XmlSchemaAnnotated).IsAssignableFrom(type))
257 {
258 return;
259 }
260 XmlAttribute[] unhandledAttributes = ((XmlSchemaAnnotated)item).UnhandledAttributes;
261 if (unhandledAttributes == null)
262 {
263 return;
264 }
266 {
267 if (xmlAttribute.LocalName == "arrayType" && xmlAttribute.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/")
268 {
269 string dims;
272 AddRef(refs, o7);
273 }
274 }
275 }
276}
virtual ICollection Keys
Definition Hashtable.cs:532
virtual void Add(object key, object? value)
Definition Hashtable.cs:676
static ? Type GetType(string typeName, bool throwOnError, bool ignoreCase)
Definition Type.cs:408
SchemaGraph(Hashtable scope, XmlSchemas schemas)
ArrayList Depends(XmlSchemaObject item)
void AddRef(ArrayList list, XmlSchemaObject o)
void Depends(XmlSchemaObject item, ArrayList refs)
static XmlQualifiedName ParseWsdlArrayType(string type, out string dims, XmlSchemaObject parent)
Definition TypeScope.cs:907
bool IsReference(XmlSchemaObject type)
void Compile(ValidationEventHandler? handler, bool fullCompile)
object? Find(XmlQualifiedName name, Type type)
static readonly XmlQualifiedName Empty