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

◆ AddXdoProperty()

void System.Data.XmlTreeGen.AddXdoProperty ( PropertyDescriptor pd,
object instance,
XmlElement root,
XmlDocument xd )
inlinepackage

Definition at line 100 of file XmlTreeGen.cs.

101 {
102 Type propertyType = pd.PropertyType;
103 bool flag = false;
104 DataColumn dataColumn = null;
105 bool flag2 = false;
106 bool flag3 = false;
107 if (instance is DataColumn)
108 {
109 dataColumn = (DataColumn)instance;
110 flag = true;
111 flag2 = dataColumn.IsSqlType;
112 flag3 = dataColumn.ImplementsINullable;
113 }
114 if ((!flag3 && propertyType != typeof(string) && propertyType != typeof(bool) && propertyType != typeof(Type) && propertyType != typeof(object) && propertyType != typeof(CultureInfo) && propertyType != typeof(long) && propertyType != typeof(int)) || ((!pd.ShouldSerializeValue(instance) || !ContainsDesignerSerializationVisibleAttribute(pd)) && !flag2))
115 {
116 return;
117 }
118 object value = pd.GetValue(instance);
119 if (value is InternalDataCollectionBase || value is PropertyCollection || string.Equals(pd.Name, "Namespace", StringComparison.Ordinal) || string.Equals(pd.Name, "PrimaryKey", StringComparison.Ordinal) || string.Equals(pd.Name, "ColumnName", StringComparison.Ordinal) || string.Equals(pd.Name, "DefaultValue", StringComparison.Ordinal) || string.Equals(pd.Name, "TableName", StringComparison.Ordinal) || string.Equals(pd.Name, "DataSetName", StringComparison.Ordinal) || string.Equals(pd.Name, "AllowDBNull", StringComparison.Ordinal) || string.Equals(pd.Name, "Unique", StringComparison.Ordinal) || string.Equals(pd.Name, "NestedInDataSet", StringComparison.Ordinal) || string.Equals(pd.Name, "Locale", StringComparison.Ordinal) || string.Equals(pd.Name, "CaseSensitive", StringComparison.Ordinal) || string.Equals(pd.Name, "RemotingFormat", StringComparison.Ordinal))
120 {
121 return;
122 }
123 if (flag)
124 {
125 if (string.Equals(pd.Name, "DataType", StringComparison.Ordinal))
126 {
127 string text = XmlDataTypeName(dataColumn.DataType);
128 if (flag2 || dataColumn.DataType == typeof(BigInteger))
129 {
130 root.SetAttribute("DataType", "urn:schemas-microsoft-com:xml-msdata", dataColumn.DataType.FullName);
131 }
132 else if (text.Length == 0 || flag3 || (text == "anyType" && dataColumn.XmlDataType != "anyType") || dataColumn.DataType == typeof(DateTimeOffset))
133 {
134 SetMSDataAttribute(root, dataColumn.DataType);
135 }
136 return;
137 }
138 if (string.Equals(pd.Name, "Attribute", StringComparison.Ordinal))
139 {
140 return;
141 }
142 }
143 string value2 = pd.Converter.ConvertToString(value);
144 root.SetAttribute(pd.Name, "urn:schemas-microsoft-com:xml-msdata", value2);
145 }
static string XmlDataTypeName(Type type)
void SetMSDataAttribute(XmlElement root, Type type)
bool ContainsDesignerSerializationVisibleAttribute(PropertyDescriptor pd)
virtual void SetAttribute(string name, string? value)

References System.Data.XmlTreeGen.ContainsDesignerSerializationVisibleAttribute(), System.Xml.Dictionary, System.Xml.XmlElement.SetAttribute(), System.Data.XmlTreeGen.SetMSDataAttribute(), System.text, System.value, and System.Data.XmlTreeGen.XmlDataTypeName().

Referenced by System.Data.XmlTreeGen.AddXdoProperties().