1

I try to make app which will load and edit id3 tags. I decided to use taglib for that. Everything works fine, but when i try to save edited tag it falls on IOException "The process cannot access the file ...". Heres code:

        TagLib.File f = TagLib.File.Create(cesta);
        f.Tag.Year = 1999;//uint.Parse(textBox1.Text);
        f.Save();

Previously i just have load procedure:

        TagLib.File f = TagLib.File.Create(path);
        string rok = f.Tag.Year.ToString();
        textBox1.Text = rok;
        string album = f.Tag.Album;
        textBox2.Text = album;
        string[] artist = f.Tag.Performers;
        string autor = "";
        for (int i = 0; i < artist.Length; i++)
        {
            autor = autor + artist[i];
        }
        textBox3.Text = autor;

Does anyone know, that I did wrong?

scotchi
  • 2,359
  • 2
  • 19
  • 21
mmaverikk
  • 223
  • 1
  • 12

1 Answers1

0

If you're trying to edit an existing file by reopening it, make sure that you have previously closed it. Also, see if you can enclose all of your file access code with using blocks. For example:

using(TagLib.File f = TagLib.File.Create(path))
{
    // do work
}
Brad Rem
  • 6,036
  • 2
  • 25
  • 50
  • My mistake, some process didn't finish propertly and after reboot it works ... anyway thank you for help :-) – mmaverikk Apr 19 '12 at 14:05