Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
XmlILStorageMethods.cs
Go to the documentation of this file.
5
7
8internal sealed class XmlILStorageMethods
9{
10 public readonly MethodInfo AggAvg;
11
12 public readonly MethodInfo AggAvgResult;
13
14 public readonly MethodInfo AggCreate;
15
16 public readonly MethodInfo AggIsEmpty;
17
18 public readonly MethodInfo AggMax;
19
20 public readonly MethodInfo AggMaxResult;
21
22 public readonly MethodInfo AggMin;
23
24 public readonly MethodInfo AggMinResult;
25
26 public readonly MethodInfo AggSum;
27
28 public readonly MethodInfo AggSumResult;
29
30 public readonly Type SeqType;
31
32 public readonly FieldInfo SeqEmpty;
33
34 public readonly MethodInfo SeqReuse;
35
36 public readonly MethodInfo SeqReuseSgl;
37
38 public readonly MethodInfo SeqAdd;
39
40 public readonly MethodInfo SeqSortByKeys;
41
42 public readonly Type IListType;
43
44 public readonly MethodInfo IListCount;
45
46 public readonly MethodInfo IListItem;
47
48 public readonly MethodInfo ValueAs;
49
50 public readonly MethodInfo ToAtomicValue;
51
53 {
54 Type type = null;
55 if (storageType == typeof(int))
56 {
58 }
59 else if (storageType == typeof(long))
60 {
62 }
63 else if (storageType == typeof(decimal))
64 {
66 }
67 else if (storageType == typeof(double))
68 {
70 }
71 if (type != null)
72 {
73 AggAvg = type.GetMethod("Average");
74 AggAvgResult = type.GetMethod("get_AverageResult");
75 AggCreate = type.GetMethod("Create");
76 AggIsEmpty = type.GetMethod("get_IsEmpty");
77 AggMax = type.GetMethod("Maximum");
78 AggMaxResult = type.GetMethod("get_MaximumResult");
79 AggMin = type.GetMethod("Minimum");
80 AggMinResult = type.GetMethod("get_MinimumResult");
81 AggSum = type.GetMethod("Sum");
82 AggSumResult = type.GetMethod("get_SumResult");
83 }
84 Type type2;
86 {
88 SeqAdd = type2.GetMethod("AddClone");
89 }
90 else if (storageType == typeof(XPathItem))
91 {
93 SeqAdd = type2.GetMethod("AddClone");
94 }
95 else
96 {
97 type2 = typeof(XmlQuerySequence<>).MakeGenericType(storageType);
98 SeqAdd = type2.GetMethod("Add");
99 }
100 FieldInfo field = type2.GetField("Empty");
101 SeqEmpty = field;
102 SeqReuse = type2.GetMethod("CreateOrReuse", new Type[1] { type2 });
103 SeqReuseSgl = type2.GetMethod("CreateOrReuse", new Type[2] { type2, storageType });
104 SeqSortByKeys = type2.GetMethod("SortByKeys");
105 SeqType = type2;
106 Type type3 = typeof(IList<>).MakeGenericType(storageType);
107 IListItem = type3.GetMethod("get_Item");
109 IListCount = typeof(ICollection<>).MakeGenericType(storageType).GetMethod("get_Count");
110 if (storageType == typeof(string))
111 {
112 ValueAs = typeof(XPathItem).GetMethod("get_Value");
113 }
114 else if (storageType == typeof(int))
115 {
116 ValueAs = typeof(XPathItem).GetMethod("get_ValueAsInt");
117 }
118 else if (storageType == typeof(long))
119 {
120 ValueAs = typeof(XPathItem).GetMethod("get_ValueAsLong");
121 }
122 else if (storageType == typeof(DateTime))
123 {
124 ValueAs = typeof(XPathItem).GetMethod("get_ValueAsDateTime");
125 }
126 else if (storageType == typeof(double))
127 {
128 ValueAs = typeof(XPathItem).GetMethod("get_ValueAsDouble");
129 }
130 else if (storageType == typeof(bool))
131 {
132 ValueAs = typeof(XPathItem).GetMethod("get_ValueAsBoolean");
133 }
134 if (storageType == typeof(byte[]))
135 {
136 ToAtomicValue = typeof(XmlILStorageConverter).GetMethod("BytesToAtomicValue");
137 }
139 {
140 ToAtomicValue = typeof(XmlILStorageConverter).GetMethod(storageType.Name + "ToAtomicValue");
141 }
142 }
143}