using Penumbra.Api.Helpers; namespace Screenie; internal class PenumbraIpc { private Plugin Plugin { get; } private FuncSubscriber GetModDirectorySubscriber { get; } private ParamsFuncSubscriber?[]> GetGameObjectResourcePathsSubscriber { get; } private FuncSubscriber>> GetPlayerResourcePathsSubscriber { get; } private FuncSubscriber> GetModsSubscriber { get; } internal PenumbraIpc(Plugin plugin) { this.Plugin = plugin; this.GetModDirectorySubscriber = Penumbra.Api.Ipc.GetModDirectory.Subscriber(this.Plugin.Interface); this.GetGameObjectResourcePathsSubscriber = Penumbra.Api.Ipc.GetGameObjectResourcePaths.Subscriber(this.Plugin.Interface); this.GetPlayerResourcePathsSubscriber = Penumbra.Api.Ipc.GetPlayerResourcePaths.Subscriber(this.Plugin.Interface); this.GetModsSubscriber = Penumbra.Api.Ipc.GetMods.Subscriber(this.Plugin.Interface); } internal string? GetModDirectory() { try { return this.GetModDirectorySubscriber.Invoke(); } catch { return null; } } internal IReadOnlyDictionary?[]? GetGameObjectResourcePaths(params ushort[] objects) { try { return this.GetGameObjectResourcePathsSubscriber.Invoke(objects); } catch { return null; } } internal IReadOnlyDictionary>? GetPlayerResourcePaths() { try { return this.GetPlayerResourcePathsSubscriber.Invoke(); } catch { return null; } } internal IList<(string Directory, string Name)>? GetMods() { try { return this.GetModsSubscriber.Invoke(); } catch { return null; } } }