Пример #1
0
 public void SetElement(IMusicByTags element, IProject project)
 {
     m_Project = project;
     if (m_Element != null)
     {
         Ares.Editor.Actions.ElementChanges.Instance.RemoveListener(m_Element.Id, Update);
     }
     m_Element = element;
     if (m_Element != null)
     {
         Ares.Editor.Actions.ElementChanges.Instance.AddListener(m_Element.Id, Update);
         this.Text = m_Element.Title;
     }
     m_LanguageId = project.TagLanguageId;
     if (m_LanguageId == -1)
     {
         try
         {
             m_LanguageId = Ares.Tags.TagsModule.GetTagsDB().TranslationsInterface.GetIdOfCurrentUILanguage();
         }
         catch (Ares.Tags.TagsDbException)
         {
         }
     }
     UpdateControls();
 }
Пример #2
0
 public void VisitMusicByTags(IMusicByTags musicByTags)
 {
     foreach (String file in musicByTags.GetAllMatchingFiles())
     {
         IFileElement element = Ares.Data.DataModule.ElementFactory.CreateFileElement(file, SoundFileType.Music);
         element.Visit(this);
     }
 }
Пример #3
0
        public RemoveAllTagsFromMusicByTagsAction(IMusicByTags element)
        {
            m_Element = element;
            m_OldTags = new Dictionary <int, HashSet <int> >();
            IDictionary <int, HashSet <int> > oldTags = element.GetTags();

            foreach (int category in oldTags.Keys)
            {
                HashSet <int> tags = new HashSet <int>();
                tags.UnionWith(oldTags[category]);
                m_OldTags[category] = tags;
            }
        }
Пример #4
0
 public void VisitMusicByTags(IMusicByTags musicByTags)
 {
     if (m_CurrentModeElement != null)
     {
         foreach (String file in musicByTags.GetAllMatchingFiles())
         {
             if (GetAbsolutePath(file, SoundFileType.Music).Equals(m_SearchedPath, StringComparison.InvariantCultureIgnoreCase))
             {
                 m_CurrentList.Add(m_CurrentModeElement);
                 break;
             }
         }
     }
 }
Пример #5
0
        public void VisitMusicByTags(IMusicByTags musicByTags)
        {
            // ignore missing tags here, because there is no way to remove them in the GUI anyway

            /*
             * int languageId = m_TagLanguage;
             * if (m_TagLanguage == -1)
             *  m_TagLanguage = Ares.Tags.TagsModule.GetTagsDB().TranslationsInterface.GetIdOfCurrentUILanguage();
             * List<int> tagIds = new List<int>();
             * tagIds.AddRange(musicByTags.GetAllTags());
             * var tagInfos = Ares.Tags.TagsModule.GetTagsDB().GetReadInterfaceByLanguage(m_TagLanguage).GetTagInfos(tagIds);
             * if (tagInfos.Count != tagIds.Count)
             * {
             *  AddError(m_ModelErrors, ModelError.ErrorSeverity.Error, StringResources.TagNotFound, musicByTags);
             * }
             */
        }
Пример #6
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>());
            }
        }
Пример #7
0
 public void VisitMusicByTags(IMusicByTags musicByTags)
 {
     // don't need to check, files are determined dynamically
 }
Пример #8
0
 public void VisitMusicByTags(IMusicByTags musicByTags)
 {
     // needs not be considered here, because the File Element Searcher is only used
     // by the background sounds element, which can't contain a MusicByTags element
 }
Пример #9
0
 public RemoveTagFromMusicByTagsAction(IMusicByTags element, int categoryId, int tagId)
 {
     m_Element  = element;
     m_Category = categoryId;
     m_Tag      = tagId;
 }
Пример #10
0
 public AddTagToMusicByTagsAction(IMusicByTags element, int categoryId, int tagId)
 {
     m_Element  = element;
     m_Category = categoryId;
     m_Tag      = tagId;
 }
Пример #11
0
 public SetFadeTimeInMusicByTagsAction(IMusicByTags element, int value)
 {
     m_Element  = element;
     m_OldValue = element.FadeTime;
     m_NewValue = value;
 }
Пример #12
0
 public SetOperatorInMusicByTagsAction(IMusicByTags element, Ares.Data.TagCategoryCombination categoryCombination)
 {
     m_Element  = element;
     m_OldValue = element.TagCategoryCombination;
     m_NewValue = categoryCombination;
 }