Exemplo n.º 1
0
        public void SaveFile(string path)
        {
            if (_id3v2 == null)
            {
                MessageBox.Show("Nothing to save!");
                return;
            }

            if (cmbID3v2.SelectedIndex == cmbID3v2.Items.IndexOf("ID3v2.2"))
            {
                _id3v2.Header.TagVersion = ID3v2TagVersion.ID3v22;
            }
            else if (cmbID3v2.SelectedIndex == cmbID3v2.Items.IndexOf("ID3v2.3"))
            {
                _id3v2.Header.TagVersion = ID3v2TagVersion.ID3v23;
            }
            else if (cmbID3v2.SelectedIndex == cmbID3v2.Items.IndexOf("ID3v2.4"))
            {
                _id3v2.Header.TagVersion = ID3v2TagVersion.ID3v24;
            }
            else
            {
                throw new Exception("Unknown tag version");
            }

            _id3v2.Artist         = txtArtist.Text;
            _id3v2.Title          = txtTitle.Text;
            _id3v2.Album          = txtAlbum.Text;
            _id3v2.Genre          = cmbGenre.Text;
            _id3v2.Year           = txtYear.Text;
            _id3v2.TrackNumber    = txtTrackNumber.Text;
            _id3v2.IsPodcast      = chkPodcast.Checked;
            _id3v2.PodcastFeedUrl = txtPodcastFeedUrl.Text;
            _id3v2.Save(path);
        }
Exemplo n.º 2
0
        private void OnSaveFile()
        {
            _id3v2.Artist            = Artist;
            _id3v2.Title             = Title;
            _id3v2.Album             = Album;
            _id3v2.Genre             = Genre;
            _id3v2.Year              = Year;
            _id3v2.TrackNumber       = Track;
            _id3v2.Header.TagVersion = ID3v2Version.Value;

            List <IAttachedPicture> deleteList = new List <IAttachedPicture>(_id3v2.PictureList);

            foreach (var picture in PictureCollection)
            {
                if (picture.AttachedPicture != null)
                {
                    picture.AttachedPicture.Description = picture.Description;
                    picture.AttachedPicture.PictureType = picture.PictureType;
                    deleteList.Remove(picture.AttachedPicture);
                }
                else
                {
                    IAttachedPicture apic = _id3v2.PictureList.AddNew();
                    apic.Description = picture.Description;
                    apic.PictureType = picture.PictureType;
                    apic.PictureData = picture.PictureBytes;
                }
            }

            foreach (var deletePicture in deleteList)
            {
                _id3v2.PictureList.Remove(deletePicture);
            }

            IComments comments = _id3v2.CommentsList.FirstOrDefault();

            if (!string.IsNullOrWhiteSpace(Comment))
            {
                if (comments == null)
                {
                    comments = _id3v2.CommentsList.AddNew();
                }
                comments.Value = Comment;
            }
            else
            {
                if (comments != null)
                {
                    _id3v2.CommentsList.Remove(comments);
                }
            }

            // TODO: Multiple comments

            _id3v2.Save(_fullFileName);
        }
        public void SaveFile(string path)
        {
            if (_id3v2 == null)
            {
                MessageBox.Show("Nothing to save!");
                return;
            }

            //if (pictureBox1.Image != null)
            //{
            //    IAttachedPicture attachedPicture = GetCurrentPictureFrame();
            //    SaveImageToFile(attachedPicture);
            //}


            if (cmbID3v2.SelectedIndex == cmbID3v2.Items.IndexOf("ID3v2.2"))
            {
                _id3v2.Header.TagVersion = ID3v2TagVersion.ID3v22;
            }
            else if (cmbID3v2.SelectedIndex == cmbID3v2.Items.IndexOf("ID3v2.3"))
            {
                _id3v2.Header.TagVersion = ID3v2TagVersion.ID3v23;
            }
            else if (cmbID3v2.SelectedIndex == cmbID3v2.Items.IndexOf("ID3v2.4"))
            {
                _id3v2.Header.TagVersion = ID3v2TagVersion.ID3v24;
            }
            else
            {
                throw new Exception("Unknown tag version");
            }

            _id3v2.Artist         = txtArtist.Text;
            _id3v2.Title          = txtTitle.Text;
            _id3v2.Album          = txtAlbum.Text;
            _id3v2.Genre          = cmbGenre.Text;
            _id3v2.Year           = txtYear.Text;
            _id3v2.TrackNumber    = txtTrackNumber.Text;
            _id3v2.IsPodcast      = chkPodcast.Checked;
            _id3v2.PodcastFeedUrl = txtPodcastFeedUrl.Text;
            _id3v2.Save(path);

            ClearTextboxes();
        }