private void ButtonSave_Click(object sender, EventArgs e) { if (fileName != null) { Mp3File targetFile = new Mp3File(@fileName); try { string artist = textBox1.Text; string album = textBox2.Text; string song = textBox3.Text; string num = textBox4.Text; string genre = textBox5.Text; string year = textBox6.Text; targetFile.TagHandler.Artist = artist; targetFile.TagHandler.Album = album; targetFile.TagHandler.Song = song; targetFile.TagHandler.Track = num; targetFile.TagHandler.Genre = genre; targetFile.TagHandler.Year = year; targetFile.UpdatePacked(); MessageBox.Show("Сохранено"); } catch { MessageBox.Show("Ошибка сохранения"); } } else { MessageBox.Show("Нет файла"); } }
public void Compact(string filename) { try { // create mp3 file wrapper; open it and read the tags Mp3File mp3File = new Mp3File(filename); try { using (new CursorKeeper(Cursors.WaitCursor)) { mp3File.UpdatePacked(); } } catch (Exception e) { ExceptionMessageBox.Show(_form, e, "Error Writing Tag"); } } catch (Exception e) { ExceptionMessageBox.Show(_form, e, "Error Reading Tag"); } }