Compare commits
2 Commits
591833a780
...
7f4e7f7a06
| Author | SHA1 | Date |
|---|---|---|
|
|
7f4e7f7a06 | |
|
|
cfdae629ee |
|
|
@ -60,9 +60,13 @@ public class MinioDownloadTask : INotifyPropertyChanged
|
|||
|
||||
[SugarColumn(ColumnName = "finished_time")]
|
||||
public string FinishedTime { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "file_size")]
|
||||
public string FileSize { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "file_etag")]
|
||||
public string FileETag { get; set; }
|
||||
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public string Progress
|
||||
{
|
||||
|
|
@ -78,7 +82,7 @@ public class MinioDownloadTask : INotifyPropertyChanged
|
|||
CancelCommand = new CustomCommand(OnCancel);
|
||||
}
|
||||
|
||||
public MinioDownloadTask(MinioService minio, string bucket, string objectKey, string downDir,string fileSize)
|
||||
public MinioDownloadTask(MinioService minio, string bucket, string objectKey, string downDir, string fileSize)
|
||||
{
|
||||
Status = "等待中";
|
||||
_minio = minio;
|
||||
|
|
@ -118,6 +122,11 @@ public class MinioDownloadTask : INotifyPropertyChanged
|
|||
|
||||
Console.WriteLine($"id {TaskId} path: {FilePath} key: {ObjectKey}文件下载中...");
|
||||
updateTask.Status = "下载中";
|
||||
TotalSize = 5L;
|
||||
var stat = await _minio.GetObjectMetadata(Bucket, ObjectKey);
|
||||
// 获取对象信息
|
||||
TotalSize = stat.Size;
|
||||
FileETag = stat.ETag;
|
||||
await _minio.DownLoadObject(Bucket, ObjectKey, FilePath, "");
|
||||
Status = "已完成";
|
||||
updateTask.Status = Status;
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ namespace Hopetry.Services
|
|||
.WithBucket(string.IsNullOrEmpty(bucketName) ? _bucketName : bucketName)
|
||||
.WithObject(objectKey)
|
||||
.WithFile(localPath);
|
||||
await _minioClient.GetObjectAsync(getArgs);
|
||||
var stat = await _minioClient.GetObjectAsync(getArgs);
|
||||
if (VerifyETag(localPath, objectETag))
|
||||
{
|
||||
// todo 先忽略处理
|
||||
|
|
@ -379,7 +379,7 @@ namespace Hopetry.Services
|
|||
() => Console.WriteLine($"Stopped listening for bucket notifications\n"));
|
||||
// 等待取消请求
|
||||
|
||||
await Task.Delay(Timeout.Infinite,cancellationToken);
|
||||
await Task.Delay(Timeout.Infinite, cancellationToken);
|
||||
}
|
||||
catch (OperationCanceledException e)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -238,6 +238,7 @@ public class DownViewModel : MvcViewModelBase
|
|||
{
|
||||
try
|
||||
{
|
||||
// todo 下载失败3次,停止下载
|
||||
await task.StartDownload();
|
||||
LoadRunningTasks();
|
||||
LoadFinishedTasks();
|
||||
|
|
|
|||
Loading…
Reference in New Issue