Fix compiler status text

This commit is contained in:
Timothy Baldridge 2022-09-25 21:35:53 -06:00
parent 431b00fa50
commit 96cf38a596
3 changed files with 11 additions and 8 deletions

View File

@ -307,7 +307,7 @@ namespace Wabbajack
.Subscribe(update =>
{
var s = update.EventArgs;
StatusText = $"[{s.StepsProgress}] {s.StatusText}";
StatusText = $"[Step {s.CurrentStep}] {s.StatusText}";
StatusProgress = s.StepProgress;
});

View File

@ -121,7 +121,7 @@ public abstract class ACompiler
if (OnStatusUpdate != null)
OnStatusUpdate(this, new StatusUpdate(statusCategory, statusText,
Percent.FactoryPutInRange(_currentStep, MaxSteps),
Percent.Zero));
Percent.Zero, _currentStep));
}
public void UpdateProgress(long stepProgress)
@ -136,7 +136,7 @@ public abstract class ACompiler
if (OnStatusUpdate != null)
OnStatusUpdate(this, new StatusUpdate(_statusCategory, _statusText, Percent.FactoryPutInRange(_currentStep, MaxSteps),
Percent.FactoryPutInRange(_currentStepProgress, _maxStepProgress)));
Percent.FactoryPutInRange(_currentStepProgress, _maxStepProgress), _currentStep));
}
public void UpdateProgressAbsolute(long cur, long max)
@ -152,7 +152,7 @@ public abstract class ACompiler
if (OnStatusUpdate != null)
OnStatusUpdate(this, new StatusUpdate(_statusCategory, _statusText, Percent.FactoryPutInRange(_currentStep, MaxSteps),
Percent.FactoryPutInRange(_currentStepProgress, _maxStepProgress)));
Percent.FactoryPutInRange(_currentStepProgress, _maxStepProgress), _currentStep));
}
public abstract Task<bool> Begin(CancellationToken token);
@ -396,12 +396,15 @@ public abstract class ACompiler
_settings.OutputFile.Delete();
var allFiles = _stagingFolder.EnumerateFiles().ToList();
NextStep("Finalizing", "Writing Wabbajack File", allFiles.Count);
await using (var fs = _settings.OutputFile.Open(FileMode.Create, FileAccess.Write))
{
using var za = new ZipArchive(fs, ZipArchiveMode.Create);
foreach (var f in _stagingFolder.EnumerateFiles())
foreach (var f in allFiles)
{
UpdateProgress(1);
var ze = za.CreateEntry((string) f.FileName);
await using var os = ze.Open();
await using var ins = f.Open(FileMode.Open);

View File

@ -26,7 +26,7 @@ using Wabbajack.VFS;
namespace Wabbajack.Installer;
public record StatusUpdate(string StatusCategory, string StatusText, Percent StepsProgress, Percent StepProgress)
public record StatusUpdate(string StatusCategory, string StatusText, Percent StepsProgress, Percent StepProgress, int CurrentStep)
{
}
@ -113,7 +113,7 @@ public abstract class AInstaller<T>
_logger.LogInformation("Next Step: {Step}", statusText);
OnStatusUpdate?.Invoke(new StatusUpdate(statusCategory, statusText,
Percent.FactoryPutInRange(_currentStep, MaxSteps), Percent.Zero));
Percent.FactoryPutInRange(_currentStep, MaxSteps), Percent.Zero, _currentStep));
}
public void UpdateProgress(long stepProgress)
@ -122,7 +122,7 @@ public abstract class AInstaller<T>
OnStatusUpdate?.Invoke(new StatusUpdate(_statusCategory, $"[{_currentStep}/{MaxSteps}] {_statusText} ({_statusFormatter(_currentStepProgress)}/{_statusFormatter(MaxStepProgress)})",
Percent.FactoryPutInRange(_currentStep, MaxSteps),
Percent.FactoryPutInRange(_currentStepProgress, MaxStepProgress)));
Percent.FactoryPutInRange(_currentStepProgress, MaxStepProgress), _currentStep));
}
public abstract Task<bool> Begin(CancellationToken token);