Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
XmlBooleanConverter.cs
Go to the documentation of this file.
1namespace System.Xml.Schema;
2
3internal sealed class XmlBooleanConverter : XmlBaseConverter
4{
6 : base(schemaType)
7 {
8 }
9
10 public static XmlValueConverter Create(XmlSchemaType schemaType)
11 {
12 return new XmlBooleanConverter(schemaType);
13 }
14
15 public override bool ToBoolean(string value)
16 {
17 if (value == null)
18 {
19 throw new ArgumentNullException("value");
20 }
22 }
23
24 public override bool ToBoolean(object value)
25 {
26 if (value == null)
27 {
28 throw new ArgumentNullException("value");
29 }
32 {
33 return (bool)value;
34 }
36 {
37 return XmlConvert.ToBoolean((string)value);
38 }
40 {
41 return ((XmlAtomicValue)value).ValueAsBoolean;
42 }
44 }
45
46 public override string ToString(bool value)
47 {
49 }
50
51 public override string ToString(object value, IXmlNamespaceResolver nsResolver)
52 {
53 if (value == null)
54 {
55 throw new ArgumentNullException("value");
56 }
59 {
60 return XmlConvert.ToString((bool)value);
61 }
63 {
64 return (string)value;
65 }
67 {
68 return ((XmlAtomicValue)value).Value;
69 }
71 }
72
73 public override object ChangeType(bool value, Type destinationType)
74 {
75 if (destinationType == null)
76 {
77 throw new ArgumentNullException("destinationType");
78 }
80 {
81 destinationType = base.DefaultClrType;
82 }
84 {
85 return value;
86 }
88 {
90 }
92 {
93 return new XmlAtomicValue(base.SchemaType, value);
94 }
96 {
97 return new XmlAtomicValue(base.SchemaType, value);
98 }
100 }
101
103 {
104 if (value == null)
105 {
106 throw new ArgumentNullException("value");
107 }
108 if (destinationType == null)
109 {
110 throw new ArgumentNullException("destinationType");
111 }
113 {
114 destinationType = base.DefaultClrType;
115 }
117 {
118 return XmlConvert.ToBoolean(value);
119 }
121 {
122 return value;
123 }
125 {
126 return new XmlAtomicValue(base.SchemaType, value);
127 }
129 {
130 return new XmlAtomicValue(base.SchemaType, value);
131 }
133 }
134
136 {
137 if (value == null)
138 {
139 throw new ArgumentNullException("value");
140 }
141 if (destinationType == null)
142 {
143 throw new ArgumentNullException("destinationType");
144 }
147 {
148 destinationType = base.DefaultClrType;
149 }
151 {
152 return ToBoolean(value);
153 }
155 {
156 return ToString(value, nsResolver);
157 }
159 {
161 {
162 return new XmlAtomicValue(base.SchemaType, (bool)value);
163 }
165 {
166 return new XmlAtomicValue(base.SchemaType, (string)value);
167 }
169 {
170 return (XmlAtomicValue)value;
171 }
172 }
174 {
176 {
177 return new XmlAtomicValue(base.SchemaType, (bool)value);
178 }
180 {
181 return new XmlAtomicValue(base.SchemaType, (string)value);
182 }
184 {
185 return (XmlAtomicValue)value;
186 }
187 }
189 }
190}
static ? Type GetType(string typeName, bool throwOnError, bool ignoreCase)
Definition Type.cs:408
static readonly Type XmlAtomicValueType
virtual object ChangeListType(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
override object ChangeType(bool value, Type destinationType)
override string ToString(object value, IXmlNamespaceResolver nsResolver)
XmlBooleanConverter(XmlSchemaType schemaType)
override object ChangeType(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
override bool ToBoolean(string value)
override bool ToBoolean(object value)
override object ChangeType(string value, Type destinationType, IXmlNamespaceResolver nsResolver)
static XmlValueConverter Create(XmlSchemaType schemaType)
static bool ToBoolean(string s)
static string ToString(bool value)