Seperated pair tags and syncshell tags, added function to be able to add syncshell tags.

This commit is contained in:
CakeAndBanana
2025-09-07 15:28:19 +02:00
parent b177dbd595
commit 806a4baf1a
9 changed files with 75 additions and 35 deletions

View File

@@ -23,15 +23,17 @@ public class ServerConfigurationManager
private readonly ILogger<ServerConfigurationManager> _logger;
private readonly LightlessMediator _lightlessMediator;
private readonly NotesConfigService _notesConfig;
private readonly ServerTagConfigService _serverTagConfig;
private readonly PairTagConfigService _pairTagConfig;
private readonly SyncshellTagConfigService _syncshellTagConfig;
public ServerConfigurationManager(ILogger<ServerConfigurationManager> logger, ServerConfigService configService,
ServerTagConfigService serverTagConfig, NotesConfigService notesConfig, DalamudUtilService dalamudUtil,
PairTagConfigService pairTagConfig, SyncshellTagConfigService syncshellTagConfig, NotesConfigService notesConfig, DalamudUtilService dalamudUtil,
LightlessConfigService lightlessConfigService, HttpClient httpClient, LightlessMediator lightlessMediator)
{
_logger = logger;
_configService = configService;
_serverTagConfig = serverTagConfig;
_pairTagConfig = pairTagConfig;
_syncshellTagConfig = syncshellTagConfig;
_notesConfig = notesConfig;
_dalamudUtil = dalamudUtil;
_lightlessConfigService = lightlessConfigService;
@@ -285,7 +287,7 @@ public class ServerConfigurationManager
internal void AddOpenPairTag(string tag)
{
CurrentServerTagStorage().OpenPairTags.Add(tag);
_serverTagConfig.Save();
_pairTagConfig.Save();
}
internal void AddServer(ServerStorage serverStorage)
@@ -294,10 +296,17 @@ public class ServerConfigurationManager
Save();
}
internal void AddTag(string tag)
internal void AddPairTag(string tag)
{
CurrentServerTagStorage().ServerAvailablePairTags.Add(tag);
_serverTagConfig.Save();
_pairTagConfig.Save();
_lightlessMediator.Publish(new RefreshUiMessage());
}
internal void AddSyncshellTag(string tag)
{
CurrentServerTagStorage().ServerAvailableSyncshellTags.Add(tag);
_pairTagConfig.Save();
_lightlessMediator.Publish(new RefreshUiMessage());
}
@@ -313,7 +322,7 @@ public class ServerConfigurationManager
CurrentServerTagStorage().UidServerPairedUserTags[uid] = [tagName];
}
_serverTagConfig.Save();
_pairTagConfig.Save();
}
internal bool ContainsOpenPairTag(string tag)
@@ -369,6 +378,11 @@ public class ServerConfigurationManager
return CurrentServerTagStorage().ServerAvailablePairTags;
}
internal HashSet<string> GetServerAvailableSyncshellTags()
{
return CurrentServerTagStorage().ServerAvailableSyncshellTags;
}
internal Dictionary<string, List<string>> GetUidServerPairedUserTags()
{
return CurrentServerTagStorage().UidServerPairedUserTags;
@@ -399,7 +413,7 @@ public class ServerConfigurationManager
internal void RemoveOpenPairTag(string tag)
{
CurrentServerTagStorage().OpenPairTags.Remove(tag);
_serverTagConfig.Save();
_pairTagConfig.Save();
}
internal void RemoveTag(string tag)
@@ -409,7 +423,7 @@ public class ServerConfigurationManager
{
RemoveTagForUid(uid, tag, save: false);
}
_serverTagConfig.Save();
_pairTagConfig.Save();
_lightlessMediator.Publish(new RefreshUiMessage());
}
@@ -421,7 +435,7 @@ public class ServerConfigurationManager
if (save)
{
_serverTagConfig.Save();
_pairTagConfig.Save();
_lightlessMediator.Publish(new RefreshUiMessage());
}
}
@@ -479,7 +493,7 @@ public class ServerConfigurationManager
private ServerTagStorage CurrentServerTagStorage()
{
TryCreateCurrentServerTagStorage();
return _serverTagConfig.Current.ServerTagStorage[CurrentApiUrl];
return _pairTagConfig.Current.ServerTagStorage[CurrentApiUrl];
}
private void EnsureMainExists()
@@ -501,9 +515,9 @@ public class ServerConfigurationManager
private void TryCreateCurrentServerTagStorage()
{
if (!_serverTagConfig.Current.ServerTagStorage.ContainsKey(CurrentApiUrl))
if (!_pairTagConfig.Current.ServerTagStorage.ContainsKey(CurrentApiUrl))
{
_serverTagConfig.Current.ServerTagStorage[CurrentApiUrl] = new();
_pairTagConfig.Current.ServerTagStorage[CurrentApiUrl] = new();
}
}