private void OnLoadFile(string fileName) { _id3v2 = new ID3v2Tag(fileName); IAudioFile audioFile = AudioFile.Create(fileName, true); DescriptiveLameTagReader lameTagReader = new DescriptiveLameTagReader(fileName); _fullFileName = fileName; FileName = Path.GetFileName(fileName); Artist = _id3v2.Artist; Title = _id3v2.Title; Album = _id3v2.Album; Genre = _id3v2.Genre; Year = _id3v2.Year; Track = _id3v2.TrackNumber; ID3v2Version = _id3v2.Header.TagVersion; if (_id3v2.PictureList == null || _id3v2.PictureList.Count == 0) { PictureCollection = new ObservableCollection <Picture>(); } else { var pictureCollection = new ObservableCollection <Picture>(); foreach (var apic in _id3v2.PictureList) { pictureCollection.Add(new Picture(apic)); } PictureCollection = pictureCollection; } Comment = null; if (_id3v2.CommentsList != null) { foreach (var item in _id3v2.CommentsList) { if (item.Description != "iTunNORM") { Comment = item.Value; break; } } } PlayLength = audioFile.TotalSeconds; Bitrate = audioFile.Bitrate; EncoderPreset = string.Format("{0} {1}", lameTagReader.LameTagInfoEncoder, lameTagReader.UsePresetGuess == UsePresetGuess.NotNeeded ? lameTagReader.Preset : lameTagReader.PresetGuess); CanSave = true; }
public void LoadFile(string path) { ClearImageData(); _id3v2 = new ID3v2Tag(path); txtFilename.Text = Path.GetFileName(path); txtArtist.Text = _id3v2.Artist; txtTitle.Text = _id3v2.Title; txtAlbum.Text = _id3v2.Album; cmbGenre.Text = _id3v2.Genre; txtYear.Text = _id3v2.Year; txtTrackNumber.Text = _id3v2.TrackNumber; chkPodcast.Checked = _id3v2.IsPodcast; txtPodcastFeedUrl.Text = _id3v2.PodcastFeedUrl; BindingSource bindingSource = new BindingSource(); imageBindingNavigator.BindingSource = bindingSource; bindingSource.CurrentChanged += bindingSource_CurrentChanged; bindingSource.DataSource = _id3v2.PictureList; switch (_id3v2.Header.TagVersion) { case ID3v2TagVersion.ID3v22: cmbID3v2.SelectedIndex = cmbID3v2.Items.IndexOf("ID3v2.2"); break; case ID3v2TagVersion.ID3v23: cmbID3v2.SelectedIndex = cmbID3v2.Items.IndexOf("ID3v2.3"); break; case ID3v2TagVersion.ID3v24: cmbID3v2.SelectedIndex = cmbID3v2.Items.IndexOf("ID3v2.4"); break; } txtPlayLength.Text = string.Empty; txtBitrate.Text = string.Empty; txtEncoderPreset.Text = string.Empty; Thread t = new Thread(LoadAudioFileDetails); t.Start(path); }
private void OnLoadFile(string fileName) { _id3v2 = new ID3v2Tag(fileName); IAudioFile audioFile = AudioFile.Create(fileName, true); DescriptiveLameTagReader lameTagReader = new DescriptiveLameTagReader(fileName); _fullFileName = fileName; FileName = Path.GetFileName(fileName); Artist = _id3v2.Artist; Title = _id3v2.Title; Album = _id3v2.Album; Genre = _id3v2.Genre; Year = _id3v2.Year; Track = _id3v2.TrackNumber; ID3v2Version = _id3v2.Header.TagVersion; if (_id3v2.PictureList == null || _id3v2.PictureList.Count == 0) { PictureCollection = new ObservableCollection<Picture>(); } else { var pictureCollection = new ObservableCollection<Picture>(); foreach (var apic in _id3v2.PictureList) { pictureCollection.Add(new Picture(apic)); } PictureCollection = pictureCollection; } Comment = null; if (_id3v2.CommentsList.Count > 0) { Comment = _id3v2.CommentsList[0].Value; } PlayLength = audioFile.TotalSeconds; Bitrate = audioFile.Bitrate; EncoderPreset = string.Format("{0} {1}", lameTagReader.LameTagInfoEncoder, lameTagReader.UsePresetGuess == UsePresetGuess.NotNeeded ? lameTagReader.Preset : lameTagReader.PresetGuess); CanSave = true; }