Fix YA IPC

This commit is contained in:
Liza 2024-06-17 00:30:50 +02:00
parent ec51c89bba
commit 04f7a0a4c7
Signed by: liza
GPG Key ID: 7199F8D727D55F67
3 changed files with 12 additions and 6 deletions

View File

@ -278,7 +278,7 @@ internal sealed class QuestController
if (_taskQueue.Count > 0) if (_taskQueue.Count > 0)
_taskQueue.Clear(); _taskQueue.Clear();
_yesAlreadyIpc.DisableYesAlready(); _yesAlreadyIpc.RestoreYesAlready();
} }
public void Stop(string label, bool continueIfAutomatic = false) public void Stop(string label, bool continueIfAutomatic = false)

View File

@ -17,18 +17,24 @@ internal sealed class YesAlreadyIpc : IDisposable
} }
public void DisableYesAlready() public void DisableYesAlready()
{
if (_pluginInterface.TryGetData<HashSet<string>>("YesAlready.StopRequests", out var data) &&
!data.Contains(nameof(Questionable)))
{ {
_pluginLog.Debug("Disabling YesAlready"); _pluginLog.Debug("Disabling YesAlready");
if (_pluginInterface.TryGetData<HashSet<string>>("YesAlready.StopRequests", out var data))
data.Add(nameof(Questionable)); data.Add(nameof(Questionable));
} }
}
public void RestoreYesAlready() public void RestoreYesAlready()
{
if (_pluginInterface.TryGetData<HashSet<string>>("YesAlready.StopRequests", out var data) &&
data.Contains(nameof(Questionable)))
{ {
_pluginLog.Debug("Restoring YesAlready"); _pluginLog.Debug("Restoring YesAlready");
if (_pluginInterface.TryGetData<HashSet<string>>("YesAlready.StopRequests", out var data))
data.Remove(nameof(Questionable)); data.Remove(nameof(Questionable));
} }
}
public void Dispose() => RestoreYesAlready(); public void Dispose() => RestoreYesAlready();
} }

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework> <TargetFramework>net8.0-windows</TargetFramework>
<Version>0.16</Version> <Version>0.17</Version>
<LangVersion>12</LangVersion> <LangVersion>12</LangVersion>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>