2025-06-27 21:31:38 +03:00
|
|
|
using HarmonyLib;
|
|
|
|
|
using Nebula.Shared;
|
|
|
|
|
|
|
|
|
|
namespace Nebula.Runner.Services;
|
|
|
|
|
|
|
|
|
|
[ServiceRegister]
|
2025-07-13 10:08:07 +03:00
|
|
|
public class HarmonyService
|
2025-06-27 21:31:38 +03:00
|
|
|
{
|
|
|
|
|
private HarmonyInstance? _instance;
|
|
|
|
|
|
|
|
|
|
public HarmonyInstance Instance
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (_instance is null)
|
|
|
|
|
CreateInstance();
|
|
|
|
|
return _instance!;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void CreateInstance()
|
|
|
|
|
{
|
|
|
|
|
if (_instance is not null)
|
|
|
|
|
throw new Exception();
|
|
|
|
|
|
|
|
|
|
_instance = new HarmonyInstance();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class HarmonyInstance
|
|
|
|
|
{
|
|
|
|
|
public readonly Harmony Harmony;
|
|
|
|
|
|
|
|
|
|
internal HarmonyInstance()
|
|
|
|
|
{
|
|
|
|
|
Harmony = new Harmony("ru.cinka.patch");
|
|
|
|
|
}
|
|
|
|
|
}
|