Exemplo n.º 1
0
        public static IList <String> GetAllMatchingFiles(this IMusicByTags musicByTags)
        {
            try
            {
                var db = Ares.Tags.TagsModule.GetTagsDB().ReadInterface;
                switch (musicByTags.TagCategoryCombination)
                {
                case TagCategoryCombination.UseOneTagOfEachCategory:
                    return(db.GetAllFilesWithAnyTagInEachCategory(musicByTags.GetTags()));

                case TagCategoryCombination.UseAnyTag:
                    return(db.GetAllFilesWithAnyTag(musicByTags.GetAllTags()));

                case TagCategoryCombination.UseAllTags:
                default:
                    return(db.GetAllFilesWithAllTags(musicByTags.GetAllTags()));
                }
            }
            catch (Ares.Tags.TagsDbException)
            {
                return(new List <String>());
            }
        }
Exemplo n.º 2
0
        private void UpdateTagsBox(ITagsDBReadByLanguage tagsRead)
        {
            tagsBox.BeginUpdate();
            tagsBox.Items.Clear();
            if (m_SelectedCategoryId >= 0)
            {
                m_Tags = tagsRead.GetAllTags(m_SelectedCategoryId);
            }
            else
            {
                IList <TagInfoForLanguage> allTags = tagsRead.GetAllTags();
                m_Tags = new List <TagForLanguage>(allTags.Count);
                foreach (TagInfoForLanguage tagInfo in allTags)
                {
                    m_Tags.Add(new TagForLanguage()
                    {
                        Name = tagInfo.Name, Id = tagInfo.Id
                    });
                }
            }
            HashSet <int> selectedTags = new HashSet <int>();

            if (m_Element != null)
            {
                selectedTags.UnionWith(m_Element.GetAllTags());
            }
            foreach (TagForLanguage tag in m_Tags)
            {
                tagsBox.Items.Add(tag.Name);

                if (selectedTags.Contains(tag.Id))
                {
                    tagsBox.SetItemCheckState(tagsBox.Items.Count - 1, CheckState.Checked);
                }
            }
            tagsBox.Enabled = (m_Element != null);
            tagsBox.EndUpdate();
        }