Hi,
Ive written a little app which reads Winamp .m3u playlist files and copies all of the songs in there to a directory of the users choice. Useful for making MP3 CDs for the car.
Everything works fine, no problems. Im just concerned about the speed, especially the fact that running in debug mode within VS is faster than running the release mode .exe.
This is the function that I use to copy the files.
I should mention that the variable Dir is a string which contains the directory the user wants to copy the files to. Oh, and each item in the listbox lstTracks is a full path to an mp3, so each item is something along the lines of D:\Artist\Album\Song.mp3
Is there any reason why the same operation (copying the exact same playlist to the exact same location) takes longer in release mode than in debug mode?
Any help would be appreciated, thanks
Ive written a little app which reads Winamp .m3u playlist files and copies all of the songs in there to a directory of the users choice. Useful for making MP3 CDs for the car.
Everything works fine, no problems. Im just concerned about the speed, especially the fact that running in debug mode within VS is faster than running the release mode .exe.
This is the function that I use to copy the files.
I should mention that the variable Dir is a string which contains the directory the user wants to copy the files to. Oh, and each item in the listbox lstTracks is a full path to an mp3, so each item is something along the lines of D:\Artist\Album\Song.mp3
C#:
private void CopyFiles()
{
// Set up progress bar
progressBar.Minimum = 0;
progressBar.Maximum = lstTracks.Items.Count;
progressBar.Step = 1;
string[] songNameArray;
string songName;
// Copy the files in the playlist to Dir\
foreach (object mp3 in lstTracks.Items)
{
lblCurrentTrack.Text = String.Format("Copying track {0} of {1}", lstTracks.Items.IndexOf(mp3), lstTracks.Items.Count.ToString());
lblCurrentTrackName.Text = mp3.ToString();
songNameArray = mp3.ToString().Split(\\);
songName = songNameArray[songNameArray.Length-1];
if (File.Exists(mp3.ToString()))
File.Copy(mp3.ToString(), Dir + @"\" + songName, true);
else
errorLog += "|Could not copy: " + mp3.ToString();
progressBar.PerformStep();
Application.DoEvents();
}
if (errorLog.Length > 31)
{
string[] errors = errorLog.Split(|);
MessageBox.Show("Some song(s) could not be copied. Please see\n"
+ Dir + "\\error.log\nfor details.");
File.WriteAllLines(Dir + "\\error.log", errors);
}
else { MessageBox.Show(lstTracks.Items.Count.ToString() +
" copied sucesfully."); }
}
Is there any reason why the same operation (copying the exact same playlist to the exact same location) takes longer in release mode than in debug mode?
Any help would be appreciated, thanks