From 8de7067453d81569a7aeaa7e496fa0a2f99ee093 Mon Sep 17 00:00:00 2001 From: Salvador Cipolla Date: Sat, 11 Apr 2026 00:40:17 -0300 Subject: [PATCH] Re-add crc check limit for preparepkg and check task cancelled (H10 fix) --- Knossos.NET/ViewModels/Templates/Tasks/PrepareModPkg.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Knossos.NET/ViewModels/Templates/Tasks/PrepareModPkg.cs b/Knossos.NET/ViewModels/Templates/Tasks/PrepareModPkg.cs index f691253f..3060ca1a 100644 --- a/Knossos.NET/ViewModels/Templates/Tasks/PrepareModPkg.cs +++ b/Knossos.NET/ViewModels/Templates/Tasks/PrepareModPkg.cs @@ -25,7 +25,7 @@ private async Task PrepareModPkg(ModPackage pkg, string modFullPath, Cance IsTextTask = false; IsFileDownloadTask = false; Name = "Prepare Pkg: " + pkg.name; - //var maxCrcAttempts = 5; //How many times try to compress a pkg with 7z in case of CRC error (LIMIT DISABLED) + var maxCrcAttempts = 25; //How many times try to compress a pkg with 7z in case of CRC error if (cancelSource != null) cancellationTokenSource = cancelSource; @@ -121,21 +121,22 @@ private async Task PrepareModPkg(ModPackage pkg, string modFullPath, Cance crcResult = await compressor.VerifyFile(zipPath); if (!crcResult) { - /* if(crcAttempt >= maxCrcAttempts) { Log.Add(Log.LogSeverity.Error, "TaskItemViewModel.PrepareModPkg()", "CRC error on file: " + zipPath + ". Max attempts reached, cancelling upload..."); throw new TaskCanceledException(); } - */ Log.Add(Log.LogSeverity.Error, "TaskItemViewModel.PrepareModPkg()", "CRC error on file: " + zipPath + ". Retrying..."); ProgressBarMax = 100; ProgressCurrent = 0; Info = "Retry: Compressing (7z)"; KnUtils.DeleteFileSafe(zipPath); crcAttempt++; + await Task.Delay(1000); } } + if (cancellationTokenSource.IsCancellationRequested) + throw new TaskCanceledException(); } while (!crcResult); Log.Add(Log.LogSeverity.Information, "TaskItemViewModel.PrepareModPkg()", "CRC Verify OK on File: " + zipPath); }