This repository was archived by the owner on May 9, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,14 @@ public class HookInstance
17
17
private static readonly StringBuilder evalOutput = new StringBuilder ( ) ;
18
18
private static readonly ScriptEvaluator scriptEvaluator = new ScriptEvaluator ( new StringWriter ( evalOutput ) ) ;
19
19
20
+ static HookInstance ( )
21
+ {
22
+ scriptEvaluator . Run ( "using System;" ) ;
23
+ scriptEvaluator . Run ( "using System.Reflection;" ) ;
24
+ scriptEvaluator . Run ( "using System.Collections;" ) ;
25
+ scriptEvaluator . Run ( "using System.Collections.Generic;" ) ;
26
+ }
27
+
20
28
// Instance
21
29
22
30
public bool Enabled ;
@@ -117,13 +125,12 @@ private string GenerateDefaultPatchSourceCode(MethodInfo targetMethod)
117
125
if ( targetMethod . ReturnType != typeof ( void ) )
118
126
codeBuilder . Append ( $ ", { targetMethod . ReturnType . FullName } __result") ;
119
127
120
- int paramIdx = 0 ;
121
128
var parameters = targetMethod . GetParameters ( ) ;
129
+
130
+ int paramIdx = 0 ;
122
131
foreach ( var param in parameters )
123
132
{
124
- Type pType = param . ParameterType ;
125
- if ( pType . IsByRef ) pType = pType . GetElementType ( ) ;
126
- codeBuilder . Append ( $ ", { pType . FullName } __{ paramIdx } ") ;
133
+ codeBuilder . Append ( $ ", { param . ParameterType . FullDescription ( ) . Replace ( "&" , "" ) } __{ paramIdx } ") ;
127
134
paramIdx ++ ;
128
135
}
129
136
@@ -177,6 +184,8 @@ private string GenerateDefaultPatchSourceCode(MethodInfo targetMethod)
177
184
178
185
codeBuilder . AppendLine ( "}" ) ;
179
186
187
+ //ExplorerCore.Log(codeBuilder.ToString());
188
+
180
189
return PatchSourceCode = codeBuilder . ToString ( ) ;
181
190
}
182
191
You can’t perform that action at this time.
0 commit comments