Amity is a utility to create simple patches to exitsing assemblies. Inspired by Harmony
public class MyClass
{
public void MyMethod()
{
Console.WriteLine("Hello, World!");
}
}
This assembly is saved in C:\MyAssembly.dll
public class MyPatch {
[AmityPatch(typeof(MyClass), "MyMethod", AmityPatch.Mode.Prefix)]
public static void Patch()
{
Console.WriteLine("Hello from Amity!");
}
}
public class Program
{
public static void Main()
{
AmityInstance.Patch(typeof(MyPatch), @"C:\MyAssembly.dll", @"C:\MyNewAssembly.dll");
}
}
Running this will generate the patched assembly in C:\MyNewAssembly.dll
, the MyMethod()
method in this assembly now looks like this:
public void MyMethod()
{
Console.WriteLine("Hello from Amity!");
Console.WriteLine("Hello, World!");
}