diff --git a/MareSynchronos/MareSynchronos.csproj b/MareSynchronos/MareSynchronos.csproj
index 430cb13..ab4c315 100644
--- a/MareSynchronos/MareSynchronos.csproj
+++ b/MareSynchronos/MareSynchronos.csproj
@@ -33,21 +33,21 @@
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
+
+
+
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/MareSynchronos/PlayerData/Pairs/PairManager.cs b/MareSynchronos/PlayerData/Pairs/PairManager.cs
index dac32ef..2b99b0c 100644
--- a/MareSynchronos/PlayerData/Pairs/PairManager.cs
+++ b/MareSynchronos/PlayerData/Pairs/PairManager.cs
@@ -147,7 +147,7 @@ public sealed class PairManager : DisposableMediatorSubscriberBase
var msg = !string.IsNullOrEmpty(note)
? $"{note} ({pair.UserData.AliasOrUID}) is now online"
: $"{pair.UserData.AliasOrUID} is now online";
- Mediator.Publish(new NotificationMessage("User online", msg, NotificationType.Info, 5000));
+ Mediator.Publish(new NotificationMessage("User online", msg, NotificationType.Info, TimeSpan.FromSeconds(5)));
}
pair.CreateCachedPlayer(dto);
diff --git a/MareSynchronos/Plugin.cs b/MareSynchronos/Plugin.cs
index 12faadb..41ccbbe 100644
--- a/MareSynchronos/Plugin.cs
+++ b/MareSynchronos/Plugin.cs
@@ -36,7 +36,7 @@ public sealed class Plugin : IDalamudPlugin
public Plugin(DalamudPluginInterface pluginInterface, ICommandManager commandManager, IDataManager gameData,
IFramework framework, IObjectTable objectTable, IClientState clientState, ICondition condition, IChatGui chatGui,
- IGameGui gameGui, IDtrBar dtrBar, IPluginLog pluginLog, ITargetManager targetManager)
+ IGameGui gameGui, IDtrBar dtrBar, IPluginLog pluginLog, ITargetManager targetManager, INotificationManager notificationManager)
{
_hostBuilderRunTask = new HostBuilder()
.UseContentRoot(pluginInterface.ConfigDirectory.FullName)
@@ -150,7 +150,7 @@ public sealed class Plugin : IDalamudPlugin
s.GetRequiredService(), s.GetRequiredService(), s.GetRequiredService(),
s.GetRequiredService(), s.GetRequiredService()));
collection.AddScoped((s) => new NotificationService(s.GetRequiredService>(),
- s.GetRequiredService(), pluginInterface.UiBuilder, chatGui, s.GetRequiredService()));
+ s.GetRequiredService(), notificationManager, chatGui, s.GetRequiredService()));
collection.AddScoped((s) => new UiSharedService(s.GetRequiredService>(), s.GetRequiredService(), s.GetRequiredService(),
s.GetRequiredService(), s.GetRequiredService(), s.GetRequiredService(), s.GetRequiredService(),
pluginInterface, s.GetRequiredService(), s.GetRequiredService(), s.GetRequiredService()));
diff --git a/MareSynchronos/Services/Mediator/Messages.cs b/MareSynchronos/Services/Mediator/Messages.cs
index 69d34e0..6bd9633 100644
--- a/MareSynchronos/Services/Mediator/Messages.cs
+++ b/MareSynchronos/Services/Mediator/Messages.cs
@@ -48,7 +48,7 @@ public record TransientResourceChangedMessage(IntPtr Address) : MessageBase;
public record HaltScanMessage(string Source) : MessageBase;
public record ResumeScanMessage(string Source) : MessageBase;
public record NotificationMessage
- (string Title, string Message, NotificationType Type, uint TimeShownOnScreen = 3000) : MessageBase;
+ (string Title, string Message, NotificationType Type, TimeSpan? TimeShownOnScreen = null) : MessageBase;
public record CreateCacheForObjectMessage(GameObjectHandler ObjectToCreateFor) : MessageBase;
public record ClearCacheForObjectMessage(GameObjectHandler ObjectToCreateFor) : MessageBase;
public record CharacterDataCreatedMessage(CharacterData CharacterData) : SameThreadMessage;
diff --git a/MareSynchronos/Services/NotificationService.cs b/MareSynchronos/Services/NotificationService.cs
index b940029..c8f58e0 100644
--- a/MareSynchronos/Services/NotificationService.cs
+++ b/MareSynchronos/Services/NotificationService.cs
@@ -11,13 +11,13 @@ namespace MareSynchronos.Services;
public class NotificationService : DisposableMediatorSubscriberBase
{
+ private readonly INotificationManager _notificationManager;
private readonly IChatGui _chatGui;
private readonly MareConfigService _configurationService;
- private readonly UiBuilder _uiBuilder;
- public NotificationService(ILogger logger, MareMediator mediator, UiBuilder uiBuilder, IChatGui chatGui, MareConfigService configurationService) : base(logger, mediator)
+ public NotificationService(ILogger logger, MareMediator mediator, INotificationManager notificationManager, IChatGui chatGui, MareConfigService configurationService) : base(logger, mediator)
{
- _uiBuilder = uiBuilder;
+ _notificationManager = notificationManager;
_chatGui = chatGui;
_configurationService = configurationService;
@@ -108,6 +108,13 @@ public class NotificationService : DisposableMediatorSubscriberBase
private void ShowToast(NotificationMessage msg)
{
- _uiBuilder.AddNotification(msg.Message ?? string.Empty, "[Mare Synchronos] " + msg.Title, msg.Type, msg.TimeShownOnScreen);
+ _notificationManager.AddNotification(new Dalamud.Interface.ImGuiNotification.Notification()
+ {
+ Content = msg.Message ?? string.Empty,
+ Title = msg.Title,
+ Type = msg.Type,
+ Minimized = false,
+ InitialDuration = msg.TimeShownOnScreen ?? TimeSpan.FromSeconds(3)
+ });
}
}
\ No newline at end of file
diff --git a/MareSynchronos/Services/PluginWarningNotificationService.cs b/MareSynchronos/Services/PluginWarningNotificationService.cs
index 4a7ce48..3b341cd 100644
--- a/MareSynchronos/Services/PluginWarningNotificationService.cs
+++ b/MareSynchronos/Services/PluginWarningNotificationService.cs
@@ -63,7 +63,7 @@ public class PluginWarningNotificationService
{
_mediator.Publish(new NotificationMessage("Missing plugins for " + playerName,
$"Received data for {playerName} that contained information for plugins you have not installed. Install {string.Join(", ", missingPluginsForData)} to experience their character fully.",
- NotificationType.Warning, 10000));
+ NotificationType.Warning, TimeSpan.FromSeconds(10)));
}
}
}
\ No newline at end of file
diff --git a/MareSynchronos/UI/EditProfileUi.cs b/MareSynchronos/UI/EditProfileUi.cs
index 5a32db9..f45863d 100644
--- a/MareSynchronos/UI/EditProfileUi.cs
+++ b/MareSynchronos/UI/EditProfileUi.cs
@@ -10,6 +10,8 @@ using MareSynchronos.Services;
using MareSynchronos.Services.Mediator;
using MareSynchronos.WebAPI;
using Microsoft.Extensions.Logging;
+using SixLabors.ImageSharp;
+using SixLabors.ImageSharp.PixelFormats;
namespace MareSynchronos.UI;
diff --git a/MareSynchronos/Utils/Crypto.cs b/MareSynchronos/Utils/Crypto.cs
index 3353891..d48dcba 100644
--- a/MareSynchronos/Utils/Crypto.cs
+++ b/MareSynchronos/Utils/Crypto.cs
@@ -7,11 +7,9 @@ public static class Crypto
{
#pragma warning disable SYSLIB0021 // Type or member is obsolete
- private static readonly Dictionary _hashListSHA1 = new(StringComparer.Ordinal);
private static readonly Dictionary<(string, ushort), string> _hashListPlayersSHA256 = new();
private static readonly Dictionary _hashListSHA256 = new(StringComparer.Ordinal);
private static readonly SHA256CryptoServiceProvider _sha256CryptoProvider = new();
- private static readonly SHA1CryptoServiceProvider _sha1CryptoProvider = new();
public static string GetFileHash(this string filePath)
{
@@ -19,11 +17,6 @@ public static class Crypto
return BitConverter.ToString(cryptoProvider.ComputeHash(File.ReadAllBytes(filePath))).Replace("-", "", StringComparison.Ordinal);
}
- public static string GetHash(this string stringToHash)
- {
- return GetOrComputeHashSHA1(stringToHash);
- }
-
public static string GetHash256(this (string, ushort) playerToHash)
{
if (_hashListPlayersSHA256.TryGetValue(playerToHash, out var hash))
@@ -46,14 +39,5 @@ public static class Crypto
return _hashListSHA256[stringToCompute] =
BitConverter.ToString(_sha256CryptoProvider.ComputeHash(Encoding.UTF8.GetBytes(stringToCompute))).Replace("-", "", StringComparison.Ordinal);
}
-
- private static string GetOrComputeHashSHA1(string stringToCompute)
- {
- if (_hashListSHA1.TryGetValue(stringToCompute, out var hash))
- return hash;
-
- return _hashListSHA1[stringToCompute] =
- BitConverter.ToString(_sha1CryptoProvider.ComputeHash(Encoding.UTF8.GetBytes(stringToCompute))).Replace("-", "", StringComparison.Ordinal);
- }
#pragma warning restore SYSLIB0021 // Type or member is obsolete
}
\ No newline at end of file
diff --git a/MareSynchronos/WebAPI/SignalR/ApiController.Functions.Callbacks.cs b/MareSynchronos/WebAPI/SignalR/ApiController.Functions.Callbacks.cs
index a17d13b..0252521 100644
--- a/MareSynchronos/WebAPI/SignalR/ApiController.Functions.Callbacks.cs
+++ b/MareSynchronos/WebAPI/SignalR/ApiController.Functions.Callbacks.cs
@@ -83,11 +83,11 @@ public partial class ApiController
switch (messageSeverity)
{
case MessageSeverity.Error:
- Mediator.Publish(new NotificationMessage("Warning from " + _serverManager.CurrentServer!.ServerName, message, NotificationType.Error, 7500));
+ Mediator.Publish(new NotificationMessage("Warning from " + _serverManager.CurrentServer!.ServerName, message, NotificationType.Error, TimeSpan.FromSeconds(7.5)));
break;
case MessageSeverity.Warning:
- Mediator.Publish(new NotificationMessage("Warning from " + _serverManager.CurrentServer!.ServerName, message, NotificationType.Warning, 7500));
+ Mediator.Publish(new NotificationMessage("Warning from " + _serverManager.CurrentServer!.ServerName, message, NotificationType.Warning, TimeSpan.FromSeconds(7.5)));
break;
case MessageSeverity.Information:
@@ -96,7 +96,7 @@ public partial class ApiController
_doNotNotifyOnNextInfo = false;
break;
}
- Mediator.Publish(new NotificationMessage("Info from " + _serverManager.CurrentServer!.ServerName, message, NotificationType.Info, 5000));
+ Mediator.Publish(new NotificationMessage("Info from " + _serverManager.CurrentServer!.ServerName, message, NotificationType.Info, TimeSpan.FromSeconds(5)));
break;
}
diff --git a/MareSynchronos/WebAPI/SignalR/ApiController.cs b/MareSynchronos/WebAPI/SignalR/ApiController.cs
index 2776078..b3e408b 100644
--- a/MareSynchronos/WebAPI/SignalR/ApiController.cs
+++ b/MareSynchronos/WebAPI/SignalR/ApiController.cs
@@ -211,7 +211,7 @@ public sealed partial class ApiController : DisposableMediatorSubscriberBase, IM
Mediator.Publish(new NotificationMessage("Modified Game Files detected",
"Mare has detected modified game files in your FFXIV installation. You will be able to connect, but the synchronization functionality might be (partially) broken. " +
"Exit the game and repair it through XIVLauncher to get rid of this message.",
- Dalamud.Interface.Internal.Notifications.NotificationType.Error));
+ Dalamud.Interface.Internal.Notifications.NotificationType.Error, TimeSpan.FromSeconds(15)));
}
await LoadIninitialPairs().ConfigureAwait(false);
diff --git a/MareSynchronos/WebAPI/SignalR/Utils/ForeverRetryPolicy.cs b/MareSynchronos/WebAPI/SignalR/Utils/ForeverRetryPolicy.cs
index bebadce..80b2343 100644
--- a/MareSynchronos/WebAPI/SignalR/Utils/ForeverRetryPolicy.cs
+++ b/MareSynchronos/WebAPI/SignalR/Utils/ForeverRetryPolicy.cs
@@ -28,7 +28,7 @@ public class ForeverRetryPolicy : IRetryPolicy
{
if (!_sentDisconnected)
{
- _mediator.Publish(new NotificationMessage("Connection lost", "Connection lost to server", NotificationType.Warning, 5000));
+ _mediator.Publish(new NotificationMessage("Connection lost", "Connection lost to server", NotificationType.Warning, TimeSpan.FromSeconds(10)));
_mediator.Publish(new DisconnectedMessage());
}
_sentDisconnected = true;