Screenie/PenumbraIpc.cs

53 lines
1.9 KiB
C#
Raw Normal View History

2024-02-18 16:00:46 +00:00
using Penumbra.Api.Helpers;
2024-02-18 17:23:04 +00:00
namespace Screenie;
2024-02-18 16:00:46 +00:00
internal class PenumbraIpc {
private Plugin Plugin { get; }
2024-02-18 16:39:40 +00:00
private FuncSubscriber<string> GetModDirectorySubscriber { get; }
private ParamsFuncSubscriber<ushort, IReadOnlyDictionary<string, string[]>?[]> GetGameObjectResourcePathsSubscriber { get; }
2024-02-18 16:00:46 +00:00
private FuncSubscriber<IReadOnlyDictionary<ushort, IReadOnlyDictionary<string, string[]>>> GetPlayerResourcePathsSubscriber { get; }
2024-02-18 16:39:40 +00:00
private FuncSubscriber<IList<(string, string)>> GetModsSubscriber { get; }
2024-02-18 16:00:46 +00:00
internal PenumbraIpc(Plugin plugin) {
this.Plugin = plugin;
2024-02-18 16:39:40 +00:00
this.GetModDirectorySubscriber = Penumbra.Api.Ipc.GetModDirectory.Subscriber(this.Plugin.Interface);
this.GetGameObjectResourcePathsSubscriber = Penumbra.Api.Ipc.GetGameObjectResourcePaths.Subscriber(this.Plugin.Interface);
2024-02-18 16:00:46 +00:00
this.GetPlayerResourcePathsSubscriber = Penumbra.Api.Ipc.GetPlayerResourcePaths.Subscriber(this.Plugin.Interface);
2024-02-18 16:39:40 +00:00
this.GetModsSubscriber = Penumbra.Api.Ipc.GetMods.Subscriber(this.Plugin.Interface);
}
internal string? GetModDirectory() {
try {
return this.GetModDirectorySubscriber.Invoke();
} catch {
return null;
}
2024-02-18 16:00:46 +00:00
}
internal IReadOnlyDictionary<string, string[]>?[]? GetGameObjectResourcePaths(params ushort[] objects) {
try {
return this.GetGameObjectResourcePathsSubscriber.Invoke(objects);
} catch {
return null;
}
}
2024-02-18 16:00:46 +00:00
internal IReadOnlyDictionary<ushort, IReadOnlyDictionary<string, string[]>>? GetPlayerResourcePaths() {
try {
return this.GetPlayerResourcePathsSubscriber.Invoke();
} catch {
return null;
}
}
2024-02-18 16:39:40 +00:00
internal IList<(string Directory, string Name)>? GetMods() {
try {
return this.GetModsSubscriber.Invoke();
} catch {
return null;
}
}
2024-02-18 16:00:46 +00:00
}