110,539
社区成员
发帖
与我相关
我的任务
分享
string path = "D:\\TDDOWNLOAD\\AdobePhotoshopCS3.rar";
FileStream file = new FileStream(path, FileMode.Open, FileAccess.Read);
BinaryReader binaryreader = new BinaryReader(file);
byte[] b = new byte[4098];
int data = 0; ;
int bodylenght = (int)file.Length;
int uoi = 0;
this.progressBar1.Maximum = bodylenght;
while ((data = binaryreader.Read(b, 0,4098)) != 0) //这个注意是将文件写成流的形式
{
uoi = uoi + 4098;
if (uoi >= bodylenght)
this.progressBar1.Value = bodylenght;
else
this.progressBar1.Value = uoi;
}
this.label1.Text = uoi.ToString();
binaryreader.Close();
file.Close();