private void renameFileFromTagsToolStripMenuItem_Click(object sender, EventArgs e) { FRMrename renamewin = new FRMrename(); ListView.SelectedListViewItemCollection filename = this.musicListStore.SelectedItems; var trackxml = new XMLutils(appPath + "\\trackxml.xml"); foreach (ListViewItem item in filename) { renamewin.Addtrack(item.SubItems[1].Text, item.SubItems[0].Text); } if (renamewin.ShowDialog(this) == DialogResult.OK) { for (int x = 0; x <= renamewin.Gettrack_Count_Before() - 1; x++) { if (x <= renamewin.Gettrack_Count_After() - 1) { if (File.Exists(renamewin.Getoldtrackname(x)) & !File.Exists(renamewin.Getnewtrackname(x))) { File.Move(renamewin.Getoldtrackname(x), renamewin.Getnewtrackname(x)); trackxml.Updatefilename(renamewin.Getoldtrackname(x), renamewin.Getnewtrackname(x)); //Miscutils.UpdateFname(renamewin.Getoldtrackname(x), renamewin.Getnewtrackname(x)); //update xml Reloadfilenames(renamewin.Getoldtrackname(x), renamewin.Getnewtrackname(x)); } else { MessageBox.Show("File Error " + renamewin.Getoldtrackname(x)); } } } } }