Fixed warnings

This commit is contained in:
Thorsten Sommer 2026-06-11 15:23:31 +02:00
parent d87342869d
commit ec7c83adfa
Signed by untrusted user who does not match committer: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -7,6 +7,11 @@ namespace Build.Commands;
public static class Pdfium public static class Pdfium
{ {
private static readonly HttpClient CLIENT = new()
{
Timeout = TimeSpan.FromMinutes(5)
};
public static async Task InstallAsync(RID rid, string version, bool offline) public static async Task InstallAsync(RID rid, string version, bool offline)
{ {
Console.Write($"- Installing Pdfium {version} for {rid.ToUserFriendlyName()} ..."); Console.Write($"- Installing Pdfium {version} for {rid.ToUserFriendlyName()} ...");
@ -42,8 +47,7 @@ public static class Pdfium
// Download the file: // Download the file:
// //
Console.Write(" downloading ..."); Console.Write(" downloading ...");
using var client = new HttpClient(); using var response = await CLIENT.GetAsync(pdfiumUrl, HttpCompletionOption.ResponseHeadersRead);
using var response = await client.GetAsync(pdfiumUrl, HttpCompletionOption.ResponseHeadersRead);
if (!response.IsSuccessStatusCode) if (!response.IsSuccessStatusCode)
{ {
Console.WriteLine($" failed to download Pdfium {version} for {rid.ToUserFriendlyName()} from {pdfiumUrl}"); Console.WriteLine($" failed to download Pdfium {version} for {rid.ToUserFriendlyName()} from {pdfiumUrl}");
@ -61,9 +65,9 @@ public static class Pdfium
{ {
await using var downloadStream = await response.Content.ReadAsStreamAsync(); await using var downloadStream = await response.Content.ReadAsStreamAsync();
await using var uncompressedStream = new GZipStream(downloadStream, CompressionMode.Decompress); await using var uncompressedStream = new GZipStream(downloadStream, CompressionMode.Decompress);
await using var tarReader = new TarReader(uncompressedStream, false); await using var tarReader = new TarReader(uncompressedStream);
while (await tarReader.GetNextEntryAsync(false) is { } entry) while (await tarReader.GetNextEntryAsync() is { } entry)
{ {
if (!string.Equals(entry.Name.Replace('\\', '/'), pdfiumLibArchivePath, StringComparison.Ordinal)) if (!string.Equals(entry.Name.Replace('\\', '/'), pdfiumLibArchivePath, StringComparison.Ordinal))
continue; continue;