protected static List <Track> SearchTracksByName(string name, List <Track> tracks) { List <Track> result = new List <Track>(); foreach (var track in tracks) { if (Comparator.IgnoreCaseCompare(track.name, name)) { result.Add(track); } } return(result); }
protected static List <Artist> SearchArtistsByName(string name, List <Artist> artists) { List <Artist> result = new List <Artist>(); foreach (var artist in artists) { if (Comparator.IgnoreCaseCompare(artist.ToString(), name)) { result.Add(artist); } } return(result); }
protected static List <Album> SearchAlbumsByName(string name, List <Album> albums) { List <Album> result = new List <Album>(); foreach (var album in albums) { if (Comparator.IgnoreCaseCompare(album.Name, name)) { result.Add(album); } } return(result); }
protected static List <TrackCompilation> SearchTrackCompilationsByArtist(string artist, List <TrackCompilation> trackCompilations) { List <TrackCompilation> tc = new List <TrackCompilation>(); foreach (var compil in trackCompilations) { foreach (var art in compil.Artists) { if (Comparator.IgnoreCaseCompare(art.ToString(), artist)) { tc.Add(compil); } } } return(tc); }
protected static List <TrackCompilation> SearchTrackCompilationsByGenre(string genre, List <TrackCompilation> trackCompilations) { List <TrackCompilation> tc = new List <TrackCompilation>(); foreach (var compil in trackCompilations) { foreach (var gen in compil.Genres) { if (Comparator.IgnoreCaseCompare(gen.ToString(), genre)) { tc.Add(compil); } } } return(tc); }
protected static List <Track> SearchTracksByGenre(string genre, List <Genre> genres, List <Track> tracks) { List <Track> result = new List <Track>(); bool cathedEx = false; try { Genre foundGenre = null; foreach (var gen in genres) { if (Comparator.IgnoreCaseCompare(gen.ToString(), genre)) { foundGenre = gen; } } if (foundGenre == null) { throw new KeyNotFoundException(); } foreach (var track in tracks) { if (track.Album.Genre.IsSubgenreOf(foundGenre)) { result.Add(track); } } } catch (Exception) { cathedEx = true; } if (cathedEx) { throw new KeyNotFoundException(); } else { return(result); } }
protected static List <Track> SearchTracksByName(string name, List <Artist> artists) { List <Track> result = new List <Track>(); foreach (var artist in artists) { foreach (var album in artist.AlbumList) { foreach (var track in album.TrackList) { if (Comparator.IgnoreCaseCompare(track.name, name)) { result.Add(track); } } } } return(result); }