Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
XmlSchemaObjectComparer.cs
Go to the documentation of this file.
3
5
6internal sealed class XmlSchemaObjectComparer : IComparer
7{
8 private readonly QNameComparer _comparer = new QNameComparer();
9
10 public int Compare(object o1, object o2)
11 {
13 }
14
16 {
18 {
19 return ((XmlSchemaAttribute)o).QualifiedName;
20 }
22 {
23 return ((XmlSchemaAttributeGroup)o).QualifiedName;
24 }
26 {
27 return ((XmlSchemaComplexType)o).QualifiedName;
28 }
30 {
31 return ((XmlSchemaSimpleType)o).QualifiedName;
32 }
34 {
35 return ((XmlSchemaElement)o).QualifiedName;
36 }
38 {
39 return ((XmlSchemaGroup)o).QualifiedName;
40 }
42 {
43 return ((XmlSchemaGroupRef)o).RefName;
44 }
46 {
47 return ((XmlSchemaNotation)o).QualifiedName;
48 }
50 {
52 if (xmlSchemaSequence.Items.Count == 0)
53 {
54 return new XmlQualifiedName(".sequence", Namespace(o));
55 }
56 return NameOf(xmlSchemaSequence.Items[0]);
57 }
58 if (o is XmlSchemaAll)
59 {
61 if (xmlSchemaAll.Items.Count == 0)
62 {
63 return new XmlQualifiedName(".all", Namespace(o));
64 }
65 return NameOf(xmlSchemaAll.Items);
66 }
68 {
70 if (xmlSchemaChoice.Items.Count == 0)
71 {
72 return new XmlQualifiedName(".choice", Namespace(o));
73 }
74 return NameOf(xmlSchemaChoice.Items);
75 }
76 if (o is XmlSchemaAny)
77 {
78 return new XmlQualifiedName("*", SchemaObjectWriter.ToString(((XmlSchemaAny)o).NamespaceList));
79 }
81 {
82 return ((XmlSchemaIdentityConstraint)o).QualifiedName;
83 }
84 return new XmlQualifiedName("?", Namespace(o));
85 }
86
88 {
90 for (int i = 0; i < items.Count; i++)
91 {
92 arrayList.Add(NameOf(items[i]));
93 }
94 arrayList.Sort(new QNameComparer());
95 return (XmlQualifiedName)arrayList[0];
96 }
97
98 internal static string Namespace(XmlSchemaObject o)
99 {
100 while (o != null && !(o is XmlSchema))
101 {
102 o = o.Parent;
103 }
104 if (o != null)
105 {
106 return ((XmlSchema)o).TargetNamespace;
107 }
108 return "";
109 }
110}
int Compare(object o1, object o2)
static string ToString(NamespaceList list)
static XmlQualifiedName NameOf(XmlSchemaObjectCollection items)
static XmlQualifiedName NameOf(XmlSchemaObject o)