Files
client/MareSynchronos/Interop/Ipc/IpcManager.cs
rootdarkarchon f44f8df989 Add MCDO (#80)
* update api

* mcd online editor impl

* most of chara data hub impl

* some state of things

* some refactoring

* random bullshit go

* more nearby impl

* add uid to peformance msg

* cleanup/homogenization

* some split, update nuget packages

* migrate to latest packages where possible, remove lz4net, do some split, idk

* some polish and cleanup

* more cleanup, beautification, etc.

* fixes and cleanups

---------

Co-authored-by: Stanley Dimant <root.darkarchon@outlook.com>
2025-01-11 22:43:11 +01:00

62 lines
2.0 KiB
C#

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, IpcCallerMoodles moodlesIpc, IpcCallerPetNames ipcCallerPetNames, IpcCallerBrio ipcCallerBrio) : base(logger, mediator)
{
CustomizePlus = customizeIpc;
Heels = heelsIpc;
Glamourer = glamourerIpc;
Penumbra = penumbraIpc;
Honorific = honorificIpc;
Moodles = moodlesIpc;
PetNames = ipcCallerPetNames;
Brio = ipcCallerBrio;
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; }
public IpcCallerMoodles Moodles { get; }
public IpcCallerPetNames PetNames { get; }
public IpcCallerBrio Brio { get; }
private void PeriodicApiStateCheck()
{
Penumbra.CheckAPI();
Penumbra.CheckModDirectory();
Glamourer.CheckAPI();
Heels.CheckAPI();
CustomizePlus.CheckAPI();
Honorific.CheckAPI();
Moodles.CheckAPI();
PetNames.CheckAPI();
Brio.CheckAPI();
}
}