This commit is contained in:
Liza 2023-10-17 18:43:30 +02:00
parent d1fcceb946
commit afd7cab940
Signed by: liza
GPG Key ID: 7199F8D727D55F67
4 changed files with 52 additions and 2 deletions

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<Version>2.10</Version>
<Version>2.11</Version>
<LangVersion>11.0</LangVersion>
<Nullable>enable</Nullable>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>

46
Deliveroo/External/DeliverooIpc.cs vendored Normal file
View File

@ -0,0 +1,46 @@
using System;
using Dalamud.Plugin;
using Dalamud.Plugin.Ipc;
namespace Deliveroo.External;
internal sealed class DeliverooIpc : IDisposable
{
private const string TurnInStarted = "Deliveroo.TurnInStarted";
private const string TurnInStopped = "Deliveroo.TurnInStopped";
private const string IsTurnInRunning = "Deliveroo.IsTurnInRunning";
private readonly ICallGateProvider<bool> _isTurnInRunning;
private readonly ICallGateProvider<object> _turnInStarted;
private readonly ICallGateProvider<object> _turnInStopped;
private bool _running;
public DeliverooIpc(DalamudPluginInterface pluginInterface)
{
_isTurnInRunning = pluginInterface.GetIpcProvider<bool>(IsTurnInRunning);
_turnInStarted = pluginInterface.GetIpcProvider<object>(TurnInStarted);
_turnInStopped = pluginInterface.GetIpcProvider<object>(TurnInStopped);
_isTurnInRunning.RegisterFunc(CheckIsTurnInRunning);
}
public void StartTurnIn()
{
_running = true;
_turnInStarted.SendMessage();
}
public void StopTurnIn()
{
_running = false;
_turnInStopped.SendMessage();
}
private bool CheckIsTurnInRunning() => _running;
public void Dispose()
{
_isTurnInRunning.UnregisterFunc();
}
}

View File

@ -7,6 +7,7 @@ namespace Deliveroo.External;
internal sealed class ExternalPluginHandler
{
private readonly IPluginLog _pluginLog;
private readonly DeliverooIpc _deliverooIpc;
private readonly YesAlreadyIpc _yesAlreadyIpc;
private readonly PandoraIpc _pandoraIpc;
@ -16,6 +17,7 @@ internal sealed class ExternalPluginHandler
public ExternalPluginHandler(DalamudPluginInterface pluginInterface, IFramework framework, IPluginLog pluginLog)
{
_pluginLog = pluginLog;
_deliverooIpc = new DeliverooIpc(pluginInterface);
var dalamudReflector = new DalamudReflector(pluginInterface, framework, pluginLog);
_yesAlreadyIpc = new YesAlreadyIpc(dalamudReflector);
@ -33,6 +35,7 @@ internal sealed class ExternalPluginHandler
}
_pluginLog.Information("Saving external plugin state...");
_deliverooIpc.StartTurnIn();
SaveYesAlreadyState();
SavePandoraState();
Saved = true;
@ -61,6 +64,7 @@ internal sealed class ExternalPluginHandler
Saved = false;
_yesAlreadyState = null;
_pandoraState = null;
_deliverooIpc.StopTurnIn();
}
private void RestoreYesAlready()

2
LLib

@ -1 +1 @@
Subproject commit e59d291f04473eae0b76712397733e2e25349953
Subproject commit 2f6ef354c401a9f1bb9b807327acad7e98662a2e