throw fists when penumbra or glamourer isn't active
This commit is contained in:
@@ -383,6 +383,7 @@ public sealed class FileCacheManager : IHostedService
|
|||||||
public Task StartAsync(CancellationToken cancellationToken)
|
public Task StartAsync(CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
_logger.LogInformation("Starting FileCacheManager");
|
_logger.LogInformation("Starting FileCacheManager");
|
||||||
|
|
||||||
lock (_fileWriteLock)
|
lock (_fileWriteLock)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -413,6 +414,13 @@ public sealed class FileCacheManager : IHostedService
|
|||||||
|
|
||||||
if (File.Exists(_csvPath))
|
if (File.Exists(_csvPath))
|
||||||
{
|
{
|
||||||
|
if (!_ipcManager.Penumbra.APIAvailable || string.IsNullOrEmpty(_ipcManager.Penumbra.ModDirectory))
|
||||||
|
{
|
||||||
|
_mareMediator.Publish(new NotificationMessage("Penumbra not connected",
|
||||||
|
"Could not load local file cache data. Penumbra is not connected or not properly set up. Please enable and/or configure Penumbra properly to use Mare. After, reload Mare in the Plugin installer.",
|
||||||
|
MareConfiguration.Models.NotificationType.Error));
|
||||||
|
}
|
||||||
|
|
||||||
_logger.LogInformation("{csvPath} found, parsing", _csvPath);
|
_logger.LogInformation("{csvPath} found, parsing", _csvPath);
|
||||||
|
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|||||||
@@ -103,7 +103,14 @@ public sealed class IpcCallerPenumbra : DisposableMediatorSubscriberBase, IIpcCa
|
|||||||
.FirstOrDefault(p => string.Equals(p.InternalName, "Penumbra", StringComparison.OrdinalIgnoreCase))
|
.FirstOrDefault(p => string.Equals(p.InternalName, "Penumbra", StringComparison.OrdinalIgnoreCase))
|
||||||
?.Version ?? new Version(0, 0, 0, 0));
|
?.Version ?? new Version(0, 0, 0, 0));
|
||||||
penumbraAvailable = penumbraVersion >= new Version(1, 1, 0, 0);
|
penumbraAvailable = penumbraVersion >= new Version(1, 1, 0, 0);
|
||||||
|
try
|
||||||
|
{
|
||||||
penumbraAvailable &= _penumbraEnabled.Invoke();
|
penumbraAvailable &= _penumbraEnabled.Invoke();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
penumbraAvailable = false;
|
||||||
|
}
|
||||||
_shownPenumbraUnavailable = _shownPenumbraUnavailable && !penumbraAvailable;
|
_shownPenumbraUnavailable = _shownPenumbraUnavailable && !penumbraAvailable;
|
||||||
APIAvailable = penumbraAvailable;
|
APIAvailable = penumbraAvailable;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,10 @@ public class PlayerDataFactory
|
|||||||
{
|
{
|
||||||
if (!_ipcManager.Initialized)
|
if (!_ipcManager.Initialized)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Penumbra is not connected");
|
_mareMediator.Publish(new NotificationMessage("Penumbra/Glamourer inactive",
|
||||||
|
"Mare attempted to process building your character data, but Penumbra or Glamourer are inactive. Enable and set up Penumbra and Glamourer for Mare to be able to function.",
|
||||||
|
NotificationType.Error));
|
||||||
|
throw new InvalidOperationException("Penumbra or Glamourer is not connected");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerRelatedObject == null) return;
|
if (playerRelatedObject == null) return;
|
||||||
|
|||||||
@@ -106,7 +106,8 @@ public sealed class Plugin : IDalamudPlugin
|
|||||||
s.GetRequiredService<MareMediator>(), s.GetRequiredService<IpcCallerPenumbra>(), s.GetRequiredService<IpcCallerGlamourer>(),
|
s.GetRequiredService<MareMediator>(), s.GetRequiredService<IpcCallerPenumbra>(), s.GetRequiredService<IpcCallerGlamourer>(),
|
||||||
s.GetRequiredService<IpcCallerCustomize>(), s.GetRequiredService<IpcCallerHeels>(), s.GetRequiredService<IpcCallerHonorific>(),
|
s.GetRequiredService<IpcCallerCustomize>(), s.GetRequiredService<IpcCallerHeels>(), s.GetRequiredService<IpcCallerHonorific>(),
|
||||||
s.GetRequiredService<IpcCallerMoodles>()));
|
s.GetRequiredService<IpcCallerMoodles>()));
|
||||||
|
collection.AddSingleton((s) => new NotificationService(s.GetRequiredService<ILogger<NotificationService>>(),
|
||||||
|
s.GetRequiredService<MareMediator>(), 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));
|
||||||
collection.AddSingleton((s) => new NotesConfigService(pluginInterface.ConfigDirectory.FullName));
|
collection.AddSingleton((s) => new NotesConfigService(pluginInterface.ConfigDirectory.FullName));
|
||||||
@@ -149,14 +150,13 @@ public sealed class Plugin : IDalamudPlugin
|
|||||||
collection.AddScoped((s) => new CommandManagerService(commandManager, s.GetRequiredService<PerformanceCollectorService>(),
|
collection.AddScoped((s) => new CommandManagerService(commandManager, s.GetRequiredService<PerformanceCollectorService>(),
|
||||||
s.GetRequiredService<ServerConfigurationManager>(), s.GetRequiredService<CacheMonitor>(), s.GetRequiredService<ApiController>(),
|
s.GetRequiredService<ServerConfigurationManager>(), s.GetRequiredService<CacheMonitor>(), s.GetRequiredService<ApiController>(),
|
||||||
s.GetRequiredService<MareMediator>(), s.GetRequiredService<MareConfigService>()));
|
s.GetRequiredService<MareMediator>(), s.GetRequiredService<MareConfigService>()));
|
||||||
collection.AddScoped((s) => new NotificationService(s.GetRequiredService<ILogger<NotificationService>>(),
|
|
||||||
s.GetRequiredService<MareMediator>(), notificationManager, chatGui, s.GetRequiredService<MareConfigService>()));
|
|
||||||
collection.AddScoped((s) => new UiSharedService(s.GetRequiredService<ILogger<UiSharedService>>(), s.GetRequiredService<IpcManager>(), s.GetRequiredService<ApiController>(),
|
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>(),
|
s.GetRequiredService<CacheMonitor>(), s.GetRequiredService<FileDialogManager>(), s.GetRequiredService<MareConfigService>(), s.GetRequiredService<DalamudUtilService>(),
|
||||||
pluginInterface, textureProvider, s.GetRequiredService<Dalamud.Localization>(), s.GetRequiredService<ServerConfigurationManager>(), s.GetRequiredService<MareMediator>()));
|
pluginInterface, textureProvider, s.GetRequiredService<Dalamud.Localization>(), s.GetRequiredService<ServerConfigurationManager>(), s.GetRequiredService<MareMediator>()));
|
||||||
|
|
||||||
collection.AddHostedService(p => p.GetRequiredService<FileCacheManager>());
|
|
||||||
collection.AddHostedService(p => p.GetRequiredService<MareMediator>());
|
collection.AddHostedService(p => p.GetRequiredService<MareMediator>());
|
||||||
|
collection.AddHostedService(p => p.GetRequiredService<NotificationService>());
|
||||||
|
collection.AddHostedService(p => p.GetRequiredService<FileCacheManager>());
|
||||||
collection.AddHostedService(p => p.GetRequiredService<ConfigurationMigrator>());
|
collection.AddHostedService(p => p.GetRequiredService<ConfigurationMigrator>());
|
||||||
collection.AddHostedService(p => p.GetRequiredService<DalamudUtilService>());
|
collection.AddHostedService(p => p.GetRequiredService<DalamudUtilService>());
|
||||||
collection.AddHostedService(p => p.GetRequiredService<PerformanceCollectorService>());
|
collection.AddHostedService(p => p.GetRequiredService<PerformanceCollectorService>());
|
||||||
|
|||||||
@@ -4,12 +4,13 @@ using Dalamud.Plugin.Services;
|
|||||||
using MareSynchronos.MareConfiguration;
|
using MareSynchronos.MareConfiguration;
|
||||||
using MareSynchronos.MareConfiguration.Models;
|
using MareSynchronos.MareConfiguration.Models;
|
||||||
using MareSynchronos.Services.Mediator;
|
using MareSynchronos.Services.Mediator;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using NotificationType = MareSynchronos.MareConfiguration.Models.NotificationType;
|
using NotificationType = MareSynchronos.MareConfiguration.Models.NotificationType;
|
||||||
|
|
||||||
namespace MareSynchronos.Services;
|
namespace MareSynchronos.Services;
|
||||||
|
|
||||||
public class NotificationService : DisposableMediatorSubscriberBase
|
public class NotificationService : DisposableMediatorSubscriberBase, IHostedService
|
||||||
{
|
{
|
||||||
private readonly INotificationManager _notificationManager;
|
private readonly INotificationManager _notificationManager;
|
||||||
private readonly IChatGui _chatGui;
|
private readonly IChatGui _chatGui;
|
||||||
@@ -21,8 +22,17 @@ public class NotificationService : DisposableMediatorSubscriberBase
|
|||||||
_notificationManager = notificationManager;
|
_notificationManager = notificationManager;
|
||||||
_chatGui = chatGui;
|
_chatGui = chatGui;
|
||||||
_configurationService = configurationService;
|
_configurationService = configurationService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task StartAsync(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
Mediator.Subscribe<NotificationMessage>(this, ShowNotification);
|
Mediator.Subscribe<NotificationMessage>(this, ShowNotification);
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task StopAsync(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PrintErrorChat(string? message)
|
private void PrintErrorChat(string? message)
|
||||||
|
|||||||
@@ -203,6 +203,8 @@ public sealed class XivDataAnalyzer
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
_configService.Current.TriangleDictionary[hash] = 0;
|
||||||
|
_configService.Save();
|
||||||
_logger.LogWarning(e, "Could not parse file {file}", filePath);
|
_logger.LogWarning(e, "Could not parse file {file}", filePath);
|
||||||
return Task.FromResult((long)0);
|
return Task.FromResult((long)0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user