Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
TypedObject.cs
Go to the documentation of this file.
2
3namespace System.Xml.Schema;
4
5internal sealed class TypedObject
6{
7 private sealed class DecimalStruct
8 {
9 private bool _isDecimal;
10
11 private readonly decimal[] _dvalue;
12
13 public bool IsDecimal
14 {
15 get
16 {
17 return _isDecimal;
18 }
19 set
20 {
22 }
23 }
24
25 public decimal[] Dvalue => _dvalue;
26
28 {
29 _dvalue = new decimal[1];
30 }
31
32 public DecimalStruct(int dim)
33 {
34 _dvalue = new decimal[dim];
35 }
36 }
37
39
40 private object _ovalue;
41
42 private readonly string _svalue;
43
45
46 private readonly int _dim = 1;
47
48 private readonly bool _isList;
49
50 public int Dim => _dim;
51
52 public bool IsList => _isList;
53
55
56 public decimal[] Dvalue => _dstruct.Dvalue;
57
58 public object Value => _ovalue;
59
61
63 {
64 _ovalue = obj;
68 {
69 _isList = true;
70 _dim = ((Array)obj).Length;
71 }
72 }
73
74 public override string ToString()
75 {
76 return _svalue;
77 }
78
79 public void SetDecimal()
80 {
81 if (_dstruct != null)
82 {
83 return;
84 }
85 XmlTypeCode typeCode = _xsdtype.TypeCode;
86 if (typeCode == XmlTypeCode.Decimal || (uint)(typeCode - 40) <= 12u)
87 {
88 if (_isList)
89 {
91 for (int i = 0; i < _dim; i++)
92 {
94 }
95 }
96 else
97 {
98 _dstruct = new DecimalStruct();
100 }
101 _dstruct.IsDecimal = true;
102 }
103 else if (_isList)
104 {
106 }
107 else
108 {
109 _dstruct = new DecimalStruct();
110 }
111 }
112
114 {
115 for (int i = 0; i < Dim; i++)
116 {
117 if (Dvalue[i] != other.Dvalue[i])
118 {
119 return false;
120 }
121 }
122 return true;
123 }
124
126 {
127 if (Dim != other.Dim)
128 {
129 return false;
130 }
131 if (Type != other.Type)
132 {
133 if (!Type.IsComparable(other.Type))
134 {
135 return false;
136 }
137 other.SetDecimal();
138 SetDecimal();
139 if (IsDecimal && other.IsDecimal)
140 {
141 return ListDValueEquals(other);
142 }
143 }
144 if (IsList)
145 {
146 if (other.IsList)
147 {
148 return Type.Compare(Value, other.Value) == 0;
149 }
152 {
153 if (array2.Length == 1)
154 {
155 return array2.GetValue(0).Equals(other.Value);
156 }
157 return false;
158 }
159 if (array.Length == 1)
160 {
161 return array.GetValue(0).Equals(other.Value);
162 }
163 return false;
164 }
165 if (other.IsList)
166 {
169 {
170 if (array4.Length == 1)
171 {
172 return array4.GetValue(0).Equals(Value);
173 }
174 return false;
175 }
176 if (array3.Length == 1)
177 {
178 return array3.GetValue(0).Equals(Value);
179 }
180 return false;
181 }
182 return Value.Equals(other.Value);
183 }
184}
object? GetValue(params int[] indices)
Definition Array.cs:980
static decimal ToDecimal(object? value)
Definition Convert.cs:2101
TypedObject(object obj, string svalue, XmlSchemaDatatype xsdtype)
XmlSchemaDatatype _xsdtype
bool ListDValueEquals(TypedObject other)
override string ToString()
bool Equals(TypedObject other)