private void btnListarMusicas_Click(object sender, EventArgs e) { List<Music> result_music; Album album = new Album(); album.name = "Greatest Hits"; cbLista.Items.Clear(); result_music = daoMedia.listaMusica(album); foreach (Music music in result_music) { cbLista.Items.Add(music.name); } }
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); }
private void button8_Click(object sender, EventArgs e) { List<Album> listaAlbum = new List<Album>(); Album album = new Album(); Album find_album = new Album(); album.name = "A change of the heart"; album.path = "David Sanbord"; listaAlbum.Add(album); album = new Album(); album.name = "The windows"; album.path = "Marc Russo"; listaAlbum.Add(album); album = new Album(); album.name = "Lost and found"; album.path = "Spyro gyra"; listaAlbum.Add(album); find_album = listaAlbum.Where(x => x.name.ToUpper() == "LOST AND FOUND").FirstOrDefault(); if (find_album == null) MessageBox.Show("Objeto não encontrado"); //listaAlbum.IndexOf( }
public List<Music> listaMusica(Album pAlbum) { List<Music> lstMusic = new List<Music>(); Music music; XElement _arquivo = XElement.Load(_caminho); var xml_album = _arquivo.Descendants("album").Where(m => m.Attribute("name").Value.ToUpper() == pAlbum.name.ToUpper()).FirstOrDefault(); if (xml_album != null) { var xml_lst_music = xml_album.Descendants("music"); foreach (XElement xml_music in xml_lst_music) { music = new Music(); music.name = xml_music.Attribute("name").Value; music.ord = Convert.ToInt32(xml_music.Attribute("ord").Value); lstMusic.Add(music); } } return lstMusic; }
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; }
private Album carregaObjAlbum(XElement _pXML_album) { Album album = new Album(); album.path = _pXML_album.Attribute("path").Value; album.name = _pXML_album.Attribute("name").Value; return album; }
public void MountAlbum(List<Album> pAlbumList, DirectoryInfo pFolderAlbum) { Album _album; if (pFolderAlbum.GetDirectories().Length > 0) { var subPastas = pFolderAlbum.GetDirectories(); foreach (DirectoryInfo subpasta in subPastas) { if (_name == String.Empty) _name = subpasta.Parent + " / " + subpasta.Name; else _name = _name + " / " + subpasta.Name; MountAlbum(pAlbumList, subpasta); } } else { /* * Entrará aqui se só tiver um nível de pasta de album ou * não for encontrado mais nenhum nivel; */ _album = new Album(); if (_name == String.Empty) _album.name = pFolderAlbum.Name; else _album.name = _name; _album.path = pFolderAlbum.Parent.Name; _album.musicList = MountListMusic(pFolderAlbum); pAlbumList.Add(_album); _name = _oldname; } }
public List<Album> MountAlbumList(DirectoryInfo pFolderArtist) { Album album; List<Album> albumList = new List<Album>(); /* * Verificando se dentro da pasta do artista tem alguma subpasta; * Se não tiver, significa que será criado um Album caracterizado como desconhecido * Se tiver subpasta, então montará a lista de albuns. * */ if (pFolderArtist.GetDirectories().Length > 0) { DirectoryInfo[] foldersAlbum = pFolderArtist.GetDirectories(); foreach (DirectoryInfo folderAlbum in foldersAlbum) { _name = String.Empty; _oldname = String.Empty; MountAlbum(albumList, folderAlbum); } } else { /* * Entrará aqui somente se não existir nenhum subpasta referente ao album */ album = new Album(); album.name = pFolderArtist.Name; album.path = pFolderArtist.Parent.Name; album.musicList=MountListMusic(pFolderArtist); albumList.Add(album); } return albumList; }