<span style="white-space:pre"> </span>//<span style="white-space:pre"> </span>string path1 = @"F:\unity生命周期.png";
//<span style="white-space:pre"> </span>string path2 = @"E:\unity生命周期.png";
//<span style="white-space:pre"> </span>FileCopy (path2, path1);
//实现文件复制
void FileCopy(string path1, string path2)
{
int bufferSize = 10240;
Stream source = new FileStream (path1, FileMode.Open, FileAccess.Read);
Stream target = new FileStream (path2, FileMode.Create, FileAccess.Write);
byte[] buffer = new byte[bufferSize];
int bytesRead;
do {
bytesRead = source.Read (buffer, 0, bufferSize);
target.Write (buffer, 0, bytesRead);
} while(bytesRead > 0);
source.Dispose();
target.Dispose();
}