Skip to content

Instantly share code, notes, and snippets.

@pardeike
Last active January 27, 2020 15:47
Show Gist options
  • Save pardeike/45ad0712720f30627d6f5b4e10f3356f to your computer and use it in GitHub Desktop.
Save pardeike/45ad0712720f30627d6f5b4e10f3356f to your computer and use it in GitHub Desktop.
using System;
using HarmonyLib;
namespace NoInlining
{
public class MainClass
{
public static void Main(string[] args)
{
var harmony = new Harmony("test");
harmony.PatchAll();
new Test().Method1();
}
}
[HarmonyPatch(typeof(Test), "Method2")]
public static class Patch
{
static bool Prefix()
{
Console.WriteLine("patch");
return false;
}
}
public class Test
{
public void Method1()
{
Console.WriteLine("before");
Method2();
Console.WriteLine("after");
}
public void Method2()
{
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment