mirror of
https://github.com/JuniorDark/RustyHearts-Launcher.git
synced 2026-05-07 05:21:44 -04:00
Updated dependencies
Replaced deprecated DotNetZip with System.IO.Compression. Changed target framework to net 9.0. Removed DotNetZip package reference. Updated Microsoft.Web.WebView2 to 1.0.2903.40. Updated WindowsAPICodePack to 8.0.6.
This commit is contained in:
parent
3648b49bb3
commit
7849b2001a
8 changed files with 91 additions and 80 deletions
|
|
@ -1,4 +1,4 @@
|
|||
using Ionic.Zip;
|
||||
using System.IO.Compression;
|
||||
using RHLauncher.RHLauncher.Helper;
|
||||
using RHLauncher.RHLauncher.i8n;
|
||||
using System.Diagnostics;
|
||||
|
|
@ -51,10 +51,10 @@ namespace RHLauncher.RHLauncher.Http
|
|||
Directory.CreateDirectory(downloadDir);
|
||||
}
|
||||
|
||||
List<string> filesToBeDownloaded = new();
|
||||
List<string> filesToBeDownloaded = [];
|
||||
long totalBytesToDownload = 0L;
|
||||
|
||||
List<string> lines = filelistText.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
List<string> lines = [.. filelistText.Split(['\r', '\n'], StringSplitOptions.RemoveEmptyEntries)];
|
||||
int totalLines = lines.Count;
|
||||
int checkedFiles = 0;
|
||||
|
||||
|
|
@ -146,14 +146,14 @@ namespace RHLauncher.RHLauncher.Http
|
|||
|
||||
private static async Task<string> UnzipFilesAsync(string sourceDirectory, string destinationDirectory, IProgress<ProgressReport> progress, CancellationToken cancellationToken)
|
||||
{
|
||||
string[] fileEntries = Directory.GetFiles(sourceDirectory, "*.zip.*").OrderBy(f => f).ToArray();
|
||||
string[] fileEntries = [.. Directory.GetFiles(sourceDirectory, "*.zip.*").OrderBy(f => f)];
|
||||
string rhExeDirectoryPath = "";
|
||||
|
||||
// Calculate total uncompressed size of all files in all zip archives
|
||||
long totalUncompressedSize = fileEntries.Sum(file =>
|
||||
{
|
||||
using ZipFile zip = ZipFile.Read(file);
|
||||
return zip.Entries.Sum(entry => entry.UncompressedSize);
|
||||
using ZipArchive zip = ZipFile.OpenRead(file);
|
||||
return zip.Entries.Sum(entry => entry.Length);
|
||||
});
|
||||
long totalExtracted = 0;
|
||||
|
||||
|
|
@ -163,26 +163,26 @@ namespace RHLauncher.RHLauncher.Http
|
|||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
using ZipFile zip = ZipFile.Read(file);
|
||||
foreach (var entry in zip)
|
||||
using ZipArchive zip = ZipFile.OpenRead(file);
|
||||
foreach (var entry in zip.Entries)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
string destinationPath = Path.Combine(destinationDirectory, entry.FileName);
|
||||
string destinationPath = Path.Combine(destinationDirectory, entry.FullName);
|
||||
string? directoryPath = Path.GetDirectoryName(destinationPath);
|
||||
if (!string.IsNullOrEmpty(directoryPath) && !Directory.Exists(directoryPath))
|
||||
{
|
||||
Directory.CreateDirectory(directoryPath);
|
||||
}
|
||||
|
||||
entry.Extract(destinationDirectory, ExtractExistingFileAction.OverwriteSilently);
|
||||
totalExtracted += entry.UncompressedSize;
|
||||
entry.ExtractToFile(destinationPath, true);
|
||||
totalExtracted += entry.Length;
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
ProgressReporter.ReportUnzipProgress(progress, totalExtracted, totalUncompressedSize, cancellationToken);
|
||||
|
||||
// Check if the current entry is "rustyhearts.exe" and store its directory path
|
||||
if (entry.FileName.EndsWith("rustyhearts.exe", StringComparison.OrdinalIgnoreCase))
|
||||
if (entry.FullName.EndsWith("rustyhearts.exe", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
rhExeDirectoryPath = Path.GetDirectoryName(destinationPath) ?? "";
|
||||
}
|
||||
|
|
@ -217,7 +217,5 @@ namespace RHLauncher.RHLauncher.Http
|
|||
throw new FileNotFoundException($"{LocalizedStrings.ClientFolderExeErrorMessage}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue