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

◆ ResolveType()

static Type System.TypeNameParser.ResolveType ( Assembly assembly,
string[] names,
Func< Assembly, string, bool, Type > typeResolver,
bool throwOnError,
bool ignoreCase,
ref StackCrawlMark stackMark )
inlinestaticprivate

Definition at line 149 of file TypeNameParser.cs.

150 {
151 string text = EscapeTypeName(names[0]);
152 Type type;
153 if (typeResolver == null)
154 {
155 type = ((!(assembly == null)) ? assembly.GetType(text, throwOnError, ignoreCase) : RuntimeType.GetType(text, throwOnError, ignoreCase, ref stackMark));
156 }
157 else
158 {
159 type = typeResolver(assembly, text, ignoreCase);
160 if (type == null && throwOnError)
161 {
162 string message = ((assembly == null) ? SR.Format(SR.TypeLoad_ResolveType, text) : SR.Format(SR.TypeLoad_ResolveTypeFromAssembly, text, assembly.FullName));
163 throw new TypeLoadException(message);
164 }
165 }
166 if (type != null)
167 {
168 BindingFlags bindingFlags = BindingFlags.Public | BindingFlags.NonPublic;
169 if (ignoreCase)
170 {
171 bindingFlags |= BindingFlags.IgnoreCase;
172 }
173 for (int i = 1; i < names.Length; i++)
174 {
175 type = type.GetNestedType(names[i], bindingFlags);
176 if (type == null)
177 {
178 if (!throwOnError)
179 {
180 break;
181 }
182 throw new TypeLoadException(SR.Format(SR.TypeLoad_ResolveNestedType, names[i], names[i - 1]));
183 }
184 }
185 }
186 return type;
187 }
virtual ? string FullName
Definition Assembly.cs:74
virtual ? Type GetType(string name)
Definition Assembly.cs:305
static string EscapeTypeName(string name)
static ? Type GetType(string typeName, bool throwOnError, bool ignoreCase)
Definition Type.cs:408

References System.TypeNameParser.EscapeTypeName(), System.SR.Format(), System.Reflection.Assembly.FullName, System.Reflection.Assembly.GetType(), System.RuntimeType.GetType(), System.text, System.type, System.SR.TypeLoad_ResolveNestedType, System.SR.TypeLoad_ResolveType, and System.SR.TypeLoad_ResolveTypeFromAssembly.

Referenced by System.TypeNameParser.ConstructType().