Terraria v1.4.4.9
Terraria source code documentation
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros
XTypeDescriptor.cs
Go to the documentation of this file.
1using System;
5
7
8internal sealed class XTypeDescriptor<T> : CustomTypeDescriptor
9{
11 : base(parent)
12 {
13 }
14
15 [RequiresUnreferencedCode("PropertyDescriptor's PropertyType cannot be statically discovered.")]
17 {
18 return GetProperties(null);
19 }
20
21 [RequiresUnreferencedCode("PropertyDescriptor's PropertyType cannot be statically discovered. The public parameterless constructor or the 'Default' static field may be trimmed from the Attribute's Type.")]
23 {
24 PropertyDescriptorCollection propertyDescriptorCollection = new PropertyDescriptorCollection(null);
25 if (attributes == null)
26 {
27 if (typeof(T) == typeof(XElement))
28 {
29 propertyDescriptorCollection.Add(new XElementAttributePropertyDescriptor());
30 propertyDescriptorCollection.Add(new XElementDescendantsPropertyDescriptor());
31 propertyDescriptorCollection.Add(new XElementElementPropertyDescriptor());
32 propertyDescriptorCollection.Add(new XElementElementsPropertyDescriptor());
33 propertyDescriptorCollection.Add(new XElementValuePropertyDescriptor());
34 propertyDescriptorCollection.Add(new XElementXmlPropertyDescriptor());
35 }
36 else if (typeof(T) == typeof(XAttribute))
37 {
38 propertyDescriptorCollection.Add(new XAttributeValuePropertyDescriptor());
39 }
40 }
41 foreach (PropertyDescriptor property in base.GetProperties(attributes))
42 {
43 propertyDescriptorCollection.Add(property);
44 }
45 return propertyDescriptorCollection;
46 }
47}
override PropertyDescriptorCollection GetProperties()
override PropertyDescriptorCollection GetProperties(Attribute[] attributes)