Concord lets a .NET mod patch methods while the app runs. You write the patch in C#, and Concord leaves the target assembly on disk alone.
CampfireWarmthPatch.cs
C#
[Patch]
abstract class CampfireWarmthPatch : Campfire
{
[Inject(At.Return, nameof(GetWarmth))]
void AfterGetWarmth(ControlHandle<int> ch)
{
ch.ReturnValue += 5;
}
}
What a patch does
The example patch adds 5 to Campfire.GetWarmth(). Concord does not rewrite the method in the target assembly.
In the target assembly
GetWarmth() returns twice the amount of fuel.
Campfire.cs
C#
public int GetWarmth()
{
return fuel * 2;
}
At runtime
Concord sends each call through a wrapper that adds 5.
GetWarmth at runtime
C#
public int GetWarmth()
{
int result = fuel * 2;
result += 5;
return result;
}
Reading order
If this is your first Concord patch, read Start Here, Getting started, and Your first patch in order. Use the rest as references.
Make a patch
Getting started AddConcord.Ref. Pick the optional build tools you want.
Your first patch
Write and apply patches to the example Campfire class.
Common tasks
Find an example for each supported patch position.