private void Form1_Load(object sender, EventArgs e)
{
var now = DateTime.Now; // normal now
var harmony = HarmonyInstance.Create("test");
// patch
harmony.PatchAll(Assembly.GetExecutingAssembly());
// now + 100 years
this.Text = DateTime.Now.ToString("dd/MM/yyyy");
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(DateTime.Now.ToString("dd/MM/yyyy"));
}
[HarmonyPatch(typeof(DateTime), "get_Now")]
class Patch
{
// this method runs after original one
// __result stores value produced by original
static DateTime Postfix(DateTime __result)
{
// add 100 years to it
return __result.AddYears(100);
}
}