コード例 #1
0
ファイル: Form1.cs プロジェクト: chmcorbo/App.NET
        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);

        }
コード例 #2
0
ファイル: DaoMedia.cs プロジェクト: chmcorbo/App.NET
        private Music carregaObjMusica(XElement _pXML_music)
        {
            Music music = new Music();

            music.ord = Convert.ToInt32(_pXML_music.Attribute("ord").Value);
            music.name = _pXML_music.Attribute("name").Value;

            return music;
        }
コード例 #3
0
ファイル: DaoMedia.cs プロジェクト: chmcorbo/App.NET
        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;
        }
コード例 #4
0
ファイル: FitterMedia.cs プロジェクト: chmcorbo/App.NET
        public List<Music> MountListMusic(DirectoryInfo pPasta)
        {
            List<Music> _musicas = new List<Music>();
            // lixo técnico
            // Código para contagem de objetos;
            // var teste = pPasta.GetFiles().Count(p => p.Extension == ".wma" && p.Extension == ".mp3");
            
            Music music;
            Int16 vOrd;

            var fileList = from file in pPasta.GetFiles()
                           where file.Extension == ".mp3" || file.Extension == ".wma"
                           select file;
            vOrd=1;

            foreach (FileInfo f in fileList)
            {
                music = new Music();
                music.ord = vOrd;
                music.name = f.Name;
                vOrd++;
                _musicas.Add(music);
            }
            return _musicas;
        }