Clean up this service registration stuff before I go insane
This commit is contained in:
@@ -64,6 +64,29 @@ public sealed class Plugin : IDalamudPlugin
|
|||||||
collection.AddSingleton<FileDialogManager>();
|
collection.AddSingleton<FileDialogManager>();
|
||||||
collection.AddSingleton(new Dalamud.Localization("MareSynchronos.Localization.", "", useEmbedded: true));
|
collection.AddSingleton(new Dalamud.Localization("MareSynchronos.Localization.", "", useEmbedded: true));
|
||||||
|
|
||||||
|
// add dalamud services
|
||||||
|
collection.AddSingleton(_ => pluginInterface);
|
||||||
|
collection.AddSingleton(_ => pluginInterface.UiBuilder);
|
||||||
|
collection.AddSingleton(_ => commandManager);
|
||||||
|
collection.AddSingleton(_ => gameData);
|
||||||
|
collection.AddSingleton(_ => framework);
|
||||||
|
collection.AddSingleton(_ => objectTable);
|
||||||
|
collection.AddSingleton(_ => clientState);
|
||||||
|
collection.AddSingleton(_ => condition);
|
||||||
|
collection.AddSingleton(_ => chatGui);
|
||||||
|
collection.AddSingleton(_ => gameGui);
|
||||||
|
collection.AddSingleton(_ => dtrBar);
|
||||||
|
collection.AddSingleton(_ => toastGui);
|
||||||
|
collection.AddSingleton(_ => pluginLog);
|
||||||
|
collection.AddSingleton(_ => targetManager);
|
||||||
|
collection.AddSingleton(_ => notificationManager);
|
||||||
|
collection.AddSingleton(_ => textureProvider);
|
||||||
|
collection.AddSingleton(_ => contextMenu);
|
||||||
|
collection.AddSingleton(_ => gameInteropProvider);
|
||||||
|
collection.AddSingleton(_ => namePlateGui);
|
||||||
|
collection.AddSingleton(_ => gameConfig);
|
||||||
|
collection.AddSingleton(_ => partyList);
|
||||||
|
|
||||||
// add mare related singletons
|
// add mare related singletons
|
||||||
collection.AddSingleton<MareMediator>();
|
collection.AddSingleton<MareMediator>();
|
||||||
collection.AddSingleton<FileCacheManager>();
|
collection.AddSingleton<FileCacheManager>();
|
||||||
@@ -88,42 +111,22 @@ public sealed class Plugin : IDalamudPlugin
|
|||||||
collection.AddSingleton<FileCompactor>();
|
collection.AddSingleton<FileCompactor>();
|
||||||
collection.AddSingleton<TagHandler>();
|
collection.AddSingleton<TagHandler>();
|
||||||
collection.AddSingleton<UidDisplayHandler>();
|
collection.AddSingleton<UidDisplayHandler>();
|
||||||
collection.AddSingleton((s) => new IpcProvider(s.GetRequiredService<ILogger<IpcProvider>>(),
|
collection.AddSingleton<IpcProvider>();
|
||||||
pluginInterface,
|
|
||||||
s.GetRequiredService<MareCharaFileManager>(), s.GetRequiredService<DalamudUtilService>(),
|
|
||||||
s.GetRequiredService<MareMediator>()));
|
|
||||||
collection.AddSingleton<PlayerPerformanceService>();
|
collection.AddSingleton<PlayerPerformanceService>();
|
||||||
collection.AddSingleton((s) => new EventAggregator(s.GetRequiredService<MareConfigService>(),
|
collection.AddSingleton<EventAggregator>();
|
||||||
s.GetRequiredService<ILogger<EventAggregator>>(), s.GetRequiredService<MareMediator>()));
|
collection.AddSingleton<DalamudUtilService>();
|
||||||
collection.AddSingleton((s) => new DalamudUtilService(s.GetRequiredService<ILogger<DalamudUtilService>>(),
|
collection.AddSingleton<DtrEntry>();
|
||||||
clientState, objectTable, framework, gameGui, toastGui, condition, gameData, targetManager,
|
collection.AddSingleton<PairManager>();
|
||||||
s.GetRequiredService<MareMediator>(), s.GetRequiredService<PerformanceCollectorService>()));
|
|
||||||
collection.AddSingleton((s) => new DtrEntry(s.GetRequiredService<ILogger<DtrEntry>>(), dtrBar, s.GetRequiredService<MareConfigService>(),
|
|
||||||
s.GetRequiredService<MareMediator>(), s.GetRequiredService<PairManager>(), s.GetRequiredService<ApiController>()));
|
|
||||||
collection.AddSingleton(s => new PairManager(s.GetRequiredService<ILogger<PairManager>>(), s.GetRequiredService<PairFactory>(),
|
|
||||||
s.GetRequiredService<MareConfigService>(), s.GetRequiredService<MareMediator>(), contextMenu));
|
|
||||||
collection.AddSingleton<RedrawManager>();
|
collection.AddSingleton<RedrawManager>();
|
||||||
collection.AddSingleton((s) => new IpcCallerPenumbra(s.GetRequiredService<ILogger<IpcCallerPenumbra>>(), pluginInterface,
|
collection.AddSingleton<IpcCallerPenumbra>();
|
||||||
s.GetRequiredService<DalamudUtilService>(), s.GetRequiredService<MareMediator>(), s.GetRequiredService<RedrawManager>()));
|
collection.AddSingleton<IpcCallerGlamourer>();
|
||||||
collection.AddSingleton((s) => new IpcCallerGlamourer(s.GetRequiredService<ILogger<IpcCallerGlamourer>>(), pluginInterface,
|
collection.AddSingleton<IpcCallerCustomize>();
|
||||||
s.GetRequiredService<DalamudUtilService>(), s.GetRequiredService<MareMediator>(), s.GetRequiredService<RedrawManager>()));
|
collection.AddSingleton<IpcCallerHeels>();
|
||||||
collection.AddSingleton((s) => new IpcCallerCustomize(s.GetRequiredService<ILogger<IpcCallerCustomize>>(), pluginInterface,
|
collection.AddSingleton<IpcCallerHonorific>();
|
||||||
s.GetRequiredService<DalamudUtilService>(), s.GetRequiredService<MareMediator>()));
|
collection.AddSingleton<IpcCallerPetNames>();
|
||||||
collection.AddSingleton((s) => new IpcCallerHeels(s.GetRequiredService<ILogger<IpcCallerHeels>>(), pluginInterface,
|
collection.AddSingleton<IpcCallerMoodles>();
|
||||||
s.GetRequiredService<DalamudUtilService>(), s.GetRequiredService<MareMediator>()));
|
collection.AddSingleton<IpcManager>();
|
||||||
collection.AddSingleton((s) => new IpcCallerHonorific(s.GetRequiredService<ILogger<IpcCallerHonorific>>(), pluginInterface,
|
collection.AddSingleton<NotificationService>();
|
||||||
s.GetRequiredService<DalamudUtilService>(), s.GetRequiredService<MareMediator>()));
|
|
||||||
collection.AddSingleton((s) => new IpcCallerPetNames(s.GetRequiredService<ILogger<IpcCallerPetNames>>(), pluginInterface,
|
|
||||||
s.GetRequiredService<DalamudUtilService>(), s.GetRequiredService<MareMediator>()));
|
|
||||||
collection.AddSingleton((s) => new IpcCallerMoodles(s.GetRequiredService<ILogger<IpcCallerMoodles>>(), pluginInterface,
|
|
||||||
s.GetRequiredService<DalamudUtilService>(), s.GetRequiredService<MareMediator>()));
|
|
||||||
collection.AddSingleton((s) => new IpcManager(s.GetRequiredService<ILogger<IpcManager>>(),
|
|
||||||
s.GetRequiredService<MareMediator>(), s.GetRequiredService<IpcCallerPenumbra>(), s.GetRequiredService<IpcCallerGlamourer>(),
|
|
||||||
s.GetRequiredService<IpcCallerCustomize>(), s.GetRequiredService<IpcCallerHeels>(), s.GetRequiredService<IpcCallerHonorific>(),
|
|
||||||
s.GetRequiredService<IpcCallerPetNames>(), s.GetRequiredService<IpcCallerMoodles>()));
|
|
||||||
collection.AddSingleton((s) => new NotificationService(s.GetRequiredService<ILogger<NotificationService>>(),
|
|
||||||
s.GetRequiredService<MareMediator>(), s.GetRequiredService<DalamudUtilService>(),
|
|
||||||
notificationManager, chatGui, s.GetRequiredService<MareConfigService>()));
|
|
||||||
|
|
||||||
collection.AddSingleton((s) => new MareConfigService(pluginInterface.ConfigDirectory.FullName));
|
collection.AddSingleton((s) => new MareConfigService(pluginInterface.ConfigDirectory.FullName));
|
||||||
collection.AddSingleton((s) => new ServerConfigService(pluginInterface.ConfigDirectory.FullName));
|
collection.AddSingleton((s) => new ServerConfigService(pluginInterface.ConfigDirectory.FullName));
|
||||||
@@ -134,7 +137,7 @@ public sealed class Plugin : IDalamudPlugin
|
|||||||
collection.AddSingleton((s) => new XivDataStorageService(pluginInterface.ConfigDirectory.FullName));
|
collection.AddSingleton((s) => new XivDataStorageService(pluginInterface.ConfigDirectory.FullName));
|
||||||
collection.AddSingleton((s) => new PlayerPerformanceConfigService(pluginInterface.ConfigDirectory.FullName));
|
collection.AddSingleton((s) => new PlayerPerformanceConfigService(pluginInterface.ConfigDirectory.FullName));
|
||||||
collection.AddSingleton((s) => new ServerBlockConfigService(pluginInterface.ConfigDirectory.FullName));
|
collection.AddSingleton((s) => new ServerBlockConfigService(pluginInterface.ConfigDirectory.FullName));
|
||||||
collection.AddSingleton((s) => new ConfigurationMigrator(s.GetRequiredService<ILogger<ConfigurationMigrator>>(), s.GetRequiredService<NotesConfigService>()));
|
collection.AddSingleton<ConfigurationMigrator>();
|
||||||
collection.AddSingleton<HubFactory>();
|
collection.AddSingleton<HubFactory>();
|
||||||
|
|
||||||
// add scoped services
|
// add scoped services
|
||||||
@@ -148,10 +151,7 @@ public sealed class Plugin : IDalamudPlugin
|
|||||||
collection.AddScoped<WindowMediatorSubscriberBase, PopoutProfileUi>();
|
collection.AddScoped<WindowMediatorSubscriberBase, PopoutProfileUi>();
|
||||||
collection.AddScoped<WindowMediatorSubscriberBase, DataAnalysisUi>();
|
collection.AddScoped<WindowMediatorSubscriberBase, DataAnalysisUi>();
|
||||||
collection.AddScoped<WindowMediatorSubscriberBase, EventViewerUI>();
|
collection.AddScoped<WindowMediatorSubscriberBase, EventViewerUI>();
|
||||||
|
collection.AddScoped<WindowMediatorSubscriberBase, EditProfileUi>();
|
||||||
collection.AddScoped<WindowMediatorSubscriberBase, EditProfileUi>((s) => new EditProfileUi(s.GetRequiredService<ILogger<EditProfileUi>>(),
|
|
||||||
s.GetRequiredService<MareMediator>(), s.GetRequiredService<ApiController>(), s.GetRequiredService<UiSharedService>(), s.GetRequiredService<FileDialogManager>(),
|
|
||||||
s.GetRequiredService<ServerConfigurationManager>(), s.GetRequiredService<MareProfileManager>(), s.GetRequiredService<PerformanceCollectorService>()));
|
|
||||||
collection.AddScoped<WindowMediatorSubscriberBase, PopupHandler>();
|
collection.AddScoped<WindowMediatorSubscriberBase, PopupHandler>();
|
||||||
collection.AddScoped<IPopupHandler, ReportPopupHandler>();
|
collection.AddScoped<IPopupHandler, ReportPopupHandler>();
|
||||||
collection.AddScoped<IPopupHandler, BanUserPopupHandler>();
|
collection.AddScoped<IPopupHandler, BanUserPopupHandler>();
|
||||||
@@ -159,22 +159,11 @@ public sealed class Plugin : IDalamudPlugin
|
|||||||
collection.AddScoped<TransientResourceManager>();
|
collection.AddScoped<TransientResourceManager>();
|
||||||
collection.AddScoped<PlayerDataFactory>();
|
collection.AddScoped<PlayerDataFactory>();
|
||||||
collection.AddScoped<OnlinePlayerManager>();
|
collection.AddScoped<OnlinePlayerManager>();
|
||||||
collection.AddScoped((s) => new UiService(s.GetRequiredService<ILogger<UiService>>(), pluginInterface.UiBuilder, s.GetRequiredService<MareConfigService>(),
|
collection.AddScoped<UiService>();
|
||||||
s.GetRequiredService<WindowSystem>(), s.GetServices<WindowMediatorSubscriberBase>(),
|
collection.AddScoped<CommandManagerService>();
|
||||||
s.GetRequiredService<UiFactory>(),
|
collection.AddScoped<UiSharedService>();
|
||||||
s.GetRequiredService<FileDialogManager>(), s.GetRequiredService<MareMediator>()));
|
collection.AddScoped<ChatService>();
|
||||||
collection.AddScoped((s) => new CommandManagerService(commandManager, s.GetRequiredService<PerformanceCollectorService>(),
|
collection.AddScoped<GuiHookService>();
|
||||||
s.GetRequiredService<ServerConfigurationManager>(), s.GetRequiredService<CacheMonitor>(), s.GetRequiredService<ChatService>(), s.GetRequiredService<ApiController>(),
|
|
||||||
s.GetRequiredService<MareMediator>(), s.GetRequiredService<MareConfigService>()));
|
|
||||||
collection.AddScoped((s) => new UiSharedService(s.GetRequiredService<ILogger<UiSharedService>>(), s.GetRequiredService<IpcManager>(), s.GetRequiredService<ApiController>(),
|
|
||||||
s.GetRequiredService<CacheMonitor>(), s.GetRequiredService<FileDialogManager>(), s.GetRequiredService<MareConfigService>(), s.GetRequiredService<DalamudUtilService>(),
|
|
||||||
pluginInterface, textureProvider, s.GetRequiredService<Dalamud.Localization>(), s.GetRequiredService<ServerConfigurationManager>(), s.GetRequiredService<MareMediator>()));
|
|
||||||
collection.AddScoped((s) => new ChatService(s.GetRequiredService<ILogger<ChatService>>(), s.GetRequiredService<DalamudUtilService>(),
|
|
||||||
s.GetRequiredService<MareMediator>(), s.GetRequiredService<ApiController>(), s.GetRequiredService<PairManager>(),
|
|
||||||
s.GetRequiredService<ILogger<GameChatHooks>>(), gameInteropProvider, chatGui,
|
|
||||||
s.GetRequiredService<MareConfigService>(), s.GetRequiredService<ServerConfigurationManager>()));
|
|
||||||
collection.AddScoped((s) => new GuiHookService(s.GetRequiredService<ILogger<GuiHookService>>(), s.GetRequiredService<DalamudUtilService>(), s.GetRequiredService<MareMediator>(),
|
|
||||||
s.GetRequiredService<MareConfigService>(), namePlateGui, gameConfig, partyList, s.GetRequiredService<PairManager>()));
|
|
||||||
|
|
||||||
collection.AddHostedService(p => p.GetRequiredService<MareMediator>());
|
collection.AddHostedService(p => p.GetRequiredService<MareMediator>());
|
||||||
collection.AddHostedService(p => p.GetRequiredService<NotificationService>());
|
collection.AddHostedService(p => p.GetRequiredService<NotificationService>());
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public sealed class DtrEntry : IDisposable, IHostedService
|
|||||||
|
|
||||||
private readonly ApiController _apiController;
|
private readonly ApiController _apiController;
|
||||||
private readonly CancellationTokenSource _cancellationTokenSource = new();
|
private readonly CancellationTokenSource _cancellationTokenSource = new();
|
||||||
private readonly ConfigurationServiceBase<MareConfig> _configService;
|
private readonly MareConfigService _configService;
|
||||||
private readonly IDtrBar _dtrBar;
|
private readonly IDtrBar _dtrBar;
|
||||||
private readonly Lazy<IDtrBarEntry> _entry;
|
private readonly Lazy<IDtrBarEntry> _entry;
|
||||||
private readonly ILogger<DtrEntry> _logger;
|
private readonly ILogger<DtrEntry> _logger;
|
||||||
@@ -44,7 +44,7 @@ public sealed class DtrEntry : IDisposable, IHostedService
|
|||||||
private string? _tooltip;
|
private string? _tooltip;
|
||||||
private Colors _colors;
|
private Colors _colors;
|
||||||
|
|
||||||
public DtrEntry(ILogger<DtrEntry> logger, IDtrBar dtrBar, ConfigurationServiceBase<MareConfig> configService, MareMediator mareMediator, PairManager pairManager, ApiController apiController)
|
public DtrEntry(ILogger<DtrEntry> logger, IDtrBar dtrBar, MareConfigService configService, MareMediator mareMediator, PairManager pairManager, ApiController apiController)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_dtrBar = dtrBar;
|
_dtrBar = dtrBar;
|
||||||
|
|||||||
Reference in New Issue
Block a user