add multi chracter key checks

This commit is contained in:
Stanley Dimant
2024-07-19 11:45:38 +02:00
committed by Loporrit
parent d9d10c42de
commit 0228c2343b
7 changed files with 35 additions and 16 deletions

View File

@@ -54,7 +54,7 @@ public class ServerConfigurationManager
}
}
public string? GetSecretKey(int serverIdx = -1)
public string? GetSecretKey(out bool hasMulti, int serverIdx = -1)
{
ServerStorage? currentServer;
currentServer = serverIdx == -1 ? CurrentServer : GetServerByIndex(serverIdx);
@@ -63,6 +63,7 @@ public class ServerConfigurationManager
currentServer = new();
Save();
}
hasMulti = false;
var charaName = _dalamudUtil.GetPlayerNameAsync().GetAwaiter().GetResult();
var worldId = _dalamudUtil.GetHomeWorldIdAsync().GetAwaiter().GetResult();
@@ -81,11 +82,11 @@ public class ServerConfigurationManager
var auth = currentServer.Authentications.FindAll(f => string.Equals(f.CharacterName, charaName, StringComparison.Ordinal) && f.WorldId == worldId);
if (auth.Count >= 2)
{
_mareMediator.Publish(new NotificationMessage("Multiple Identical Characters detected", "Your Service configuration has multiple characters with the same name and world set up. Please delete the duplicates in the character configuration.",
NotificationType.Error));
_logger.LogTrace("GetSecretKey accessed, returning null because multiple ({count}) identical characters.", auth.Count);
hasMulti = true;
return null;
}
if (auth.Count == 0)
{
_logger.LogTrace("GetSecretKey accessed, returning null because no set up characters for {chara} on {world}", charaName, worldId);