Hi, I am trying to make a failure-tolerant (to I/O errors) file copy, using code like this:
But this is VERY slow process (~1MB/min), how could I speed it up?Code:for (long L = 0; L<sourceStream.Length; L++) { try{sourceStream.Seek(L,SeekOrigin.Begin);} catch {//SEEK ERROR} try {destStream.Seek(L,SeekOrigin.Begin);} catch {//SEEK ERROR} int i; try {i = sourceStream.ReadByte();} catch {i = 0; //SOURCE READ ERROR} try {destStream.WriteByte(Convert.ToByte(i));} catch {//DEST WRITE ERROR} }




Reply With Quote