Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
XmlNumeric10Converter.cs
Go to the documentation of this file.
1namespace System.Xml.Schema;
2
4{
6 : base(schemaType)
7 {
8 }
9
10 public static XmlValueConverter Create(XmlSchemaType schemaType)
11 {
12 return new XmlNumeric10Converter(schemaType);
13 }
14
15 public override decimal ToDecimal(string value)
16 {
17 if (value == null)
18 {
19 throw new ArgumentNullException("value");
20 }
21 if (base.TypeCode == XmlTypeCode.Decimal)
22 {
24 }
26 }
27
28 public override decimal ToDecimal(object value)
29 {
30 if (value == null)
31 {
32 throw new ArgumentNullException("value");
33 }
36 {
37 return (decimal)value;
38 }
40 {
41 return (int)value;
42 }
44 {
45 return (long)value;
46 }
48 {
49 return ToDecimal((string)value);
50 }
52 {
53 return (decimal)((XmlAtomicValue)value).ValueAs(XmlBaseConverter.DecimalType);
54 }
56 }
57
58 public override int ToInt32(long value)
59 {
61 }
62
63 public override int ToInt32(string value)
64 {
65 if (value == null)
66 {
67 throw new ArgumentNullException("value");
68 }
69 if (base.TypeCode == XmlTypeCode.Decimal)
70 {
72 }
73 return XmlConvert.ToInt32(value);
74 }
75
76 public override int ToInt32(object value)
77 {
78 if (value == null)
79 {
80 throw new ArgumentNullException("value");
81 }
84 {
85 return XmlBaseConverter.DecimalToInt32((decimal)value);
86 }
88 {
89 return (int)value;
90 }
92 {
94 }
96 {
97 return ToInt32((string)value);
98 }
100 {
101 return ((XmlAtomicValue)value).ValueAsInt;
102 }
104 }
105
106 public override long ToInt64(int value)
107 {
108 return value;
109 }
110
111 public override long ToInt64(string value)
112 {
113 if (value == null)
114 {
115 throw new ArgumentNullException("value");
116 }
117 if (base.TypeCode == XmlTypeCode.Decimal)
118 {
120 }
121 return XmlConvert.ToInt64(value);
122 }
123
124 public override long ToInt64(object value)
125 {
126 if (value == null)
127 {
128 throw new ArgumentNullException("value");
129 }
132 {
133 return XmlBaseConverter.DecimalToInt64((decimal)value);
134 }
136 {
137 return (int)value;
138 }
140 {
141 return (long)value;
142 }
144 {
145 return ToInt64((string)value);
146 }
148 {
149 return ((XmlAtomicValue)value).ValueAsLong;
150 }
152 }
153
154 public override string ToString(decimal value)
155 {
156 if (base.TypeCode == XmlTypeCode.Decimal)
157 {
158 return XmlConvert.ToString(value);
159 }
160 return XmlConvert.ToString(decimal.Truncate(value));
161 }
162
163 public override string ToString(int value)
164 {
165 return XmlConvert.ToString(value);
166 }
167
168 public override string ToString(long value)
169 {
170 return XmlConvert.ToString(value);
171 }
172
173 public override string ToString(object value, IXmlNamespaceResolver nsResolver)
174 {
175 if (value == null)
176 {
177 throw new ArgumentNullException("value");
178 }
181 {
182 return ToString((decimal)value);
183 }
185 {
186 return XmlConvert.ToString((int)value);
187 }
189 {
190 return XmlConvert.ToString((long)value);
191 }
193 {
194 return (string)value;
195 }
197 {
198 return ((XmlAtomicValue)value).Value;
199 }
201 }
202
203 public override object ChangeType(decimal value, Type destinationType)
204 {
205 if (destinationType == null)
206 {
207 throw new ArgumentNullException("destinationType");
208 }
210 {
211 destinationType = base.DefaultClrType;
212 }
214 {
215 return value;
216 }
218 {
220 }
222 {
224 }
226 {
227 return ToString(value);
228 }
230 {
231 return new XmlAtomicValue(base.SchemaType, value);
232 }
234 {
235 return new XmlAtomicValue(base.SchemaType, value);
236 }
238 }
239
240 public override object ChangeType(int value, Type destinationType)
241 {
242 if (destinationType == null)
243 {
244 throw new ArgumentNullException("destinationType");
245 }
247 {
248 destinationType = base.DefaultClrType;
249 }
251 {
252 return (decimal)value;
253 }
255 {
256 return value;
257 }
259 {
260 return (long)value;
261 }
263 {
264 return XmlConvert.ToString(value);
265 }
267 {
268 return new XmlAtomicValue(base.SchemaType, value);
269 }
271 {
272 return new XmlAtomicValue(base.SchemaType, value);
273 }
275 }
276
277 public override object ChangeType(long value, Type destinationType)
278 {
279 if (destinationType == null)
280 {
281 throw new ArgumentNullException("destinationType");
282 }
284 {
285 destinationType = base.DefaultClrType;
286 }
288 {
289 return (decimal)value;
290 }
292 {
294 }
296 {
297 return value;
298 }
300 {
301 return XmlConvert.ToString(value);
302 }
304 {
305 return new XmlAtomicValue(base.SchemaType, value);
306 }
308 {
309 return new XmlAtomicValue(base.SchemaType, value);
310 }
312 }
313
315 {
316 if (value == null)
317 {
318 throw new ArgumentNullException("value");
319 }
320 if (destinationType == null)
321 {
322 throw new ArgumentNullException("destinationType");
323 }
325 {
326 destinationType = base.DefaultClrType;
327 }
329 {
330 return ToDecimal(value);
331 }
333 {
334 return ToInt32(value);
335 }
337 {
338 return ToInt64(value);
339 }
341 {
342 return value;
343 }
345 {
346 return new XmlAtomicValue(base.SchemaType, value);
347 }
349 {
350 return new XmlAtomicValue(base.SchemaType, value);
351 }
353 }
354
356 {
357 if (value == null)
358 {
359 throw new ArgumentNullException("value");
360 }
361 if (destinationType == null)
362 {
363 throw new ArgumentNullException("destinationType");
364 }
367 {
368 destinationType = base.DefaultClrType;
369 }
371 {
372 return ToDecimal(value);
373 }
375 {
376 return ToInt32(value);
377 }
379 {
380 return ToInt64(value);
381 }
383 {
384 return ToString(value, nsResolver);
385 }
387 {
389 {
390 return new XmlAtomicValue(base.SchemaType, value);
391 }
393 {
394 return new XmlAtomicValue(base.SchemaType, (int)value);
395 }
397 {
398 return new XmlAtomicValue(base.SchemaType, (long)value);
399 }
401 {
402 return new XmlAtomicValue(base.SchemaType, (string)value);
403 }
405 {
406 return (XmlAtomicValue)value;
407 }
408 }
410 {
412 {
413 return new XmlAtomicValue(base.SchemaType, value);
414 }
416 {
417 return new XmlAtomicValue(base.SchemaType, (int)value);
418 }
420 {
421 return new XmlAtomicValue(base.SchemaType, (long)value);
422 }
424 {
425 return new XmlAtomicValue(base.SchemaType, (string)value);
426 }
428 {
429 return (XmlAtomicValue)value;
430 }
431 }
433 {
435 }
437 {
439 }
441 {
443 }
445 {
447 }
449 {
451 }
453 {
455 }
457 {
458 return ChangeType((byte)value, destinationType);
459 }
461 {
462 return ChangeType((short)value, destinationType);
463 }
465 {
466 return ChangeType((sbyte)value, destinationType);
467 }
469 {
470 return ChangeType((ushort)value, destinationType);
471 }
473 {
474 return ChangeType((uint)value, destinationType);
475 }
477 {
478 return ChangeType((decimal)(ulong)value, destinationType);
479 }
481 }
482
484 {
487 {
488 return ChangeType((byte)value, destinationType);
489 }
491 {
492 return ChangeType((short)value, destinationType);
493 }
495 {
496 return ChangeType((sbyte)value, destinationType);
497 }
499 {
500 return ChangeType((ushort)value, destinationType);
501 }
503 {
504 return ChangeType((uint)value, destinationType);
505 }
507 {
508 return ChangeType((decimal)(ulong)value, destinationType);
509 }
511 }
512
541}
static ? Type GetType(string typeName, bool throwOnError, bool ignoreCase)
Definition Type.cs:408
static ushort Int32ToUInt16(int value)
static short Int32ToInt16(int value)
static readonly Type XmlAtomicValueType
static sbyte Int32ToSByte(int value)
static uint Int64ToUInt32(long value)
virtual object ChangeListType(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
static int DecimalToInt32(decimal value)
static ulong DecimalToUInt64(decimal value)
static long DecimalToInt64(decimal value)
override object ChangeType(decimal value, Type destinationType)
override object ChangeType(long value, Type destinationType)
override object ChangeType(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
static XmlValueConverter Create(XmlSchemaType schemaType)
override decimal ToDecimal(string value)
XmlNumeric10Converter(XmlSchemaType schemaType)
override decimal ToDecimal(object value)
object ChangeTypeWildcardSource(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
override object ChangeType(int value, Type destinationType)
override object ChangeType(string value, Type destinationType, IXmlNamespaceResolver nsResolver)
override string ToString(object value, IXmlNamespaceResolver nsResolver)
object ChangeTypeWildcardDestination(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
static int ToInt32(string s)
static string ToString(bool value)
static decimal ToDecimal(string s)
static decimal ToInteger(string s)
static long ToInt64(string s)