public Collection <string> GetGenreList(int appId, int depth, bool tagFallback) { if (!Contains(appId, out DatabaseEntry entry)) { return(new Collection <string>()); } Collection <string> result = entry.Genres ?? new Collection <string>(); if (tagFallback && result.Count == 0) { Collection <string> tags = GetTagList(appId, 0); if (tags != null && tags.Count > 0) { result = new Collection <string>(tags.Where(tag => AllGenres.Contains(tag)).ToList()); } } if (result.Count == 0 && depth > 0 && entry.ParentId > 0) { result = GetGenreList(entry.ParentId, depth - 1, tagFallback); } return(result); }
public TagEditorViewModel(LocalTrack track, Window baseWindow) { TagFile = File.Create(track.Path); Track = track; baseWindow.Closed += (s, e) => TagFile.Dispose(); _baseWindow = baseWindow; AllGenres = Genres.Audio.ToList(); AllGenres.AddRange(Enum.GetValues(typeof(Genre)).Cast <Genre>().Select(PlayableBase.GenreToString).Where(x => !AllGenres.Contains(x))); AllGenres.Sort(); SelectedGenres = track.Genres.Select(PlayableBase.GenreToString).ToList(); }