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

◆ InternalLoad()

void System.Xml.Serialization.SourceInfo.InternalLoad ( Type elementType,
bool asAddress = false )
inlineprivate

Definition at line 55 of file SourceInfo.cs.

56 {
57 Match match = s_regex.Match(Arg);
58 if (match.Success)
59 {
60 object variable = ILG.GetVariable(match.Groups["a"].Value);
62 object variable2 = ILG.GetVariable(match.Groups["ia"].Value);
63 if (variableType.IsArray)
64 {
68 if (CodeGenerator.IsNullableGenericType(elementType2))
69 {
72 return;
73 }
74 if (elementType2.IsValueType)
75 {
77 if (!asAddress)
78 {
80 }
81 }
82 else
83 {
85 }
86 if (elementType != null)
87 {
89 }
90 return;
91 }
94 MethodInfo methodInfo = variableType.GetMethod("get_Item", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, new Type[1] { typeof(int) });
95 if (methodInfo == null && typeof(IList).IsAssignableFrom(variableType))
96 {
98 }
100 Type returnType = methodInfo.ReturnType;
101 if (CodeGenerator.IsNullableGenericType(returnType))
102 {
107 }
108 else
109 {
110 if (elementType != null && !returnType.IsAssignableFrom(elementType) && !elementType.IsAssignableFrom(returnType))
111 {
112 throw new CodeGeneratorConversionException(returnType, elementType, asAddress, "IsNotAssignableFrom");
113 }
115 }
116 return;
117 }
118 if (Source == "null")
119 {
120 ILG.Load(null);
121 return;
122 }
123 Type type;
124 if (Arg.StartsWith("o.@", StringComparison.Ordinal) || MemberInfo != null)
125 {
126 object variable3 = ILG.GetVariable(Arg.StartsWith("o.@", StringComparison.Ordinal) ? "o" : Arg);
128 if (type.IsValueType)
129 {
131 }
132 else
133 {
135 }
136 }
137 else
138 {
139 object variable3 = ILG.GetVariable(Arg);
141 if (CodeGenerator.IsNullableGenericType(type) && type.GetGenericArguments()[0] == elementType)
142 {
145 }
146 else if (asAddress)
147 {
149 }
150 else
151 {
153 }
154 }
155 if (MemberInfo != null)
156 {
157 Type type2 = ((MemberInfo is FieldInfo) ? ((FieldInfo)MemberInfo).FieldType : ((PropertyInfo)MemberInfo).PropertyType);
158 if (CodeGenerator.IsNullableGenericType(type2))
159 {
162 }
163 else
164 {
167 }
168 return;
169 }
170 match = s_regex2.Match(Source);
171 if (match.Success)
172 {
173 if (asAddress)
174 {
176 }
177 else
178 {
180 }
181 type = Type;
182 }
184 }
Type? GetElementType()
void Ldelem(Type arrayElementType)
void ConvertAddress(Type source, Type target)
void ConvertValue(Type source, Type target)
Type LoadMemberAddress(MemberInfo memberInfo)
void Ldelema(Type arrayElementType)
Type LoadMember(object obj, MemberInfo memberInfo)
void Call(MethodInfo methodInfo)
void Stloc(Type type, string name)
void Ldloca(LocalBuilder localBuilder)
void ConvertNullableValue([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods|DynamicallyAccessedMemberTypes.NonPublicMethods)] Type nullableType, Type targetType)
static readonly Regex s_regex2
Definition SourceInfo.cs:13
void Convert(Type sourceType, Type targetType, bool asAddress)
static readonly Regex s_regex
Definition SourceInfo.cs:11
static readonly Lazy< MethodInfo > s_iListGetItemMethod
Definition SourceInfo.cs:15
readonly CodeGenerator ILG
Definition SourceInfo.cs:26

References System.Xml.Serialization.SourceInfo.Arg, System.Xml.Serialization.CodeGenerator.Call(), System.Xml.Serialization.SourceInfo.Convert(), System.Xml.Serialization.CodeGenerator.ConvertAddress(), System.Xml.Serialization.SourceInfo.ConvertNullableValue(), System.Xml.Serialization.CodeGenerator.ConvertValue(), System.Xml.Dictionary, System.elementType, System.Type.GetElementType(), System.Xml.Serialization.CodeGenerator.GetTempLocal(), System.Xml.Serialization.CodeGenerator.GetVariable(), System.Xml.Serialization.CodeGenerator.GetVariableType(), System.Xml.Serialization.SourceInfo.ILG, System.Xml.Serialization.CodeGenerator.IsNullableGenericType(), System.Xml.Serialization.CodeGenerator.Ldelem(), System.Xml.Serialization.CodeGenerator.Ldelema(), System.Xml.Serialization.CodeGenerator.Ldloca(), System.Xml.Serialization.CodeGenerator.Ldobj(), System.Xml.Serialization.CodeGenerator.Load(), System.Xml.Serialization.CodeGenerator.LoadAddress(), System.Xml.Serialization.CodeGenerator.LoadMember(), System.Xml.Serialization.CodeGenerator.LoadMemberAddress(), System.match, System.Xml.Serialization.SourceInfo.MemberInfo, System.Xml.Serialization.SourceInfo.s_iListGetItemMethod, System.Xml.Serialization.SourceInfo.s_regex, System.Xml.Serialization.SourceInfo.s_regex2, System.Xml.Serialization.SourceInfo.Source, System.Xml.Serialization.CodeGenerator.Stloc(), System.type, and System.Xml.Serialization.SourceInfo.Type.

Referenced by System.Xml.Serialization.SourceInfo.Load(), and System.Xml.Serialization.SourceInfo.LoadAddress().