2023-02-16 09:25:33 +00:00
|
|
|
|
using Dalamud.Logging;
|
|
|
|
|
|
|
|
|
|
namespace Pal.Client.Scheduled
|
2022-12-22 00:01:09 +00:00
|
|
|
|
{
|
|
|
|
|
internal interface IQueueOnFrameworkThread
|
|
|
|
|
{
|
2023-02-16 09:25:33 +00:00
|
|
|
|
internal interface IHandler
|
|
|
|
|
{
|
|
|
|
|
void RunIfCompatible(IQueueOnFrameworkThread queued, ref bool recreateLayout, ref bool saveMarkers);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal abstract class Handler<T> : IHandler
|
|
|
|
|
where T : IQueueOnFrameworkThread
|
|
|
|
|
{
|
|
|
|
|
protected abstract void Run(T queued, ref bool recreateLayout, ref bool saveMarkers);
|
|
|
|
|
|
|
|
|
|
public void RunIfCompatible(IQueueOnFrameworkThread queued, ref bool recreateLayout, ref bool saveMarkers)
|
|
|
|
|
{
|
|
|
|
|
if (queued is T t)
|
|
|
|
|
{
|
|
|
|
|
PluginLog.Information($"Handling {queued.GetType()} with handler {GetType()}");
|
|
|
|
|
Run(t, ref recreateLayout, ref saveMarkers);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
PluginLog.Error($"Could not use queue handler {GetType()} with type {queued.GetType()}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-12-22 00:01:09 +00:00
|
|
|
|
}
|
|
|
|
|
}
|