From 431b00fa50d90fa755c772443d785626cace3a6e Mon Sep 17 00:00:00 2001 From: Timothy Baldridge Date: Sun, 25 Sep 2022 17:07:54 -0600 Subject: [PATCH] Fix file extraction progress bars not displaying properly (and going away) --- CHANGELOG.md | 1 + Wabbajack.Compiler/ACompiler.cs | 11 ++++++++--- Wabbajack.FileExtractor/FileExtractor.cs | 5 ++--- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b3c71dc..0a1f5b2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * Massively improve patch load times * Massively improve patch build times * Reduce situations where the UI appears to be hung due the above two issues +* Fix file extraction progress bars not displaying properly (and going away) #### Version - 3.0.1.4 - 9/21/2022 diff --git a/Wabbajack.Compiler/ACompiler.cs b/Wabbajack.Compiler/ACompiler.cs index 0c2ce8d2..b1180bd7 100644 --- a/Wabbajack.Compiler/ACompiler.cs +++ b/Wabbajack.Compiler/ACompiler.cs @@ -473,13 +473,18 @@ public abstract class ACompiler NextStep("Compiling", "Generating Patches", toBuild.Length); - var allFiles = toBuild.SelectMany(f => new[] + var allFiles = toBuild.SelectMany(f => { - _vfs.Index.FileForArchiveHashPath(f.ArchiveHashPath), - FindDestFile(f.To) + UpdateProgress(1); + return new[] + { + _vfs.Index.FileForArchiveHashPath(f.ArchiveHashPath), + FindDestFile(f.To) + }; }) .DistinctBy(f => f.Hash) .ToHashSet(); + _logger.LogInformation("Extracting {Count} ({Size}) files for building patches", allFiles.Count, allFiles.Sum(f => f.Size).ToFileSizeString()); diff --git a/Wabbajack.FileExtractor/FileExtractor.cs b/Wabbajack.FileExtractor/FileExtractor.cs index 6711ff94..338d48fb 100644 --- a/Wabbajack.FileExtractor/FileExtractor.cs +++ b/Wabbajack.FileExtractor/FileExtractor.cs @@ -13,7 +13,6 @@ using OMODFramework; using Wabbajack.Common; using Wabbajack.Common.FileSignatures; using Wabbajack.Compression.BSA; -using Wabbajack.Compression.BSA.FO4Archive; using Wabbajack.DTOs.Streams; using Wabbajack.FileExtractor.ExtractedFiles; using Wabbajack.IO.Async; @@ -343,8 +342,8 @@ public class FileExtractor if (!int.TryParse(line[..3], out var percentInt)) return; - var oldPosition = lastPercent == 0 ? 0 : totalSize / lastPercent; - var newPosition = percentInt == 0 ? 0 : totalSize / percentInt; + var oldPosition = lastPercent == 0 ? 0 : totalSize / 100 * lastPercent; + var newPosition = percentInt == 0 ? 0 : totalSize / 100 * percentInt; var throughput = newPosition - oldPosition; job.ReportNoWait((int) throughput);