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

◆ GetDefaultValue()

object System.Xml.Serialization.SoapReflectionImporter.GetDefaultValue ( TypeDesc fieldTypeDesc,
SoapAttributes a )
inlineprivate

Definition at line 769 of file SoapReflectionImporter.cs.

770 {
771 if (a.SoapDefaultValue == null || a.SoapDefaultValue == DBNull.Value)
772 {
773 return null;
774 }
775 if (fieldTypeDesc.Kind != TypeKind.Primitive && fieldTypeDesc.Kind != TypeKind.Enum)
776 {
777 a.SoapDefaultValue = null;
778 return a.SoapDefaultValue;
779 }
780 if (fieldTypeDesc.Kind == TypeKind.Enum)
781 {
782 if (fieldTypeDesc != _typeScope.GetTypeDesc(a.SoapDefaultValue.GetType()))
783 {
784 throw new InvalidOperationException(System.SR.Format(System.SR.XmlInvalidDefaultEnumValue, a.SoapDefaultValue.GetType().FullName, fieldTypeDesc.FullName));
785 }
786 string text = Enum.Format(a.SoapDefaultValue.GetType(), a.SoapDefaultValue, "G").Replace(",", " ");
787 string text2 = Enum.Format(a.SoapDefaultValue.GetType(), a.SoapDefaultValue, "D");
788 if (text == text2)
789 {
790 throw new InvalidOperationException(System.SR.Format(System.SR.XmlInvalidDefaultValue, text, a.SoapDefaultValue.GetType().FullName));
791 }
792 return text;
793 }
794 return a.SoapDefaultValue;
795 }
static string XmlInvalidDefaultEnumValue
Definition SR.cs:1522
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string XmlInvalidDefaultValue
Definition SR.cs:1520
Definition SR.cs:7
TypeDesc GetTypeDesc(string name, string ns)
Definition TypeScope.cs:224

References System.Xml.Serialization.SoapReflectionImporter._typeScope, System.Xml.Dictionary, System.SR.Format(), System.Enum.Format(), System.Xml.Serialization.TypeScope.GetTypeDesc(), System.text, System.DBNull.Value, System.SR.XmlInvalidDefaultEnumValue, and System.SR.XmlInvalidDefaultValue.

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