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

◆ ResolveFieldHandle() [2/2]

unsafe RuntimeFieldHandle System.ModuleHandle.ResolveFieldHandle ( int fieldToken,
RuntimeTypeHandle?[] typeInstantiationContext,
RuntimeTypeHandle?[] methodInstantiationContext )
inline

Definition at line 207 of file ModuleHandle.cs.

208 {
210 ValidateModulePointer(module);
211 IntPtr[] array = null;
212 int length = 0;
213 IntPtr[] array2 = null;
214 int length2 = 0;
215 if (typeInstantiationContext != null && typeInstantiationContext.Length != 0)
216 {
217 typeInstantiationContext = (RuntimeTypeHandle[])typeInstantiationContext.Clone();
218 array = RuntimeTypeHandle.CopyRuntimeTypeHandles(typeInstantiationContext, out length);
219 }
220 if (methodInstantiationContext != null && methodInstantiationContext.Length != 0)
221 {
222 methodInstantiationContext = (RuntimeTypeHandle[])methodInstantiationContext.Clone();
223 array2 = RuntimeTypeHandle.CopyRuntimeTypeHandles(methodInstantiationContext, out length2);
224 }
225 fixed (IntPtr* typeInstArgs = array)
226 {
227 fixed (IntPtr* methodInstArgs = array2)
228 {
229 try
230 {
231 IRuntimeFieldInfo o = null;
232 ResolveField(new QCallModule(ref module), fieldToken, typeInstArgs, length, methodInstArgs, length2, ObjectHandleOnStack.Create(ref o));
233 GC.KeepAlive(typeInstantiationContext);
234 GC.KeepAlive(methodInstantiationContext);
235 return new RuntimeFieldHandle(o);
236 }
237 catch (Exception)
238 {
239 if (!GetMetadataImport(module).IsValidToken(fieldToken))
240 {
241 throw new ArgumentOutOfRangeException("fieldToken", SR.Format(SR.Argument_InvalidToken, fieldToken, new ModuleHandle(module)));
242 }
243 throw;
244 }
245 }
246 }
247 }
static void ValidateModulePointer(RuntimeModule module)
RuntimeModule GetRuntimeModule()
ModuleHandle(RuntimeModule module)
static unsafe void ResolveField(QCallModule module, int fieldToken, IntPtr *typeInstArgs, int typeInstCount, IntPtr *methodInstArgs, int methodInstCount, ObjectHandleOnStack retField)
static MetadataImport GetMetadataImport(RuntimeModule module)

References System.SR.Argument_InvalidToken, System.array, System.RuntimeTypeHandle.CopyRuntimeTypeHandles(), System.SR.Format(), System.ModuleHandle.GetMetadataImport(), System.ModuleHandle.GetRuntimeModule(), System.GC.KeepAlive(), System.length, System.length2, System.ModuleHandle.ResolveField(), and System.ModuleHandle.ValidateModulePointer().