41 lines
1.1 KiB
C#
Raw Normal View History

2024-06-16 17:43:42 +02:00
using System;
using System.Collections.Generic;
using Dalamud.Plugin;
using Dalamud.Plugin.Services;
namespace Questionable.External;
internal sealed class YesAlreadyIpc : IDisposable
{
2024-07-03 21:00:04 +02:00
private readonly IDalamudPluginInterface _pluginInterface;
2024-06-16 17:43:42 +02:00
private readonly IPluginLog _pluginLog;
2024-07-03 21:00:04 +02:00
public YesAlreadyIpc(IDalamudPluginInterface pluginInterface, IPluginLog pluginLog)
2024-06-16 17:43:42 +02:00
{
_pluginInterface = pluginInterface;
_pluginLog = pluginLog;
}
public void DisableYesAlready()
{
2024-06-17 00:30:50 +02:00
if (_pluginInterface.TryGetData<HashSet<string>>("YesAlready.StopRequests", out var data) &&
!data.Contains(nameof(Questionable)))
{
_pluginLog.Debug("Disabling YesAlready");
2024-06-16 17:43:42 +02:00
data.Add(nameof(Questionable));
2024-06-17 00:30:50 +02:00
}
2024-06-16 17:43:42 +02:00
}
public void RestoreYesAlready()
{
2024-06-17 00:30:50 +02:00
if (_pluginInterface.TryGetData<HashSet<string>>("YesAlready.StopRequests", out var data) &&
data.Contains(nameof(Questionable)))
{
_pluginLog.Debug("Restoring YesAlready");
2024-06-16 17:43:42 +02:00
data.Remove(nameof(Questionable));
2024-06-17 00:30:50 +02:00
}
2024-06-16 17:43:42 +02:00
}
public void Dispose() => RestoreYesAlready();
}