Пример #1
0
        public AudioFileTag(string source)
        {
            using (TagLib.File file = TagLib.File.Create(source))
            {
                this.AlbumArtists = file.Tag.JoinedAlbumArtists;
                this.Artists      = file.Tag.JoinedPerformers;
                this.Album        = file.Tag.Album;
                this.Title        = file.Tag.Title;
                this.Track        = (int)file.Tag.Track;
                this.TrackCount   = (int)file.Tag.TrackCount;
                this.Disc         = (int)file.Tag.Disc;
                this.DiscCount    = (int)file.Tag.DiscCount;
                this.Year         = (int)file.Tag.Year;
                this.Genre        = file.Tag.JoinedGenres;

                List <AudioFileImage> images = new List <AudioFileImage>();
                foreach (TagLib.IPicture picture in file.Tag.Pictures)
                {
                    byte[] data = new byte[picture.Data.Count];
                    picture.Data.CopyTo(data, 0);
                    images.Add(new AudioFileImage()
                    {
                        Data        = data,
                        MimeType    = picture.MimeType,
                        Description = picture.Description,
                        Type        = (ImageType)picture.Type,
                        Extension   = MimeHelper.GetExtensionForMimeType(picture.MimeType)
                    });
                }
            }
        }