Initial Loporrit rebranding

This commit is contained in:
Loporrit
2023-12-11 22:38:13 +00:00
parent 4a04a74701
commit e0ae62ff0d
34 changed files with 156 additions and 121 deletions

View File

@@ -173,7 +173,7 @@ public sealed class CharacterAnalyzer : MediatorSubscriberBase, IDisposable
LastAnalysis.Values.Sum(v => v.Values.Count),
UiSharedService.ByteToString(LastAnalysis.Values.Sum(c => c.Values.Sum(v => v.OriginalSize))),
UiSharedService.ByteToString(LastAnalysis.Values.Sum(c => c.Values.Sum(v => v.CompressedSize))));
Logger.LogInformation("IMPORTANT NOTES:\n\r- For Mare up- and downloads only the compressed size is relevant.\n\r- An unusually high total files count beyond 200 and up will also increase your download time to others significantly.");
Logger.LogInformation("IMPORTANT NOTES:\n\r- For uploads and downloads only the compressed size is relevant.\n\r- An unusually high total files count beyond 200 and up will also increase your download time to others significantly.");
}
internal sealed record FileDataEntry(string Hash, string FileType, List<string> GamePaths, List<string> FilePaths, long OriginalSize, long CompressedSize)

View File

@@ -12,7 +12,8 @@ namespace MareSynchronos.Services;
public sealed class CommandManagerService : IDisposable
{
private const string _commandName = "/mare";
private const string _commandName = "/sync";
private const string _commandName2 = "/loporrit";
private readonly ApiController _apiController;
private readonly ICommandManager _commandManager;
@@ -35,13 +36,18 @@ public sealed class CommandManagerService : IDisposable
_mareConfigService = mareConfigService;
_commandManager.AddHandler(_commandName, new CommandInfo(OnCommand)
{
HelpMessage = "Opens the Mare Synchronos UI"
HelpMessage = "Opens the Loporrit UI"
});
_commandManager.AddHandler(_commandName2, new CommandInfo(OnCommand)
{
HelpMessage = "Opens the Loporrit UI"
});
}
public void Dispose()
{
_commandManager.RemoveHandler(_commandName);
_commandManager.RemoveHandler(_commandName2);
}
private void OnCommand(string command, string args)
@@ -62,7 +68,7 @@ public sealed class CommandManagerService : IDisposable
{
if (_apiController.ServerState == WebAPI.SignalR.Utils.ServerState.Disconnecting)
{
_mediator.Publish(new NotificationMessage("Mare disconnecting", "Cannot use /toggle while Mare Synchronos is still disconnecting",
_mediator.Publish(new NotificationMessage("Loporrit disconnecting", "Cannot use /toggle while Loporrit is still disconnecting",
Dalamud.Interface.Internal.Notifications.NotificationType.Error));
}

View File

@@ -2,6 +2,7 @@
using MareSynchronos.API.Data.Comparer;
using MareSynchronos.MareConfiguration;
using MareSynchronos.Services.Mediator;
using MareSynchronos.Services.ServerConfiguration;
using MareSynchronos.WebAPI;
using Microsoft.Extensions.Logging;
using System.Collections.Concurrent;
@@ -18,6 +19,7 @@ public class MareProfileManager : MediatorSubscriberBase
private const string _nsfw = "Profile not displayed - NSFW";
private readonly ApiController _apiController;
private readonly MareConfigService _mareConfigService;
private readonly ServerConfigurationManager _serverConfigurationManager;
private readonly ConcurrentDictionary<UserData, MareProfileData> _mareProfiles = new(UserDataComparer.Instance);
private readonly MareProfileData _defaultProfileData = new(IsFlagged: false, IsNSFW: false, _mareLogo, string.Empty, _noDescription);
@@ -25,10 +27,11 @@ public class MareProfileManager : MediatorSubscriberBase
private readonly MareProfileData _nsfwProfileData = new(IsFlagged: false, IsNSFW: false, _mareLogoNsfw, string.Empty, _nsfw);
public MareProfileManager(ILogger<MareProfileManager> logger, MareConfigService mareConfigService,
MareMediator mediator, ApiController apiController) : base(logger, mediator)
MareMediator mediator, ApiController apiController, ServerConfigurationManager serverConfigurationManager) : base(logger, mediator)
{
_mareConfigService = mareConfigService;
_apiController = apiController;
_serverConfigurationManager = serverConfigurationManager;
Mediator.Subscribe<ClearProfileDataMessage>(this, (msg) =>
{
@@ -57,9 +60,12 @@ public class MareProfileManager : MediatorSubscriberBase
{
_mareProfiles[data] = _loadingProfileData;
var profile = await _apiController.UserGetProfile(new API.Dto.User.UserDto(data)).ConfigureAwait(false);
bool isSupporter = !string.Equals(data.Alias, data.UID, StringComparison.Ordinal);
if (_serverConfigurationManager.CurrentApiUrl != ApiController.MainServiceUri)
isSupporter = false;
MareProfileData profileData = new(profile.Disabled, profile.IsNSFW ?? false,
string.IsNullOrEmpty(profile.ProfilePictureBase64) ? _mareLogo : profile.ProfilePictureBase64,
!string.IsNullOrEmpty(data.Alias) && !string.Equals(data.Alias, data.UID, StringComparison.Ordinal) ? _mareSupporter : string.Empty,
!string.IsNullOrEmpty(data.Alias) && isSupporter ? _mareSupporter : string.Empty,
string.IsNullOrEmpty(profile.Description) ? _noDescription : profile.Description);
if (profileData.IsNSFW && !_mareConfigService.Current.ProfilesAllowNsfw && !string.Equals(_apiController.UID, data.UID, StringComparison.Ordinal))
{

View File

@@ -26,19 +26,19 @@ public class NotificationService : DisposableMediatorSubscriberBase
private void PrintErrorChat(string? message)
{
SeStringBuilder se = new SeStringBuilder().AddText("[Mare Synchronos] Error: " + message);
SeStringBuilder se = new SeStringBuilder().AddText("[LoporritSync] Error: " + message);
_chatGui.PrintError(se.BuiltString);
}
private void PrintInfoChat(string? message)
{
SeStringBuilder se = new SeStringBuilder().AddText("[Mare Synchronos] Info: ").AddItalics(message ?? string.Empty);
SeStringBuilder se = new SeStringBuilder().AddText("[LoporritSync] Info: ").AddItalics(message ?? string.Empty);
_chatGui.Print(se.BuiltString);
}
private void PrintWarnChat(string? message)
{
SeStringBuilder se = new SeStringBuilder().AddText("[Mare Synchronos] ").AddUiForeground("Warning: " + (message ?? string.Empty), 31).AddUiForegroundOff();
SeStringBuilder se = new SeStringBuilder().AddText("[LoporritSync] ").AddUiForeground("Warning: " + (message ?? string.Empty), 31).AddUiForegroundOff();
_chatGui.Print(se.BuiltString);
}
@@ -108,6 +108,6 @@ public class NotificationService : DisposableMediatorSubscriberBase
private void ShowToast(NotificationMessage msg)
{
_uiBuilder.AddNotification(msg.Message ?? string.Empty, "[Mare Synchronos] " + msg.Title, msg.Type, msg.TimeShownOnScreen);
_uiBuilder.AddNotification(msg.Message ?? string.Empty, "[LoporritSync] " + msg.Title, msg.Type, msg.TimeShownOnScreen);
}
}

View File

@@ -338,9 +338,19 @@ public class ServerConfigurationManager
private void EnsureMainExists()
{
if (_configService.Current.ServerStorage.Count == 0 || !string.Equals(_configService.Current.ServerStorage[0].ServerUri, ApiController.MainServiceUri, StringComparison.OrdinalIgnoreCase))
bool lopExists = false;
bool mainExists = false;
_configService.Current.ServerStorage.ForEach((x) => {
_logger.LogDebug(" server uri = {x.ServerUri}");
if (x.ServerUri.Equals(ApiController.LoporritServiceUri, StringComparison.OrdinalIgnoreCase))
lopExists = true;
else if (x.ServerUri.Equals(ApiController.MainServiceUri, StringComparison.OrdinalIgnoreCase))
mainExists = true;
});
if (!lopExists)
{
_configService.Current.ServerStorage.Insert(0, new ServerStorage() { ServerUri = ApiController.MainServiceUri, ServerName = ApiController.MainServer });
_logger.LogDebug("Re-adding missing server {ApiController.LoporritServiceUri}");
_configService.Current.ServerStorage.Insert(0, new ServerStorage() { ServerUri = ApiController.LoporritServiceUri, ServerName = ApiController.LoporritServer });
}
Save();
}