public Media MountMedia(String pDescription, String pPath) { _media = new Media(); DriveInfo driveInfo = new DriveInfo(pPath); _media.name = driveInfo.VolumeLabel; _media.description = pDescription; DirectoryInfo folderMedia = new DirectoryInfo(pPath); // Enviando pasta da Media porque dentro dela deverá ter as pastas dos artistas. _media.artistList=MountArtistList(folderMedia); return _media; }
private void button1_Click_1(object sender, EventArgs e) { if (txtDescricaoMedia.Text == String.Empty) { MessageBox.Show("Descrição da mídia não informada", "Entrada Inválida", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (txtCaminho.Text == String.Empty) { MessageBox.Show("Caminho não informado", "Entrada Inválida", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (!Directory.Exists(txtCaminho.Text)) { MessageBox.Show("Caminho informado não encontrado", "Entrada Inválida", MessageBoxButtons.OK, MessageBoxIcon.Error); } lvFileList.Items.Clear(); ListViewItem item; FitterMedia fitterMedia = new FitterMedia(); _media = fitterMedia.MountMedia(txtDescricaoMedia.Text, txtCaminho.Text); //dataGridView1.DataSource = media.artistList; foreach (Artist artist in _media.artistList) { foreach (Album album in artist.albumList) { foreach (Music music in album.musicList) { item = new ListViewItem(); item.Text = _media.name; item.SubItems.Add(artist.name); item.SubItems.Add(album.name); item.SubItems.Add(music.name); lvFileList.Items.Add(item); } } } }
private void btnListarArtistas_Click(object sender, EventArgs e) { List<Artist> result_artist; Media media = new Media(); media.name = "MP3_SECULAR05"; cbLista.Items.Clear(); result_artist = daoMedia.listaArtista(media); foreach (Artist artist in result_artist) { cbLista.Items.Add(artist.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); }
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; }
public List<Media> listaMedia() { List<Media> lstMedia = new List<Media>(); Media media; XElement _arquivo = XElement.Load(_caminho); var xml_lst_media = _arquivo.Descendants("media"); foreach (XElement xml_media in xml_lst_media) { media = new Media(); media.name = xml_media.Attribute("name").Value; media.description = xml_media.Attribute("description").Value; lstMedia.Add(media); } return lstMedia; }
private Media carregaObjMedia(XElement _pXML_media) { Media media = new Media(); media.name = _pXML_media.Attribute("name").Value; media.description = _pXML_media.Attribute("description").Value; return media; }