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

◆ ResolveTypeHandle() [2/2]

unsafe RuntimeTypeHandle System.ModuleHandle.ResolveTypeHandle ( int typeToken,
RuntimeTypeHandle?[] typeInstantiationContext,
RuntimeTypeHandle?[] methodInstantiationContext )
inline

Definition at line 94 of file ModuleHandle.cs.

95 {
98 IntPtr[] array = null;
99 int length = 0;
100 IntPtr[] array2 = null;
101 int length2 = 0;
102 if (typeInstantiationContext != null && typeInstantiationContext.Length != 0)
103 {
104 typeInstantiationContext = (RuntimeTypeHandle[])typeInstantiationContext.Clone();
105 array = RuntimeTypeHandle.CopyRuntimeTypeHandles(typeInstantiationContext, out length);
106 }
107 if (methodInstantiationContext != null && methodInstantiationContext.Length != 0)
108 {
109 methodInstantiationContext = (RuntimeTypeHandle[])methodInstantiationContext.Clone();
110 array2 = RuntimeTypeHandle.CopyRuntimeTypeHandles(methodInstantiationContext, out length2);
111 }
112 fixed (IntPtr* typeInstArgs = array)
113 {
114 fixed (IntPtr* methodInstArgs = array2)
115 {
116 try
117 {
118 RuntimeType o = null;
119 ResolveType(new QCallModule(ref module), typeToken, typeInstArgs, length, methodInstArgs, length2, ObjectHandleOnStack.Create(ref o));
120 GC.KeepAlive(typeInstantiationContext);
121 GC.KeepAlive(methodInstantiationContext);
122 return new RuntimeTypeHandle(o);
123 }
124 catch (Exception)
125 {
126 if (!GetMetadataImport(module).IsValidToken(typeToken))
127 {
128 throw new ArgumentOutOfRangeException("typeToken", SR.Format(SR.Argument_InvalidToken, typeToken, new ModuleHandle(module)));
129 }
130 throw;
131 }
132 }
133 }
134 }
static void ValidateModulePointer(RuntimeModule module)
RuntimeModule GetRuntimeModule()
ModuleHandle(RuntimeModule module)
static unsafe void ResolveType(QCallModule module, int typeToken, IntPtr *typeInstArgs, int typeInstCount, IntPtr *methodInstArgs, int methodInstCount, ObjectHandleOnStack type)
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.ResolveType(), and System.ModuleHandle.ValidateModulePointer().