-
Notifications
You must be signed in to change notification settings - Fork 0
/
HarmonyPatches.cs
41 lines (36 loc) · 1020 Bytes
/
HarmonyPatches.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using HarmonyLib;
using System;
using System.Reflection;
namespace Clock
{
/// <summary>
/// This class handles applying harmony patches to the game.
/// You should not need to modify this class.
/// </summary>
public class HarmonyPatches
{
private static Harmony instance;
public static bool IsPatched { get; private set; }
public const string InstanceId = PluginInfo.GUID;
internal static void ApplyHarmonyPatches()
{
if (!IsPatched)
{
if (instance == null)
{
instance = new Harmony(InstanceId);
}
instance.PatchAll(Assembly.GetExecutingAssembly());
IsPatched = true;
}
}
internal static void RemoveHarmonyPatches()
{
if (instance != null && IsPatched)
{
instance.UnpatchSelf();
IsPatched = false;
}
}
}
}