Merge pull request #53 from rootdarkarchon/main

Change RevertableDesigns Dictionary to ConcurrentDictionary
This commit is contained in:
Ottermandias 2022-07-27 10:01:09 +02:00 committed by GitHub
commit 7b2ea0273c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,11 +1,12 @@
using System.Collections.Generic; using System.Collections.Concurrent;
using System.Collections.Generic;
using Dalamud.Game.ClientState.Objects.Types; using Dalamud.Game.ClientState.Objects.Types;
namespace Glamourer.Designs namespace Glamourer.Designs
{ {
public class RevertableDesigns public class RevertableDesigns
{ {
public readonly Dictionary<string, CharacterSave> Saves = new(); public readonly ConcurrentDictionary<string, CharacterSave> Saves = new();
public bool Add(Character actor) public bool Add(Character actor)
{ {
@ -24,7 +25,7 @@ namespace Glamourer.Designs
if (!Saves.ContainsKey(actorName)) if (!Saves.ContainsKey(actorName))
return false; return false;
Saves.Remove(actorName); Saves.Remove(actorName, out _);
return true; return true;
} }
@ -34,7 +35,7 @@ namespace Glamourer.Designs
return false; return false;
save.Apply(actor); save.Apply(actor);
Saves.Remove(actor.Name.ToString()); Saves.Remove(actor.Name.ToString(), out _);
return true; return true;
} }
} }