Compare commits

...

2 Commits

3 changed files with 13 additions and 3 deletions

View File

@ -60,9 +60,13 @@ public class MinioDownloadTask : INotifyPropertyChanged
[SugarColumn(ColumnName = "finished_time")] [SugarColumn(ColumnName = "finished_time")]
public string FinishedTime { get; set; } public string FinishedTime { get; set; }
[SugarColumn(ColumnName = "file_size")] [SugarColumn(ColumnName = "file_size")]
public string FileSize { get; set; } public string FileSize { get; set; }
[SugarColumn(ColumnName = "file_etag")]
public string FileETag { get; set; }
[SugarColumn(IsIgnore = true)] [SugarColumn(IsIgnore = true)]
public string Progress public string Progress
{ {
@ -118,6 +122,11 @@ public class MinioDownloadTask : INotifyPropertyChanged
Console.WriteLine($"id {TaskId} path: {FilePath} key: {ObjectKey}文件下载中..."); Console.WriteLine($"id {TaskId} path: {FilePath} key: {ObjectKey}文件下载中...");
updateTask.Status = "下载中"; updateTask.Status = "下载中";
TotalSize = 5L;
var stat = await _minio.GetObjectMetadata(Bucket, ObjectKey);
// 获取对象信息
TotalSize = stat.Size;
FileETag = stat.ETag;
await _minio.DownLoadObject(Bucket, ObjectKey, FilePath, ""); await _minio.DownLoadObject(Bucket, ObjectKey, FilePath, "");
Status = "已完成"; Status = "已完成";
updateTask.Status = Status; updateTask.Status = Status;

View File

@ -273,7 +273,7 @@ namespace Hopetry.Services
.WithBucket(string.IsNullOrEmpty(bucketName) ? _bucketName : bucketName) .WithBucket(string.IsNullOrEmpty(bucketName) ? _bucketName : bucketName)
.WithObject(objectKey) .WithObject(objectKey)
.WithFile(localPath); .WithFile(localPath);
await _minioClient.GetObjectAsync(getArgs); var stat = await _minioClient.GetObjectAsync(getArgs);
if (VerifyETag(localPath, objectETag)) if (VerifyETag(localPath, objectETag))
{ {
// todo 先忽略处理 // todo 先忽略处理

View File

@ -238,6 +238,7 @@ public class DownViewModel : MvcViewModelBase
{ {
try try
{ {
// todo 下载失败3次停止下载
await task.StartDownload(); await task.StartDownload();
LoadRunningTasks(); LoadRunningTasks();
LoadFinishedTasks(); LoadFinishedTasks();