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

◆ GetDefaultValue()

object System.Xml.Serialization.XmlReflectionImporter.GetDefaultValue ( TypeDesc fieldTypeDesc,
Type t,
XmlAttributes a )
inlineprivate

Definition at line 2155 of file XmlReflectionImporter.cs.

2156 {
2157 if (a.XmlDefaultValue == null || a.XmlDefaultValue == DBNull.Value)
2158 {
2159 return null;
2160 }
2161 if (fieldTypeDesc.Kind != TypeKind.Primitive && fieldTypeDesc.Kind != TypeKind.Enum)
2162 {
2163 a.XmlDefaultValue = null;
2164 return a.XmlDefaultValue;
2165 }
2166 if (fieldTypeDesc.Kind == TypeKind.Enum)
2167 {
2168 string text = Enum.Format(t, a.XmlDefaultValue, "G").Replace(",", " ");
2169 string text2 = Enum.Format(t, a.XmlDefaultValue, "D");
2170 if (text == text2)
2171 {
2172 throw new InvalidOperationException(System.SR.Format(System.SR.XmlInvalidDefaultValue, text, a.XmlDefaultValue.GetType().FullName));
2173 }
2174 return text;
2175 }
2176 return a.XmlDefaultValue;
2177 }
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string XmlInvalidDefaultValue
Definition SR.cs:1520
Definition SR.cs:7

References System.Xml.Dictionary, System.SR.Format(), System.Enum.Format(), System.text, System.DBNull.Value, and System.SR.XmlInvalidDefaultValue.

Referenced by System.Xml.Serialization.XmlReflectionImporter.ImportAccessorMapping().