Fixed deleting of syncshell tags
This commit is contained in:
@@ -347,10 +347,7 @@ public class ServerConfigurationManager
|
||||
_syncshellTagConfig.Save();
|
||||
}
|
||||
|
||||
internal bool ContainsOpenPairTag(string tag)
|
||||
{
|
||||
return CurrentPairTagStorage().OpenPairTags.Contains(tag);
|
||||
}
|
||||
internal bool ContainsOpenPairTag(string tag) => CurrentPairTagStorage().OpenPairTags.Contains(tag);
|
||||
|
||||
internal bool ContainsPairTag(string uid, string tag)
|
||||
{
|
||||
@@ -405,40 +402,19 @@ public class ServerConfigurationManager
|
||||
return null;
|
||||
}
|
||||
|
||||
internal HashSet<string> GetServerAvailablePairTags()
|
||||
{
|
||||
return CurrentPairTagStorage().ServerAvailablePairTags;
|
||||
}
|
||||
internal HashSet<string> GetServerAvailablePairTags() => CurrentPairTagStorage().ServerAvailablePairTags;
|
||||
|
||||
internal HashSet<string> GetServerAvailableSyncshellTags()
|
||||
{
|
||||
return CurrentSyncshellTagStorage().ServerAvailableSyncshellTags;
|
||||
}
|
||||
internal HashSet<string> GetServerAvailableSyncshellTags() => CurrentSyncshellTagStorage().ServerAvailableSyncshellTags;
|
||||
|
||||
internal Dictionary<string, List<string>> GetUidServerPairedUserTags()
|
||||
{
|
||||
return CurrentPairTagStorage().UidServerPairedUserTags;
|
||||
}
|
||||
internal Dictionary<string, List<string>> GetUidServerPairedUserTags() => CurrentPairTagStorage().UidServerPairedUserTags;
|
||||
|
||||
internal HashSet<string> GetUidsForPairTag(string tag)
|
||||
{
|
||||
return CurrentPairTagStorage().UidServerPairedUserTags.Where(p => p.Value.Contains(tag, StringComparer.Ordinal)).Select(p => p.Key).ToHashSet(StringComparer.Ordinal);
|
||||
}
|
||||
internal HashSet<string> GetUidsForPairTag(string tag) => CurrentPairTagStorage().UidServerPairedUserTags.Where(p => p.Value.Contains(tag, StringComparer.Ordinal)).Select(p => p.Key).ToHashSet(StringComparer.Ordinal);
|
||||
|
||||
internal HashSet<string> GetNamesForSyncshellTag(string tag)
|
||||
{
|
||||
return CurrentSyncshellTagStorage().SyncshellPairedTags.Where(p => p.Value.Contains(tag, StringComparer.Ordinal)).Select(p => p.Key).ToHashSet(StringComparer.Ordinal);
|
||||
}
|
||||
internal HashSet<string> GetNamesForSyncshellTag(string tag) => CurrentSyncshellTagStorage().SyncshellPairedTags.Where(p => p.Value.Contains(tag, StringComparer.Ordinal)).Select(p => p.Key).ToHashSet(StringComparer.Ordinal);
|
||||
|
||||
internal bool HasPairTags(string uid)
|
||||
{
|
||||
return CurrentPairTagStorage().UidServerPairedUserTags.TryGetValue(uid, out var tags) && tags.Count != 0;
|
||||
}
|
||||
internal bool HasPairTags(string uid) => CurrentPairTagStorage().UidServerPairedUserTags.TryGetValue(uid, out var tags) && tags.Count != 0;
|
||||
|
||||
internal bool HasSyncshellTags(string name)
|
||||
{
|
||||
return CurrentSyncshellTagStorage().SyncshellPairedTags.TryGetValue(name, out var tags) && tags.Count != 0;
|
||||
}
|
||||
internal bool HasSyncshellTags(string name) => CurrentSyncshellTagStorage().SyncshellPairedTags.TryGetValue(name, out var tags) && tags.Count != 0;
|
||||
|
||||
internal void RemoveCharacterFromServer(int serverSelectionIndex, Authentication item)
|
||||
{
|
||||
@@ -468,18 +444,29 @@ public class ServerConfigurationManager
|
||||
|
||||
internal void RemoveSyncshellTag(string tag)
|
||||
{
|
||||
RemoveTag(CurrentSyncshellTagStorage().ServerAvailableSyncshellTags, tag);
|
||||
RemoveTag(CurrentSyncshellTagStorage().ServerAvailableSyncshellTags, tag, true);
|
||||
_syncshellTagConfig.Save();
|
||||
_lightlessMediator.Publish(new RefreshUiMessage());
|
||||
}
|
||||
|
||||
internal void RemoveTag(HashSet<string> storage, string tag)
|
||||
internal void RemoveTag(HashSet<string> storage, string tag, bool syncshell = false)
|
||||
{
|
||||
CurrentPairTagStorage().ServerAvailablePairTags.Remove(tag);
|
||||
foreach (var uid in GetUidsForPairTag(tag))
|
||||
storage.Remove(tag);
|
||||
if (syncshell)
|
||||
{
|
||||
RemoveTagForUid(uid, tag, save: false);
|
||||
foreach (var uid in GetNamesForSyncshellTag(tag))
|
||||
{
|
||||
RemoveTagForSyncshell(uid, tag, save: false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var uid in GetUidsForPairTag(tag))
|
||||
{
|
||||
RemoveTagForUid(uid, tag, save: false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal void RemoveTagForUid(string uid, string tagName, bool save = true)
|
||||
@@ -510,15 +497,9 @@ public class ServerConfigurationManager
|
||||
}
|
||||
}
|
||||
|
||||
internal void RenamePairTag(string oldName, string newName)
|
||||
{
|
||||
RenameTag(CurrentPairTagStorage().UidServerPairedUserTags, CurrentPairTagStorage().ServerAvailablePairTags, oldName, newName);
|
||||
}
|
||||
internal void RenamePairTag(string oldName, string newName) => RenameTag(CurrentPairTagStorage().UidServerPairedUserTags, CurrentPairTagStorage().ServerAvailablePairTags, oldName, newName);
|
||||
|
||||
internal void RenameSyncshellTag(string oldName, string newName)
|
||||
{
|
||||
RenameTag(CurrentSyncshellTagStorage().SyncshellPairedTags, CurrentSyncshellTagStorage().ServerAvailableSyncshellTags, oldName, newName);
|
||||
}
|
||||
internal void RenameSyncshellTag(string oldName, string newName) => RenameTag(CurrentSyncshellTagStorage().SyncshellPairedTags, CurrentSyncshellTagStorage().ServerAvailableSyncshellTags, oldName, newName);
|
||||
|
||||
internal void RenameTag(Dictionary<string, List<string>> tags, HashSet<string> storage, string oldName, string newName)
|
||||
{
|
||||
@@ -532,10 +513,7 @@ public class ServerConfigurationManager
|
||||
_lightlessMediator.Publish(new RefreshUiMessage());
|
||||
}
|
||||
|
||||
internal void SaveNotes()
|
||||
{
|
||||
_notesConfig.Save();
|
||||
}
|
||||
internal void SaveNotes() => _notesConfig.Save();
|
||||
|
||||
internal void SetNoteForGid(string gid, string note, bool save = true)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user