Ejemplo n.º 1
0
        protected static List <Artist> SearchArtistsByGenre(string genre, List <Genre> genres, List <Artist> artists)
        {
            List <Artist> result = new List <Artist>();

            Genre foundGenre = null;

            foreach (var gen in genres)
            {
                if (Comparator.IgnoreCaseCompare(gen.ToString(), genre))
                {
                    foundGenre = gen;
                }
            }

            if (foundGenre == null)
            {
                throw new KeyNotFoundException();
            }

            foreach (var artist in artists)
            {
                foreach (var album in artist.AlbumList)
                {
                    if (album.Genre.IsSubgenreOf(foundGenre))
                    {
                        result.Add(artist);
                        break;
                    }
                }
            }

            return(result);
        }
Ejemplo n.º 2
0
        private Genre GetGenre(string name)
        {
            foreach (var genre in genres)
            {
                if (Comparator.IgnoreCaseCompare(genre.ToString(), name))
                {
                    return(genre);
                }
            }

            return(null);
        }
Ejemplo n.º 3
0
        private Artist GetArtist(string name)
        {
            foreach (var artist in data)
            {
                if (Comparator.IgnoreCaseCompare(artist.ToString(), name))
                {
                    return(artist);
                }
            }

            return(null);
        }
Ejemplo n.º 4
0
        private TrackCompilation GetTrackCompilation(string name)
        {
            foreach (var compil in trackCompilations)
            {
                if (Comparator.IgnoreCaseCompare(compil.Name, name))
                {
                    return(compil);
                }
            }

            return(null);
        }
Ejemplo n.º 5
0
        private bool HasGenre(Genre genre)
        {
            foreach (var gen in Genres)
            {
                if (Comparator.IgnoreCaseCompare(gen.ToString(), genre.ToString()))
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
0
        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);
        }
Ejemplo n.º 11
0
        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);
            }
        }
Ejemplo n.º 12
0
        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);
        }