This commit is contained in:
rootdarkarchon
2024-01-18 11:15:24 +01:00
parent 54e975c39a
commit b159679999
4 changed files with 11 additions and 14 deletions

View File

@@ -9,6 +9,5 @@
"customization"
],
"IconUrl": "https://raw.githubusercontent.com/Penumbra-Sync/client/main/MareSynchronos/images/logo.png",
"RepoUrl": "https://github.com/Penumbra-Sync/client",
"CanUnloadAsync": true
"RepoUrl": "https://github.com/Penumbra-Sync/client"
}

View File

@@ -5,6 +5,7 @@ using MareSynchronos.PlayerData.Handlers;
using MareSynchronos.PlayerData.Pairs;
using MareSynchronos.Services;
using MareSynchronos.Services.Mediator;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
namespace MareSynchronos.PlayerData.Factories;
@@ -15,7 +16,7 @@ public class PairHandlerFactory
private readonly FileCacheManager _fileCacheManager;
private readonly FileDownloadManagerFactory _fileDownloadManagerFactory;
private readonly GameObjectHandlerFactory _gameObjectHandlerFactory;
private readonly CancellationToken _dalamudLifetimeToken;
private readonly IHostApplicationLifetime _hostApplicationLifetime;
private readonly IpcManager _ipcManager;
private readonly ILoggerFactory _loggerFactory;
private readonly MareMediator _mareMediator;
@@ -23,7 +24,7 @@ public class PairHandlerFactory
public PairHandlerFactory(ILoggerFactory loggerFactory, GameObjectHandlerFactory gameObjectHandlerFactory, IpcManager ipcManager,
FileDownloadManagerFactory fileDownloadManagerFactory, DalamudUtilService dalamudUtilService,
PluginWarningNotificationService pluginWarningNotificationManager, CancellationToken dalamudLifetime,
PluginWarningNotificationService pluginWarningNotificationManager, IHostApplicationLifetime hostApplicationLifetime,
FileCacheManager fileCacheManager, MareMediator mareMediator)
{
_loggerFactory = loggerFactory;
@@ -32,7 +33,7 @@ public class PairHandlerFactory
_fileDownloadManagerFactory = fileDownloadManagerFactory;
_dalamudUtilService = dalamudUtilService;
_pluginWarningNotificationManager = pluginWarningNotificationManager;
_dalamudLifetimeToken = dalamudLifetime;
_hostApplicationLifetime = hostApplicationLifetime;
_fileCacheManager = fileCacheManager;
_mareMediator = mareMediator;
}
@@ -40,7 +41,7 @@ public class PairHandlerFactory
public PairHandler Create(OnlineUserIdentDto onlineUserIdentDto)
{
return new PairHandler(_loggerFactory.CreateLogger<PairHandler>(), onlineUserIdentDto, _gameObjectHandlerFactory,
_ipcManager, _fileDownloadManagerFactory.Create(), _pluginWarningNotificationManager, _dalamudUtilService, _dalamudLifetimeToken,
_ipcManager, _fileDownloadManagerFactory.Create(), _pluginWarningNotificationManager, _dalamudUtilService, _hostApplicationLifetime,
_fileCacheManager, _mareMediator);
}
}

View File

@@ -9,6 +9,7 @@ using MareSynchronos.Services.Events;
using MareSynchronos.Services.Mediator;
using MareSynchronos.Utils;
using MareSynchronos.WebAPI.Files;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using System.Collections.Concurrent;
using System.Diagnostics;
@@ -25,7 +26,7 @@ public sealed class PairHandler : DisposableMediatorSubscriberBase
private readonly FileCacheManager _fileDbManager;
private readonly GameObjectHandlerFactory _gameObjectHandlerFactory;
private readonly IpcManager _ipcManager;
private readonly CancellationToken _lifetime;
private readonly IHostApplicationLifetime _lifetime;
private readonly PluginWarningNotificationService _pluginWarningNotificationManager;
private CancellationTokenSource? _applicationCancellationTokenSource = new();
private Guid _applicationId;
@@ -44,7 +45,7 @@ public sealed class PairHandler : DisposableMediatorSubscriberBase
GameObjectHandlerFactory gameObjectHandlerFactory,
IpcManager ipcManager, FileDownloadManager transferManager,
PluginWarningNotificationService pluginWarningNotificationManager,
DalamudUtilService dalamudUtil, CancellationToken lifetime,
DalamudUtilService dalamudUtil, IHostApplicationLifetime lifetime,
FileCacheManager fileDbManager, MareMediator mediator) : base(logger, mediator)
{
OnlineUser = onlineUser;
@@ -232,7 +233,7 @@ public sealed class PairHandler : DisposableMediatorSubscriberBase
Mediator.Publish(new EventMessage(new Event(name, OnlineUser.User, nameof(PairHandler), EventSeverity.Informational, "Disposing User")));
}
if (_lifetime.IsCancellationRequested) return;
if (_lifetime.ApplicationStopping.IsCancellationRequested) return;
if (_dalamudUtil is { IsZoning: false, IsInCutscene: false } && !string.IsNullOrEmpty(name))
{

View File

@@ -66,11 +66,7 @@ public sealed class Plugin : IDalamudPlugin
collection.AddSingleton<MareProfileManager>();
collection.AddSingleton<GameObjectHandlerFactory>();
collection.AddSingleton<FileDownloadManagerFactory>();
collection.AddSingleton((s) => new PairHandlerFactory(s.GetRequiredService<ILoggerFactory>(), s.GetRequiredService<GameObjectHandlerFactory>(),
s.GetRequiredService<IpcManager>(), s.GetRequiredService<FileDownloadManagerFactory>(), s.GetRequiredService<DalamudUtilService>(),
s.GetRequiredService<PluginWarningNotificationService>(),
CancellationTokenSource.CreateLinkedTokenSource(addonLifecycle.GameShuttingDownToken, addonLifecycle.DalamudUnloadingToken).Token,
s.GetRequiredService<FileCacheManager>(), s.GetRequiredService<MareMediator>()));
collection.AddSingleton<PairHandlerFactory>();
collection.AddSingleton<PairFactory>();
collection.AddSingleton<CharacterAnalyzer>();
collection.AddSingleton<TokenProvider>();