A bit of work on new IPC
This commit is contained in:
56
CustomizePlus/Api/CustomizePlusIpc.cs
Normal file
56
CustomizePlus/Api/CustomizePlusIpc.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using CustomizePlus.Core.Services;
|
||||
using Dalamud.Plugin;
|
||||
using OtterGui.Log;
|
||||
using System;
|
||||
|
||||
namespace CustomizePlus.Api;
|
||||
|
||||
public partial class CustomizePlusIpc : IDisposable
|
||||
{
|
||||
private readonly DalamudPluginInterface _pluginInterface;
|
||||
private readonly Logger _logger;
|
||||
private readonly HookingService _hookingService;
|
||||
|
||||
/// <summary>
|
||||
/// Shows if IPC failed to initialize or any other unrecoverable fatal error occured.
|
||||
/// </summary>
|
||||
public bool IPCFailed { get; private set; }
|
||||
|
||||
public CustomizePlusIpc(
|
||||
DalamudPluginInterface pluginInterface,
|
||||
Logger logger,
|
||||
HookingService hookingService)
|
||||
{
|
||||
_pluginInterface = pluginInterface;
|
||||
_logger = logger;
|
||||
_hookingService = hookingService;
|
||||
|
||||
InitializeProviders();
|
||||
}
|
||||
|
||||
private void InitializeProviders()
|
||||
{
|
||||
try
|
||||
{
|
||||
InitializeGeneralProviders();
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
_logger.Fatal($"Fatal error while initializing Customize+ IPC: {ex}");
|
||||
|
||||
IPCFailed = true;
|
||||
|
||||
DisposeProviders();
|
||||
}
|
||||
}
|
||||
|
||||
private void DisposeProviders()
|
||||
{
|
||||
DisposeGeneralProviders();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
DisposeProviders();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user