using Dalamud.Plugin; using Penumbra.Api.Api; using Penumbra.Api.Enums; using Penumbra.Api.Helpers; namespace Penumbra.Api.IpcSubscribers; /// public sealed class GetModList(IDalamudPluginInterface pi) : FuncSubscriber>(pi, Label) { /// The label. public const string Label = $"Penumbra.{nameof(GetModList)}"; /// public new Dictionary Invoke() => base.Invoke(); /// Create a provider. public static FuncProvider> Provider(IDalamudPluginInterface pi, IPenumbraApiMods api) => new(pi, Label, api.GetModList); } /// public sealed class InstallMod(IDalamudPluginInterface pi) : FuncSubscriber(pi, Label) { /// The label. public const string Label = $"Penumbra.{nameof(InstallMod)}.V5"; /// public new PenumbraApiEc Invoke(string modFilePackagePath) => (PenumbraApiEc)base.Invoke(modFilePackagePath); /// Create a provider. public static FuncProvider Provider(IDalamudPluginInterface pi, IPenumbraApiMods api) => new(pi, Label, a => (int)api.InstallMod(a)); } /// public sealed class ReloadMod(IDalamudPluginInterface pi) : FuncSubscriber(pi, Label) { /// The label. public const string Label = $"Penumbra.{nameof(ReloadMod)}.V5"; /// public new PenumbraApiEc Invoke(string modDirectory, string modName = "") => (PenumbraApiEc)base.Invoke(modDirectory, modName); /// Create a provider. public static FuncProvider Provider(IDalamudPluginInterface pi, IPenumbraApiMods api) => new(pi, Label, (a, b) => (int)api.ReloadMod(a, b)); } /// public sealed class AddMod(IDalamudPluginInterface pi) : FuncSubscriber(pi, Label) { /// The label. public const string Label = $"Penumbra.{nameof(AddMod)}.V5"; /// public new PenumbraApiEc Invoke(string modDirectory) => (PenumbraApiEc)base.Invoke(modDirectory); /// Create a provider. public static FuncProvider Provider(IDalamudPluginInterface pi, IPenumbraApiMods api) => new(pi, Label, a => (int)api.AddMod(a)); } /// public sealed class DeleteMod(IDalamudPluginInterface pi) : FuncSubscriber(pi, Label) { /// The label. public const string Label = $"Penumbra.{nameof(DeleteMod)}.V5"; /// public new PenumbraApiEc Invoke(string modDirectory, string modName = "") => (PenumbraApiEc)base.Invoke(modDirectory, modName); /// Create a provider. public static FuncProvider Provider(IDalamudPluginInterface pi, IPenumbraApiMods api) => new(pi, Label, (a, b) => (int)api.DeleteMod(a, b)); } /// public static class ModDeleted { /// The label. public const string Label = $"Penumbra.{nameof(ModDeleted)}"; /// Create a new event subscriber. public static EventSubscriber Subscriber(IDalamudPluginInterface pi, params Action[] actions) => new(pi, Label, actions); /// Create a provider. public static EventProvider Provider(IDalamudPluginInterface pi, IPenumbraApiMods api) => new(pi, Label, (t => api.ModDeleted += t, t => api.ModDeleted -= t)); } /// public static class ModAdded { /// The label. public const string Label = $"Penumbra.{nameof(ModAdded)}"; /// Create a new event subscriber. public static EventSubscriber Subscriber(IDalamudPluginInterface pi, params Action[] actions) => new(pi, Label, actions); /// Create a provider. public static EventProvider Provider(IDalamudPluginInterface pi, IPenumbraApiMods api) => new(pi, Label, (t => api.ModAdded += t, t => api.ModAdded -= t)); } /// public static class ModMoved { /// The label. public const string Label = $"Penumbra.{nameof(ModMoved)}"; /// Create a new event subscriber. public static EventSubscriber Subscriber(IDalamudPluginInterface pi, params Action[] actions) => new(pi, Label, actions); /// Create a provider. public static EventProvider Provider(IDalamudPluginInterface pi, IPenumbraApiMods api) => new(pi, Label, (t => api.ModMoved += t, t => api.ModMoved -= t)); } /// public sealed class GetModPath(IDalamudPluginInterface pi) : FuncSubscriber(pi, Label) { /// The label. public const string Label = $"Penumbra.{nameof(GetModPath)}.V5"; /// public new (PenumbraApiEc, string FullPath, bool FullDefault, bool NameDefault) Invoke(string modDirectory, string modName = "") { var (ret, fullPath, fullDefault, nameDefault) = base.Invoke(modDirectory, modName); return ((PenumbraApiEc)ret, fullPath, fullDefault, nameDefault); } /// Create a provider. public static FuncProvider Provider(IDalamudPluginInterface pi, IPenumbraApiMods api) => new(pi, Label, (a, b) => { var (ret, fullPath, fullDefault, nameDefault) = api.GetModPath(a, b); return ((int)ret, fullPath, fullDefault, nameDefault); }); } /// public sealed class SetModPath(IDalamudPluginInterface pi) : FuncSubscriber(pi, Label) { /// The label. public const string Label = $"Penumbra.{nameof(SetModPath)}.V5"; /// public new PenumbraApiEc Invoke(string modDirectory, string newPath, string modName = "") => (PenumbraApiEc)base.Invoke(modDirectory, modName, newPath); /// Create a provider. public static FuncProvider Provider(IDalamudPluginInterface pi, IPenumbraApiMods api) => new(pi, Label, (a, b, c) => (int)api.SetModPath(a, b, c)); } /// public sealed class GetChangedItems(IDalamudPluginInterface pi) : FuncSubscriber>(pi, Label) { /// The label. public const string Label = $"Penumbra.{nameof(GetChangedItems)}.V5"; /// public new Dictionary Invoke(string modDirectory, string modName) => base.Invoke(modDirectory, modName); /// Create a provider. public static FuncProvider> Provider(IDalamudPluginInterface pi, IPenumbraApiMods api) => new(pi, Label, api.GetChangedItems); } /// public sealed class GetChangedItemAdapterDictionary(IDalamudPluginInterface pi) : FuncSubscriber>>(pi, Label) { /// The label. public const string Label = $"Penumbra.{nameof(GetChangedItemAdapterDictionary)}"; /// public new IReadOnlyDictionary> Invoke() => base.Invoke(); /// Create a provider. public static FuncProvider>> Provider(IDalamudPluginInterface pi, IPenumbraApiMods api) => new(pi, Label, api.GetChangedItemAdapterDictionary); } /// public sealed class GetChangedItemAdapterList(IDalamudPluginInterface pi) : FuncSubscriber ChangedItems)>>(pi, Label) { /// The label. public const string Label = $"Penumbra.{nameof(GetChangedItemAdapterList)}"; /// public new IReadOnlyList<(string ModDirectory, IReadOnlyDictionary ChangedItems)> Invoke() => base.Invoke(); /// Create a provider. public static FuncProvider ChangedItems)>> Provider(IDalamudPluginInterface pi, IPenumbraApiMods api) => new(pi, Label, api.GetChangedItemAdapterList); }