Skip to content

Commit

Permalink
UseCookies = false
Browse files Browse the repository at this point in the history
  • Loading branch information
qhy040404 committed Jun 25, 2024
1 parent b81ef22 commit 4ca20b5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.2</version>
<authors>DGP Studio</authors>
<developmentDependency>true</developmentDependency>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
Expand Down
Binary file modified src/Snap.Hutao.Deployment.Runtime/Snap.Hutao.Deployment.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion src/Snap.Hutao.Deployment/Invocation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static async Task RunDeploymentAsync(InvocationContext context)
ArgumentException.ThrowIfNullOrEmpty(path);

Console.WriteLine($"""
Snap Hutao Deployment Tool [1.16.1]
Snap Hutao Deployment Tool [1.16.2]
PackagePath: {path}
FamilyName: {name}
------------------------------------------------------------
Expand Down
25 changes: 14 additions & 11 deletions src/Snap.Hutao.Deployment/Package.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,23 @@ public static bool EnsurePackage(string packagePath)

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);
}
}
}

Expand Down

0 comments on commit 4ca20b5

Please sign in to comment.