Exemple #1
0
        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));
            });
        }
Exemple #2
0
 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);
                 }
             }
         }
     });
 }