예제 #1
0
        public void tagcan(string car)
        {
            TagLib.File file  = TagLib.File.Create(car);
            mp3         datmp = new mp3();

            datmp.Nombrecancion = file.Tag.Title;
            datmp.Año           = Convert.ToString(file.Tag.Year);
            datmp.Tipo          = file.Tag.FirstGenre;
            datmp.Tiempo        = file.Properties.Duration.ToString();
            datmp.Numero        = Convert.ToString(file.Tag.Track);
            datmp.Artista       = file.Tag.TitleSort;
            datmp.Album         = file.Tag.Album;
            datmp.Notas         = file.Tag.Comment;
            listamp3.Add(datmp);
        }
예제 #2
0
        public void tag(string dato)
        {
            string dat = dato;

            TagLib.File          file         = TagLib.File.Create(dat);
            System.Drawing.Image currentImage = null;

            // In method onclick of the listbox showing all mp3's

            if (file.Tag.Pictures.Length > 0)
            {
                TagLib.IPicture pic = file.Tag.Pictures[0];
                MemoryStream    ms  = new MemoryStream(pic.Data.Data);
                if (ms != null && ms.Length > 4096)
                {
                    currentImage = System.Drawing.Image.FromStream(ms);
                    // Load thumbnail into PictureBox
                    caratula.Image = currentImage.GetThumbnailImage(200, 200, null, System.IntPtr.Zero);
                }
                ms.Close();
            }

            mp3 datmp = new mp3();

            datmp.Nombrecancion = file.Tag.Title;
            datmp.Numero        = Convert.ToString(file.Tag.Track);
            datmp.Album         = file.Tag.Album;
            datmp.Año           = Convert.ToString(file.Tag.Year);
            datmp.Tipo          = file.Tag.FirstGenre;
            datmp.Tiempo        = file.Properties.Duration.ToString();
            datmp.Artista       = file.Tag.FirstArtist;
            datmp.Notas         = file.Tag.Comment;
            listamp3.Add(datmp);
            dataGridView1.DataSource = null;
            dataGridView1.Refresh();
            dataGridView1.DataSource = listamp3;
            dataGridView1.Refresh();
        }