diff --git a/Wabbajack.Installer/AInstaller.cs b/Wabbajack.Installer/AInstaller.cs index bc962a22..02e38ab1 100644 --- a/Wabbajack.Installer/AInstaller.cs +++ b/Wabbajack.Installer/AInstaller.cs @@ -120,7 +120,7 @@ public abstract class AInstaller ExtractedModlistFolder = _manager.CreateFolder(); await using var stream = _configuration.ModlistArchive.Open(FileMode.Open, FileAccess.Read, FileShare.Read); using var archive = new ZipArchive(stream, ZipArchiveMode.Read); - NextStep("Preparing","Extracting Modlist", archive.Entries.Count); + NextStep(Consts.StepPreparing,"Extracting Modlist", archive.Entries.Count); foreach (var entry in archive.Entries) { var path = entry.FullName.ToRelativePath().RelativeTo(ExtractedModlistFolder); @@ -182,7 +182,7 @@ public abstract class AInstaller /// protected async Task PrimeVFS() { - NextStep("Preparing","Priming VFS", 0); + NextStep(Consts.StepPreparing,"Priming VFS", 0); _vfs.AddKnown(_configuration.ModList.Directives.OfType().Select(d => d.ArchiveHashPath), HashedArchives); await _vfs.BackfillMissing(); @@ -190,7 +190,7 @@ public abstract class AInstaller public async Task BuildFolderStructure() { - NextStep("Preparing", "Building Folder Structure", 0); + NextStep(Consts.StepPreparing, "Building Folder Structure", 0); _logger.LogInformation("Building Folder Structure"); ModList.Directives .Where(d => d.To.Depth > 1) @@ -201,7 +201,7 @@ public abstract class AInstaller public async Task InstallArchives(CancellationToken token) { - NextStep("Installing", "Installing files", ModList.Directives.Sum(d => d.Size)); + NextStep(Consts.StepInstalling, "Installing files", ModList.Directives.Sum(d => d.Size)); var grouped = ModList.Directives .OfType() .Select(a => new {VF = _vfs.Index.FileForArchiveHashPath(a.ArchiveHashPath), Directive = a}) @@ -302,15 +302,15 @@ public abstract class AInstaller } } - _logger.LogInformation("Downloading {count} archives", missing.Count); - NextStep("Downloading", "Downloading files", missing.Count); + _logger.LogInformation("Downloading {Count} archives", missing.Count.ToString()); + NextStep(Consts.StepDownloading, "Downloading files", missing.Count); await missing .OrderBy(a => a.Size) .Where(a => a.State is not Manual) .PDoAll(async archive => { - _logger.LogInformation("Downloading {archive}", archive.Name); + _logger.LogInformation("Downloading {Archive}", archive.Name); var outputPath = _configuration.Downloads.Combine(archive.Name); if (download) @@ -364,7 +364,7 @@ public abstract class AInstaller public async Task HashArchives(CancellationToken token) { - NextStep("Hashing", "Hashing Archives", 0); + NextStep(Consts.StepHashing, "Hashing Archives", 0); _logger.LogInformation("Looking for files to hash"); var allFiles = _configuration.Downloads.EnumerateFiles() @@ -415,7 +415,7 @@ public abstract class AInstaller var savePath = (RelativePath) "saves"; var existingFiles = _configuration.Install.EnumerateFiles().ToList(); - NextStep("Preparing", "Looking for files to delete", existingFiles.Count); + NextStep(Consts.StepPreparing, "Looking for files to delete", existingFiles.Count); await existingFiles .PDoAll(async f => { @@ -434,7 +434,7 @@ public abstract class AInstaller }); _logger.LogInformation("Cleaning empty folders"); - NextStep("Preparing", "Cleaning empty folders", indexed.Keys.Count); + NextStep(Consts.StepPreparing, "Cleaning empty folders", indexed.Keys.Count); var expectedFolders = (indexed.Keys .Select(f => f.RelativeTo(_configuration.Install)) // We ignore the last part of the path, so we need a dummy file name @@ -469,7 +469,7 @@ public abstract class AInstaller var existingfiles = _configuration.Install.EnumerateFiles().ToHashSet(); - NextStep("Preparing", "Removing redundant directives", indexed.Count); + NextStep(Consts.StepPreparing, "Removing redundant directives", indexed.Count); await indexed.Values.PMapAll(async d => { // Bit backwards, but we want to return null for @@ -488,7 +488,7 @@ public abstract class AInstaller _logger.LogInformation("Optimized {optimized} directives to {indexed} required", ModList.Directives.Length, indexed.Count); - NextStep("Preparing", "Finalizing modlist optimization", 0); + NextStep(Consts.StepPreparing, "Finalizing modlist optimization", 0); var requiredArchives = indexed.Values.OfType() .GroupBy(d => d.ArchiveHashPath.Hash) .Select(d => d.Key) diff --git a/Wabbajack.Installer/Consts.cs b/Wabbajack.Installer/Consts.cs index d3ef7b15..a4c81009 100644 --- a/Wabbajack.Installer/Consts.cs +++ b/Wabbajack.Installer/Consts.cs @@ -2,7 +2,7 @@ using Wabbajack.Paths; namespace Wabbajack.Installer; -public class Consts +public static class Consts { public static string GAME_PATH_MAGIC_BACK = "{--||GAME_PATH_MAGIC_BACK||--}"; public static string GAME_PATH_MAGIC_DOUBLE_BACK = "{--||GAME_PATH_MAGIC_DOUBLE_BACK||--}"; @@ -20,4 +20,10 @@ public class Consts public static RelativePath MO2ModFolderName = "mods".ToRelativePath(); public static RelativePath MO2ProfilesFolderName = "profiles".ToRelativePath(); + + public const string StepPreparing = "Preparing"; + public const string StepInstalling = "Installing"; + public const string StepDownloading = "Downloading"; + public const string StepHashing = "Hashing"; + public const string StepFinished = "Finished"; } \ No newline at end of file diff --git a/Wabbajack.Installer/StandardInstaller.cs b/Wabbajack.Installer/StandardInstaller.cs index 13de952a..2be0601f 100644 --- a/Wabbajack.Installer/StandardInstaller.cs +++ b/Wabbajack.Installer/StandardInstaller.cs @@ -61,7 +61,7 @@ public class StandardInstaller : AInstaller { if (token.IsCancellationRequested) return false; await _wjClient.SendMetric(MetricNames.BeginInstall, ModList.Name); - NextStep("Preparing", "Configuring Installer", 0); + NextStep(Consts.StepPreparing, "Configuring Installer", 0); _logger.LogInformation("Configuring Processor"); if (_configuration.GameFolder == default) @@ -145,7 +145,7 @@ public class StandardInstaller : AInstaller await ExtractedModlistFolder!.DisposeAsync(); await _wjClient.SendMetric(MetricNames.FinishInstall, ModList.Name); - NextStep("Finished", "Finished", 1); + NextStep(Consts.StepFinished, "Finished", 1); _logger.LogInformation("Finished Installation"); return true; } @@ -275,7 +275,7 @@ public class StandardInstaller : AInstaller private async Task InstallIncludedFiles(CancellationToken token) { _logger.LogInformation("Writing inline files"); - NextStep("Installing", "Installing Included Files", ModList.Directives.OfType().Count()); + NextStep(Consts.StepInstalling, "Installing Included Files", ModList.Directives.OfType().Count()); await ModList.Directives .OfType() .PDoAll(async directive =>