private string GetCurrentSpeed() { var downloadedLength = _currentDownloadProgress !.DownloadedLength - _lastDownloadLength !.Value; var text = ($"{FileSizeFormatter.FormatSize(downloadedLength * 1000.0 / (DateTime.Now - _lastDateTime).TotalMilliseconds)}/s" ); _lastDateTime = DateTime.Now; return(text); }
private DownloadInfoProgress GetDownloadInfoProgress() { string speed = GetCurrentSpeed(); string fileSize = FileSizeFormatter.FormatSize(_currentDownloadProgress !.FileLength); string downloadProcess = $"{FileSizeFormatter.FormatSize(_currentDownloadProgress.DownloadedLength)}/{FileSizeFormatter.FormatSize(_currentDownloadProgress.FileLength)}"; var downloadInfoProgress = new DownloadInfoProgress ( fileSize, downloadProcess, speed, _currentDownloadProgress ); return(downloadInfoProgress); }