-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a9ab3fa
commit 330cc40
Showing
13 changed files
with
408 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace MinecraftLaunch.Classes.Enums; | ||
|
||
public enum DownloadResultType { | ||
Successful, | ||
Cancelled, | ||
Failed | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,21 @@ | ||
namespace MinecraftLaunch.Classes.Interfaces; | ||
using MinecraftLaunch.Classes.Models.Download; | ||
|
||
namespace MinecraftLaunch.Classes.Interfaces; | ||
|
||
/// <summary> | ||
/// 下载器统一接口 | ||
/// </summary> | ||
public interface IDownloader { | ||
/// <summary> | ||
/// 单个文件下载 | ||
/// </summary> | ||
Task<DownloadResult> DownloadFileAsync(DownloadRequest request, CancellationToken cancellationToken = default); | ||
|
||
/// <summary> | ||
/// 异步下载方法 | ||
/// 多个文件下载 | ||
/// </summary> | ||
ValueTask<bool> DownloadAsync(); | ||
/// <param name="request"></param> | ||
/// <param name="cancellationToken"></param> | ||
/// <returns></returns> | ||
Task<GroupDownloadResult> DownloadFilesAsync(GroupDownloadRequest request, CancellationToken cancellationToken = default); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using MinecraftLaunch.Classes.Enums; | ||
using System.Collections.Frozen; | ||
|
||
namespace MinecraftLaunch.Classes.Models.Download; | ||
|
||
public record DownloadResult { | ||
public DownloadResultType Type { get; init; } | ||
|
||
public Exception? Exception { get; init; } | ||
|
||
public DownloadResult(DownloadResultType type) { | ||
Type = type; | ||
} | ||
} | ||
|
||
public record GroupDownloadResult { | ||
public required DownloadResultType Type { get; init; } | ||
public required FrozenDictionary<DownloadRequest, DownloadResult> Failed { get; init; } | ||
} |
Oops, something went wrong.