quantum-space-buddies/QSB/Patches/QSBPatchManager.cs

55 lines
1.3 KiB
C#
Raw Normal View History

2020-11-03 21:11:10 +00:00
using OWML.Common;
using QSB.ConversationSync;
using QSB.DeathSync;
using QSB.ElevatorSync;
2020-12-24 19:35:42 +00:00
using QSB.FrequencySync;
2020-12-19 10:56:25 +00:00
using QSB.LogSync;
2020-11-03 21:11:10 +00:00
using QSB.OrbSync;
2020-12-21 19:41:53 +00:00
using QSB.QuantumSync;
2020-11-03 21:11:10 +00:00
using QSB.TimeSync;
using QSB.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
namespace QSB.Patches
{
2020-12-02 21:29:53 +00:00
public delegate void PatchEvent(QSBPatchTypes type);
2020-11-04 20:01:28 +00:00
2020-12-02 21:29:53 +00:00
public static class QSBPatchManager
{
public static event PatchEvent OnPatchType;
2020-11-04 20:01:28 +00:00
2020-12-14 21:20:53 +00:00
private static List<QSBPatch> _patchList = new List<QSBPatch>();
2020-12-14 20:41:56 +00:00
2020-12-14 21:20:53 +00:00
public static void Init()
2020-12-02 21:29:53 +00:00
{
_patchList = new List<QSBPatch>
{
new ConversationPatches(),
new DeathPatches(),
new ElevatorPatches(),
new OrbPatches(),
2020-12-19 10:56:25 +00:00
new WakeUpPatches(),
2020-12-21 19:41:53 +00:00
new LogPatches(),
2020-12-22 21:39:53 +00:00
new QuantumVisibilityPatches(),
new ServerQuantumStateChangePatches(),
2020-12-24 19:35:42 +00:00
new ClientQuantumStateChangePatches(),
new FrequencyPatches()
2020-12-02 21:29:53 +00:00
};
2020-11-03 21:11:10 +00:00
2020-12-02 21:29:53 +00:00
DebugLog.DebugWrite("Patch Manager ready.", MessageType.Success);
}
2020-11-03 21:11:10 +00:00
2020-12-02 21:29:53 +00:00
public static void DoPatchType(QSBPatchTypes type)
{
OnPatchType?.Invoke(type);
DebugLog.DebugWrite($"Patch block {Enum.GetName(typeof(QSBPatchTypes), type)}", MessageType.Info);
foreach (var patch in _patchList.Where(x => x.Type == type))
{
DebugLog.DebugWrite($" - Patching in {patch.GetType().Name}", MessageType.Info);
patch.DoPatches();
}
}
}
2020-12-03 08:28:05 +00:00
}