Exemple #1
0
        public override int CompareTo(object o)
        {
            if (o is GenreFilteredAlbum)
            {
                GenreFilteredAlbum rhs = o as GenreFilteredAlbum;
                int result             = Genre.CompareTo(rhs.Genre);

                if (result == 0)
                {
                    result = Artist.CompareTo(rhs.Artist);

                    if (result == 0)
                    {
                        result = StringComparer.Ordinal.Compare(Title, rhs.Title);
                    }
                }

                return(result);
            }
            else
            {
                throw new Exception("GenreFilteredAlbum: attempt to compare to an incompatible object");
            }
        }
Exemple #2
0
        private GenreFilteredAlbum GetOrCreateGenreFilteredAlbum(Album album, MPDSongResponseBlock block)
        {
            Genre genre = Genres[block.Genre ?? UnknownGenre];

            if (!m_GenreFilteredAlbumLookup.ContainsKey(genre))
            {
                m_GenreFilteredAlbumLookup[genre] = new SortedDictionary<Album, GenreFilteredAlbum>();
            }

            IDictionary<Album, GenreFilteredAlbum> albumList = m_GenreFilteredAlbumLookup[genre];

            if (!albumList.ContainsKey(album))
            {
                string directory = new Path(block.File).Directories.Last();
                GenreFilteredAlbum genreFilteredAlbum = new GenreFilteredAlbum(genre, album.Artist, album.Title, album.Date, directory);
                m_GenreFilteredAlbumLookup[genre][album] = genreFilteredAlbum;
                AddGenreExpansion(genre, genreFilteredAlbum);
            }

            return m_GenreFilteredAlbumLookup[genre][album];
        }
Exemple #3
0
        private void AddGenreFilteredAlbumExpansion(GenreFilteredAlbum parent, Song child)
        {
            if (!m_GenreFilteredAlbumExpansion.ContainsKey(parent))
            {
                m_GenreFilteredAlbumExpansion[parent] = new SortedSet<Song>();
            }

            m_GenreFilteredAlbumExpansion[parent].Add(child);
        }
Exemple #4
0
        private void AddGenreExpansion(Genre parent, GenreFilteredAlbum child)
        {
            if (!m_GenreExpansion.ContainsKey(parent))
            {
                m_GenreExpansion[parent] = new SortedSet<GenreFilteredAlbum>(m_GenreFilteredAlbumSortRule);
            }

            m_GenreExpansion[parent].Add(child);
        }