private async Task Download(Stream downloadStream, FileStream fileStream, DownloadFile downloadFile)
        {
            int bufferSize = 1024 * 1024 * 100; //100M缓存

            byte[] buffer     = new byte[bufferSize];
            long   position   = downloadFile.RangeBegin;
            int    readLength = 0;

            try
            {
                decimal downloadSpeed = 0;                   //下载速度
                var     beginSecond   = DateTime.Now.Second; //当前时间秒
                while ((readLength = await downloadStream.ReadAsync(buffer, 0, buffer.Length)) != 0)
                {
                    position      += readLength;
                    downloadSpeed += readLength;
                    fileStream.Write(buffer, 0, readLength);
                    if (position != downloadFile.Length)
                    {
                        downloadFile.RangeBegin = position;
                        int appendLength = downloadFile.AppendFileStream(fileStream);
                        await fileStream.FlushAsync();

                        fileStream.Position -= appendLength;
                    }
                    var endSecond = DateTime.Now.Second;
                    if (endSecond != beginSecond)//计算速度
                    {
                        downloadSpeed = downloadSpeed / (endSecond - beginSecond);
                        this.OnDownloadSpeedChanged(new SpeedChangedArgs((float)(downloadSpeed / 1024)));
                        beginSecond   = DateTime.Now.Second;
                        downloadSpeed = 0;//清空
                    }
                    this.OnDownloadProgressChanged(new ProgressChangedArgs(readLength, downloadFile.RangeBegin, downloadFile.Length == null ? -1 : downloadFile.Length.Value));
                }
            }
            catch (Exception ex)
            {
                this.OnDownloadError(new ErrorArgs(ex.Message));
            }
        }