private void SyncInterestedMarks(string name, ListKind listKind, bool isAdd, bool isTemporary) { lock (Locker) { var isInteresting = listKind == ListKind.Interested; var oppositeList = isInteresting ? notInterested : interested; var sameList = isInteresting ? interested : notInterested; Action <CollectionPair> addRemove = c => { if (isAdd) { c.Add(name, isTemporary); } else { c.Remove(name, isTemporary); } }; if (isAdd) // if we're adding to one, then we have to remove from the other { oppositeList.Remove(name, isTemporary); } // now we do the actual action on the list specified addRemove(sameList); ICharacter toModify; if (CharacterDictionary.TryGetValue(name, out toModify)) { toModify.IsInteresting = (isInteresting && isAdd) || IsOfInterest(name, false); } } }
private void UpdateIgnoreUpdatesMark(string name, bool isAdd) { ICharacter toModify; if (CharacterDictionary.TryGetValue(name, out toModify)) { toModify.IgnoreUpdates = isAdd; } }