Пример #1
0
        public List<Artist> MountArtistList(DirectoryInfo pFolderMedia)
        {
            List<Artist> artistList = new List<Artist>();
            Artist artist;

            /* 
             * Verificando se a pasta da Media tem subpastas
             * Se não tiver subpasta(s) significa que não existem artistas.
             * Se tiver subpasta(s) então entrará na condição para criar um objeto para cada artista;
             * 
             */
            if (pFolderMedia.GetDirectories().Length > 0)
            {
                DirectoryInfo[] foldersArtist = pFolderMedia.GetDirectories();

                foreach (DirectoryInfo folderArtist in foldersArtist)
                {
                    artist = new Artist();
                    artist.name = folderArtist.Name;
                    artist.path = folderArtist.Parent.Name;
                    artist.albumList = MountAlbumList(folderArtist);
                    artistList.Add(artist);
                }
            }
            else
            {
                artist = new Artist();
                artist.name = "Artista desconhecido";
                artist.path = pFolderMedia.Name;
                artist.albumList = MountAlbumList(pFolderMedia);
                artistList.Add(artist);
            }

            return artistList;
        }
Пример #2
0
        private void btnListarAlbuns_Click(object sender, EventArgs e)
        {
            List<Album> result_album;
            Artist artist = new Artist();
            artist.name = "Roxette";

            cbLista.Items.Clear();

            result_album = daoMedia.listaAlbum(artist);
            foreach (Album album in result_album)
            {
                cbLista.Items.Add(album.name);
            }

        }
Пример #3
0
        private void button5_Click(object sender, EventArgs e)
        {
            Music music = new Music();
            music.ord=1;
            music.name = "01 No Coração de Deus.mp3";

            Album album = new Album();
            album.musicList = new List<Music>();
            album.name = "sonhos";
            album.path = "angelo torres";
            album.musicList.Add(music);

            music = new Music();
            music.ord = 2;
            music.name = "02 Nação de Adoradores.mp3";
            album.musicList.Add(music);

            music = new Music();
            music.ord = 3;
            music.name = "03 Chegar aTi.mp3";
            album.musicList.Add(music);

            Artist artist = new Artist();
            artist.name = "angelo torres";
            artist.path = "teste_media";
            artist.albumList.Add(album);

            Media media = new Media();
            media.name = "teste_media";
            media.description = "media criada somente para fazer um teste de inserção";
            media.artistList.Add(artist);

            DAOMedia daoMedia = new DAOMedia(_caminho_arq_media);
            daoMedia.inserir(media);

        }
Пример #4
0
        public List<Album> listaAlbum(Artist pArtist)
        {
            List<Album> lstAlbum = new List<Album>();
            Album album;
            
            XElement _arquivo = XElement.Load(_caminho);

            var xml_artist = _arquivo.Descendants("artist").Where(m => m.Attribute("name").Value.ToUpper() == pArtist.name.ToUpper()).FirstOrDefault();

            if (xml_artist != null)
            {
                var xml_lst_album = xml_artist.Descendants("album");

                foreach (XElement xml_album in xml_lst_album)
                {
                    album = new Album();
                    album.name = xml_album.Attribute("name").Value;
                    album.path = xml_album.Attribute("path").Value;
                    lstAlbum.Add(album);
                }
            }
            return lstAlbum;
        }
Пример #5
0
        public List<Artist> listaArtista(Media pMedia)
        {
            List<Artist> lstArtist = new List<Artist>();
            Artist artist;

            XElement _arquivo = XElement.Load(_caminho);

            var xml_media = _arquivo.Descendants("media").Where(m => m.Attribute("name").Value.ToUpper() == pMedia.name.ToUpper()).FirstOrDefault();

            if (xml_media != null)
            {

                var xml_lst_artist = xml_media.Descendants("artist");

                foreach (XElement xml_artist in xml_lst_artist)
                {
                    artist = new Artist();
                    artist.name = xml_artist.Attribute("name").Value;
                    artist.path = xml_artist.Attribute("path").Value;
                    lstArtist.Add(artist);
                }
            }
            return lstArtist;
        }
Пример #6
0
        private Artist carregaObjArtista(XElement _pXML_artist)
        {
            Artist artist = new Artist();

            artist.path = _pXML_artist.Attribute("path").Value;
            artist.name = _pXML_artist.Attribute("name").Value;

            return artist;
        }