mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-12 18:27:24 +01:00
refactor a little bit
This commit is contained in:
parent
cfb8cdaa79
commit
327b6275c0
23 changed files with 1091 additions and 894 deletions
52
MareSynchronos/Interop/Ipc/IpcManager.cs
Normal file
52
MareSynchronos/Interop/Ipc/IpcManager.cs
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
using MareSynchronos.Services.Mediator;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace MareSynchronos.Interop.Ipc;
|
||||
|
||||
public sealed partial class IpcManager : DisposableMediatorSubscriberBase
|
||||
{
|
||||
public IpcManager(ILogger<IpcManager> logger, MareMediator mediator,
|
||||
IpcCallerPenumbra penumbraIpc, IpcCallerGlamourer glamourerIpc, IpcCallerCustomize customizeIpc, IpcCallerHeels heelsIpc,
|
||||
IpcCallerHonorific honorificIpc) : base(logger, mediator)
|
||||
{
|
||||
CustomizePlus = customizeIpc;
|
||||
Heels = heelsIpc;
|
||||
Glamourer = glamourerIpc;
|
||||
Penumbra = penumbraIpc;
|
||||
Honorific = honorificIpc;
|
||||
|
||||
if (Initialized)
|
||||
{
|
||||
Mediator.Publish(new PenumbraInitializedMessage());
|
||||
}
|
||||
|
||||
Mediator.Subscribe<DelayedFrameworkUpdateMessage>(this, (_) => PeriodicApiStateCheck());
|
||||
|
||||
try
|
||||
{
|
||||
PeriodicApiStateCheck();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogWarning(ex, "Failed to check for some IPC, plugin not installed?");
|
||||
}
|
||||
}
|
||||
|
||||
public bool Initialized => Penumbra.APIAvailable && Glamourer.APIAvailable;
|
||||
|
||||
public IpcCallerCustomize CustomizePlus { get; init; }
|
||||
public IpcCallerHonorific Honorific { get; init; }
|
||||
public IpcCallerHeels Heels { get; init; }
|
||||
public IpcCallerGlamourer Glamourer { get; }
|
||||
public IpcCallerPenumbra Penumbra { get; }
|
||||
|
||||
private void PeriodicApiStateCheck()
|
||||
{
|
||||
Penumbra.CheckAPI();
|
||||
Penumbra.CheckModDirectory();
|
||||
Glamourer.CheckAPI();
|
||||
Heels.CheckAPI();
|
||||
CustomizePlus.CheckAPI();
|
||||
Honorific.CheckAPI();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue