Skip to content

Commit

Permalink
feat: scan for new mods when penumbra adds a mod
Browse files Browse the repository at this point in the history
  • Loading branch information
anna-is-cute committed Aug 17, 2023
1 parent b064709 commit 2a744b0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions PenumbraIpc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ internal class PenumbraIpc : IDisposable {
private FuncSubscriber<string, string, string, bool, PenumbraApiEc> TrySetModSubscriber { get; }
private FuncSubscriber<string, string, (PenumbraApiEc, string, bool)> GetModPathSubscriber { get; }

private EventSubscriber<string>? ModAddedEvent { get; set; }
private EventSubscriber<string>? ModDeletedEvent { get; set; }
private EventSubscriber<string, string>? ModMovedEvent { get; set; }

Expand All @@ -37,9 +38,14 @@ internal PenumbraIpc(Plugin plugin) {
public void Dispose() {
this.ModMovedEvent?.Dispose();
this.ModDeletedEvent?.Dispose();
this.ModAddedEvent?.Dispose();
}

private void RegisterEvents() {
this.ModAddedEvent = Penumbra.Api.Ipc.ModAdded.Subscriber(this.Plugin.Interface, _ => {
Task.Run(async () => await this.Plugin.State.UpdatePackages());
});

this.ModDeletedEvent = Penumbra.Api.Ipc.ModDeleted.Subscriber(this.Plugin.Interface, _ => {
Task.Run(async () => await this.Plugin.State.UpdatePackages());
});
Expand Down

0 comments on commit 2a744b0

Please sign in to comment.