Update HookInstance.cs

This commit is contained in:
KurobaM 2022-12-17 15:40:36 +08:00 committed by GitHub
parent 1e1fb0e27b
commit fad5fe0620
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,6 +46,19 @@ namespace UnityExplorer.Hooks
if (CompileAndGenerateProcessor(PatchSourceCode))
Patch();
}
public HookInstance(MethodInfo targetMethod, string code)
{
this.TargetMethod = targetMethod;
this.signature = TargetMethod.FullDescription();
PatchSourceCode = code;
if (CompileAndGenerateProcessor(PatchSourceCode))
{
Patch();
}
}
// Evaluator.source_file
private static readonly FieldInfo fi_sourceFile = AccessTools.Field(typeof(Evaluator), "source_file");