This commit is contained in:
CortexCore
2024-08-08 23:07:50 +08:00
parent dffda3663b
commit 5038fe33d1
9 changed files with 66 additions and 22 deletions

View File

@@ -196,17 +196,13 @@ namespace BITKit
//需要下载的文件总数和总大小
int totalDownloadCount = downloader.TotalDownloadCount;
long totalDownloadBytes = downloader.TotalDownloadBytes;
downloader.OnDownloadProgressCallback = (downloadedCount, downloadedBytes, downloadCount, downloadBytes) =>
downloader.OnDownloadProgressCallback = (totalDownloadCount, currentDownloadCount, totalDownloadBytes, currentDownloadBytes) =>
{
BIT4Log.Log<BITFramework>($"{totalDownloadCount},{currentDownloadCount},{totalDownloadBytes},{currentDownloadBytes}");
//下载进度
float progress = (float)downloadedBytes / downloadBytes;
//下载速度
float speed = 1;
//剩余时间
float remainTime = (downloadCount - downloadedCount) / speed;
float progress = (float)currentDownloadBytes / totalDownloadBytes;
_setProgressValue?.Invoke(progress);
_setProgressLabel?.Invoke($"下载速度:{speed}KB/s,剩余时间:{remainTime}s");
_setProgressLabel?.Invoke($"{currentDownloadBytes}/{totalDownloadBytes}");
};
downloader.OnDownloadErrorCallback=(fileName,error) =>
{