private void UpdateTags(TagAction action, IReadOnlyCollection <string> hashes, string tag) { _lock.Write(() => { var touched = new List <ItemPreviewModel>(); foreach (var hash in hashes) { if (_previewModels.TryGetValue(hash, out var item)) { if (action == TagAction.Add) { item.Tags.Add(tag); _tagManager.Add(tag); } else { item.Tags.Remove(tag); } touched.Add(item); } } _previewStreams.ForEach(s => s.Update(touched)); }); }
private void UpdateTags(TagAction action, IEnumerable <string> hashes, string tag) { WriteLocked(() => { foreach (var hash in hashes) { if (_previewModels.TryGetValue(hash, out var item)) { if (action == TagAction.Add) { item.Tags.Add(tag); _trie.Insert(tag); } else { item.Tags.Remove(tag); } } } }); }