المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Copying a file with progress



C# Programming
06-03-2009, 01:50 PM
Hi all,

Within my application I need the ability to copy a file. The thing is I also want to use a progress bar to show how much of the file is uploaded/total etc.

So this rules out the use of System.IO.File.Copy() - Of course, I know, I will use a stream and write a chuck of data at a time and then report progress in-between each chuck... Yeah, that seems to work great...

PROBLEM: I used this method to copy a Word Document (Office 2007). The copy was fine, but the problem is, when I try to open the document in Word its says something about the file being corrupt, would you like to restore the file? (which succeeds, but is not good enough)

If I use File.Copy() this problem does not happen.

So, question is, how do I create a proper copy of a file while maintaining the ability to notify the user of the progress?

Thanks for any help

Life goes very fast. Tomorrow, today is already yesterday.