I have a 60mb file im trying to copy while showing progress in a progressbar1


Current code below takes way to long and errors at the end of the file

all im looking for is a simple

File.Copy(openFileDialog1.FileName, System.Windows.Forms.Application.StartupPath + @"\rawdump.bin", true);

With progressbar1 filling up till end of copy why i something so simple this complex:

progressBar1.Value = progressBar1.Minimum;
System.IO.BinaryReader Reader = new System.IO.BinaryReader(new System.IO.FileStream(openFileDialog1.FileName, System.IO.FileMode.Open), Encoding.ASCII);
System.IO.BinaryWriter Writer = new System.IO.BinaryWriter(new System.IO.FileStream(System.Windows.Forms.Application.StartupPath + @"\rawdump.bin", System.IO.FileMode.Create));
progressBar1.Maximum = (int)Reader.BaseStream.Length;
while (Reader.PeekChar() != -1)
{
Writer.Write(Reader.ReadByte());
progressBar1.PerformStep();
Writer.Flush();
}

int nBytes = (int)Reader.BaseStream.Length;

progressBar1.Maximum = nBytes;

for (int i = 0; i < nBytes; i++)

{

Writer.Write(Reader.ReadByte());

progressBar1.PerformStep();

}