1. 优化暂停后,刚开启下载显示

2. 暂停开启下载,下载进度回退问题
dev2.0
陈伟 2025-04-22 13:30:54 +08:00
parent 71bdfb862f
commit 995671e0eb
3 changed files with 7 additions and 5 deletions

View File

@ -175,11 +175,12 @@ public class MinioDownloadTask : NotifyPropertyChangedBase
? $"{TotalSize / 1048576}MB"
: $"{TotalSize / 1024}KB");
var offset = Downloaded;
Console.WriteLine("偏移量:" + (offset > 1048576 ? $"{offset / 1048576:f2}MB" : $"{(offset) / 1024:f2}KB"));
await Minio.DownLoadObjectWithCallBack(this, Bucket, ObjectKey, FilePath, FileETag,
(downloaded, total, speed) =>
{
var progress = (double)(downloaded + offset) / total * 100;
Downloaded = downloaded;
Downloaded = downloaded + offset;
/*using (var client = SqlSugarConfig.GetSqlSugarScope())
{
updateTask.Downloaded = downloaded;

View File

@ -460,15 +460,14 @@ namespace Hopetry.Services
if (token.IsCancellationRequested)
{
//保存下载进度
var client = SqlSugarConfig.GetSqlSugarScope();
using var client = SqlSugarConfig.GetSqlSugarScope();
var temp = new MinioDownloadTask
{
TaskId = downTask.TaskId,
Downloaded = bytesRead
Downloaded = bytesRead + offset
};
client.Updateable(temp).IgnoreNullColumns().ExecuteCommand();
client.Close();
downTask.Downloaded = bytesRead;
downTask.Downloaded = temp.Downloaded;
fileStream.Close();
}

View File

@ -196,6 +196,8 @@ public class DownViewModel : MvcViewModelBase
else if (item.Status == "已暂停")
{
item.Status = "等待中";
// 更新排队时,下载信息
item.Speed = "等待中";
item.StartOrPauseIcon = "\xe76e";
// 加入下载等待队列
_taskQueue.Enqueue(item);