-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPlugin.cs
53 lines (44 loc) · 1.47 KB
/
Plugin.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
42
43
44
45
46
47
48
49
50
51
52
53
using BepInEx;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using CrimsonSQL.Services;
using CrimsonSQL.Structs;
using CrimsonSQL.Utility;
using HarmonyLib;
namespace CrimsonSQL;
[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
public class Plugin : BasePlugin
{
Harmony _harmony;
internal static Plugin Instance { get; private set; }
public static Harmony Harmony => Instance._harmony;
public static ManualLogSource LogInstance => Instance.Log;
public static Settings Settings;
public static SQLService SQLService { get; private set; }
public override void Load()
{
Instance = this;
var assembly = System.Reflection.Assembly.GetExecutingAssembly();
var resourceNames = assembly.GetManifestResourceNames();
LogInstance.LogDebug("=== Embedded Resources ===");
foreach (var resource in resourceNames)
{
LogInstance.LogDebug(resource);
}
LogInstance.LogDebug("========================");
Settings = new Settings();
Settings.InitConfig();
AssemblyResolver.Resolve();
_harmony = new Harmony(MyPluginInfo.PLUGIN_GUID);
_harmony.PatchAll(System.Reflection.Assembly.GetExecutingAssembly());
if (Settings.MySQLConfigured)
{
SQLService = new SQLService();
}
}
public override bool Unload()
{
_harmony?.UnpatchSelf();
return true;
}
}