7,655
社区成员
发帖
与我相关
我的任务
分享
Response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead);
sio = RandomStream.AsStreamForWrite();
using (Stream stream = await Response.Content.ReadAsStreamAsync())
{
int read = 0;
byte[] responseBytes = new byte[1024];
do
{
read = await stream.ReadAsync(responseBytes, 0, responseBytes.Length);
DownloadBytes += read;
await sio.WriteAsync(responseBytes, 0, read);
Progress = DownloadBytes * 100 / TotalBytes.Value;
if (read == 0)
Complete();
} while (stream.CanRead && read != 0 && IsDownloading);
}