pardeike / Harmony

A library for patching, replacing and decorating .NET and Mono methods during runtime
https://www.patreon.com/pardeike
MIT License
5.28k stars 492 forks source link

Is it possible to insert a delegate into IL code? #554

Closed w-while closed 10 months ago

w-while commented 1 year ago

Like (https://github.com/tModLoader/tModLoader/wiki/Expert-IL-Editing#approach-1---modifying-evaluation-stack) In MonoMod mechod EmitDelegate can insert a delegate into IL code.It's very convenient. How can I do Something like that with harmony.(Maybe introducing MonoMod?But how to use it in transpiler)

pardeike commented 1 year ago

That's not part of Harmony's way of doing things. Harmony requires static methods because they will be reused whenever some other mod.