3 Commits

Author SHA1 Message Date
qhy040404
5947280fe3 1.16.3 2024-06-25 22:48:44 +08:00
qhy040404
4ca20b57e3 UseCookies = false 2024-06-25 22:43:49 +08:00
DismissedLight
b81ef222bd Merge pull request #8 from DGP-Studio/feat/corrupted 2024-05-14 23:43:56 +08:00
4 changed files with 16 additions and 13 deletions

View File

@@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>Snap.Hutao.Deployment.Runtime</id>
<version>1.16.1</version>
<version>1.16.3</version>
<authors>DGP Studio</authors>
<developmentDependency>true</developmentDependency>
<requireLicenseAcceptance>false</requireLicenseAcceptance>

View File

@@ -23,7 +23,7 @@ internal static partial class Invocation
ArgumentException.ThrowIfNullOrEmpty(path);
Console.WriteLine($"""
Snap Hutao Deployment Tool [1.16.1]
Snap Hutao Deployment Tool [1.16.3]
PackagePath: {path}
FamilyName: {name}
------------------------------------------------------------

View File

@@ -34,20 +34,23 @@ internal static class Package
public static async Task DownloadPackageAsync(string packagePath)
{
using (HttpClient httpClient = new())
using (HttpClientHandler handler = new() { UseCookies = false })
{
HttpShardCopyWorkerOptions<DownloadStatus> options = new()
using (HttpClient httpClient = new(handler))
{
HttpClient = httpClient,
SourceUrl = "https://api.snapgenshin.com/patch/hutao/download",
DestinationFilePath = packagePath,
StatusFactory = (bytesRead, totalBytes) => new DownloadStatus(bytesRead, totalBytes),
};
HttpShardCopyWorkerOptions<DownloadStatus> options = new()
{
HttpClient = httpClient,
SourceUrl = "https://api.snapgenshin.com/patch/hutao/download",
DestinationFilePath = packagePath,
StatusFactory = (bytesRead, totalBytes) => new DownloadStatus(bytesRead, totalBytes),
};
using (HttpShardCopyWorker<DownloadStatus> worker = await HttpShardCopyWorker<DownloadStatus>.CreateAsync(options).ConfigureAwait(false))
{
Progress<DownloadStatus> progress = new(ConsoleWriteProgress);
await worker.CopyAsync(progress).ConfigureAwait(false);
using (HttpShardCopyWorker<DownloadStatus> worker = await HttpShardCopyWorker<DownloadStatus>.CreateAsync(options).ConfigureAwait(false))
{
Progress<DownloadStatus> progress = new(ConsoleWriteProgress);
await worker.CopyAsync(progress).ConfigureAwait(false);
}
}
}