forked from UnknownX7/QoLBar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
IPC.cs
36 lines (32 loc) · 2.31 KB
/
IPC.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
using System.Linq;
using Dalamud.Plugin.Ipc;
namespace QoLBar;
public static class IPC
{
public const int IPCVersion = 1;
public static readonly ICallGateProvider<object> InitializedProvider = DalamudApi.PluginInterface.GetIpcProvider<object>("QoLBar.Initialized");
public static readonly ICallGateProvider<object> DisposedProvider = DalamudApi.PluginInterface.GetIpcProvider<object>("QoLBar.Disposed");
public static readonly ICallGateProvider<string> GetVersionProvider = DalamudApi.PluginInterface.GetIpcProvider<string>("QoLBar.GetVersion");
public static readonly ICallGateProvider<int> GetIPCVersionProvider = DalamudApi.PluginInterface.GetIpcProvider<int>("QoLBar.GetIPCVersion");
public static readonly ICallGateProvider<string, object> ImportBarProvider = DalamudApi.PluginInterface.GetIpcProvider<string, object>("QoLBar.ImportBar");
public static readonly ICallGateProvider<string[]> GetConditionSetsProvider = DalamudApi.PluginInterface.GetIpcProvider<string[]>("QoLBar.GetConditionSets");
public static readonly ICallGateProvider<int, bool> CheckConditionSetProvider = DalamudApi.PluginInterface.GetIpcProvider<int, bool>("QoLBar.CheckConditionSet");
public static readonly ICallGateProvider<int, int, object> MovedConditionSetProvider = DalamudApi.PluginInterface.GetIpcProvider<int, int, object>("QoLBar.MovedConditionSet");
public static readonly ICallGateProvider<int, object> RemovedConditionSetProvider = DalamudApi.PluginInterface.GetIpcProvider<int, object>("QoLBar.RemovedConditionSet");
public static void Initialize()
{
GetVersionProvider.RegisterFunc(() => QoLBar.Config.PluginVersion);
GetIPCVersionProvider.RegisterFunc(() => IPCVersion);
ImportBarProvider.RegisterAction(import => QoLBar.Plugin.ui.ImportBar(import));
GetConditionSetsProvider.RegisterFunc(() => QoLBar.Config.CndSetCfgs.Select(s => s.Name).ToArray());
CheckConditionSetProvider.RegisterFunc(i => i >= 0 && i < QoLBar.Config.CndSetCfgs.Count && ConditionManager.CheckConditionSet(i));
}
public static void Dispose()
{
GetVersionProvider.UnregisterFunc();
GetIPCVersionProvider.UnregisterFunc();
ImportBarProvider.UnregisterAction();
GetConditionSetsProvider.UnregisterFunc();
CheckConditionSetProvider.UnregisterFunc();
}
}