public MP3Tag(MP3Tag mp3Tag)
 {
     this.album       = mp3Tag.album;
     this.artist      = mp3Tag.artist;
     this.comment     = mp3Tag.comment;
     this.composer    = mp3Tag.composer;
     this.date        = mp3Tag.date;
     this.genre       = mp3Tag.genre;
     this.publisher   = mp3Tag.publisher;
     this.title       = mp3Tag.title;
     this.trackNumber = mp3Tag.trackNumber;
     this.length      = mp3Tag.length;
     this.kbps        = mp3Tag.kbps;
 }
 public MP3Tag(MP3Tag mp3Tag)
 {
     this.album = mp3Tag.album;
     this.artist = mp3Tag.artist;
     this.comment = mp3Tag.comment;
     this.composer = mp3Tag.composer;
     this.date = mp3Tag.date;
     this.genre = mp3Tag.genre;
     this.publisher = mp3Tag.publisher;
     this.title = mp3Tag.title;
     this.trackNumber = mp3Tag.trackNumber;
     this.length = mp3Tag.length;
     this.kbps = mp3Tag.kbps;
 }
예제 #3
0
        /// <summary>
        /// 获取MP3Tag信息
        /// </summary>
        /// <param name="fullName">文件全名</param>
        /// <returns>MP3Tag</returns>
        public static MP3Tag GetMP3Tag(string fullName)
        {
            MP3Tag id3tag = new MP3Tag();
            try
            {
                TagLib.File file = TagLib.File.Create(fullName);
                id3tag.Album = file.Tag.Album;
                id3tag.Artist = file.Tag.FirstPerformer;
                id3tag.Comment = file.Tag.Comment;
                id3tag.Composer = file.Tag.FirstComposer;
                id3tag.Date = file.Tag.Year.ToString();
                id3tag.Genre = file.Tag.FirstGenre;
                id3tag.Title = file.Tag.Title;
                id3tag.TrackNumber = file.Tag.Track.ToString();
                id3tag.Length = file.Properties.Duration.Minutes.ToString() + ":" +
                    file.Properties.Duration.Seconds.ToString();
                id3tag.Kbps = file.Properties.AudioBitrate.ToString() + "Kbps";
            }
            catch { }

            return id3tag;
        }
예제 #4
0
        private void SetMP3(MP3Tag mp3Tag)
        {
            this.pnlPic.Visible = false;
            if (this.picPreview.Image != null)
                this.picPreview.Image.Dispose();
            this.dblProList.Items.Clear();
            this.dblProList.Columns.Clear();
            ColumnHeader property = new ColumnHeader();
            ColumnHeader value = new ColumnHeader();
            property.Text = "属性";
            value.Text = "值";
            property.Width = 80;
            value.Width = 120;

            this.dblProList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
            property,
            value});
            ListViewItem[] items = new ListViewItem[10];
            items[0] = new ListViewItem(new string[] {
            "标题", ""});
            items[1] = new ListViewItem(new string[] {
            "艺术家", ""});
            items[2] = new ListViewItem(new string[] {
            "作曲家", ""});
            items[3] = new ListViewItem(new string[] {
            "专辑", ""});
            items[4] = new ListViewItem(new string[] {
            "音轨", ""});
            items[5] = new ListViewItem(new string[] {
            "流派", ""});
            items[6] = new ListViewItem(new string[] {
            "年代", ""});
            items[7] = new ListViewItem(new string[] {
            "长度",""});
            items[8] = new ListViewItem(new string[] {
            "比特率", ""});
            items[9] = new ListViewItem(new string[] {
            "备注", ""});

            this.dblProList.Items.AddRange(items);

            this.dblProList.Items[0].SubItems[1].Text = mp3Tag.Title;
            this.dblProList.Items[1].SubItems[1].Text = mp3Tag.Artist;
            this.dblProList.Items[2].SubItems[1].Text = mp3Tag.Composer;
            this.dblProList.Items[3].SubItems[1].Text = mp3Tag.Album;
            this.dblProList.Items[4].SubItems[1].Text = mp3Tag.TrackNumber;
            this.dblProList.Items[5].SubItems[1].Text = mp3Tag.Genre;
            this.dblProList.Items[6].SubItems[1].Text = mp3Tag.Date;
            this.dblProList.Items[7].SubItems[1].Text = mp3Tag.Length;
            this.dblProList.Items[8].SubItems[1].Text = mp3Tag.Kbps;
            this.dblProList.Items[9].SubItems[1].Text = mp3Tag.Comment;
        }