copy backup files

Mar 24, 2009 at 11:38 AM
Edited Mar 24, 2009 at 11:38 AM

As already mentioned in the review, you should use the C# method for copying files.

Just replace the code in line 105 with the bottom line.
//Microsoft.VisualBasic.FileIO.FileSystem.CopyFile(sSourceFile, sDestFile,  Microsoft.VisualBasic.FileIO.UIOption.AllDialogs, Microsoft.VisualBasic.FileIO.UICancelOption.DoNothing);
File.Copy(sSourceFile, sDestFile, true);

Perhaps you could replace the Inputbox call in the btnAddServer_Click method.
It could be managed by a custom input dialog, so we could get rid of the Microsoft.VisualBasic dependency.

Mar 24, 2009 at 7:18 PM

in my first version I used File.Copy(..,..,..). But unfortunately with this method it's not possible to show the progress of the copy operation (and I hate to wait for a big file to copy, not knowing when the process is finished) :-(. The easiest solution I found was using the VisualBasic.FileIO.FileSystem.CopyFile(...).

The other solutions I found always use calls to Kernel32.dll etc. => 80 lines of code for a simple file copy.

Do you know any other way to copy files and showing a progess?