Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ SetProperties() [1/2]

static void System.Data.XSDSchema.SetProperties ( object instance,
XmlAttribute[] attrs )
inlinestaticpackage

Definition at line 217 of file XSDSchema.cs.

218 {
219 if (attrs == null)
220 {
221 return;
222 }
223 for (int i = 0; i < attrs.Length; i++)
224 {
225 if (!(attrs[i].NamespaceURI == "urn:schemas-microsoft-com:xml-msdata"))
226 {
227 continue;
228 }
229 string localName = attrs[i].LocalName;
230 string value = attrs[i].Value;
231 switch (localName)
232 {
233 case "Expression":
234 if (instance is DataColumn)
235 {
236 continue;
237 }
238 break;
239 case "DefaultValue":
240 case "Ordinal":
241 case "Locale":
242 case "RemotingFormat":
243 continue;
244 }
245 if (localName == "DataType")
246 {
247 if (instance is DataColumn dataColumn)
248 {
250 }
251 continue;
252 }
254 if (propertyDescriptor == null)
255 {
256 continue;
257 }
258 Type propertyType = propertyDescriptor.PropertyType;
259 TypeConverter converter = XMLSchema.GetConverter(propertyType);
260 object value2;
261 if (converter.CanConvertFrom(typeof(string)))
262 {
263 value2 = converter.ConvertFromInvariantString(value);
264 }
265 else if (propertyType == typeof(Type))
266 {
267 value2 = Type.GetType(value);
268 }
269 else
270 {
272 {
273 throw ExceptionBuilder.CannotConvert(value, propertyType.FullName);
274 }
275 value2 = new CultureInfo(value);
276 }
277 propertyDescriptor.SetValue(instance, value2);
278 }
279 }
static PropertyDescriptorCollection GetProperties([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentType)
static Type GetType(string value)

References System.Data.ExceptionBuilder.CannotConvert(), System.converter, System.Xml.Dictionary, System.Data.XMLSchema.GetConverter(), System.ComponentModel.TypeDescriptor.GetProperties(), System.Type.GetType(), System.Data.Common.DataStorage.GetType(), and System.value.

Referenced by System.Data.XSDSchema.HandleAttributeColumn(), System.Data.XSDSchema.HandleElementColumn(), System.Data.XSDSchema.HandleRefTableProperties(), System.Data.XSDSchema.HandleSimpleContentColumn(), and System.Data.XSDSchema.HandleSimpleTypeSimpleContentColumn().