mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Add error indicator to compiler UI
This commit is contained in:
parent
843d115b9d
commit
8b6d4651f4
@ -213,6 +213,23 @@
|
||||
<local:MO2CompilerConfigView x:Name="CompilerConfigView" Grid.Row="1" Grid.Column="1" />
|
||||
<local:BeginButton Grid.Row="0" Grid.RowSpan="3" Grid.Column="5"
|
||||
x:Name="BeginButton" />
|
||||
<icon:PackIconFontAwesome Grid.Row="2"
|
||||
Grid.Column="5"
|
||||
x:Name="ErrorSummaryIconGlow"
|
||||
HorizontalAlignment="Center"
|
||||
Foreground="{StaticResource WarningBrush}"
|
||||
Kind="ExclamationTriangleSolid"
|
||||
Opacity="0.6">
|
||||
<icon:PackIconFontAwesome.Effect>
|
||||
<BlurEffect Radius="15" />
|
||||
</icon:PackIconFontAwesome.Effect>
|
||||
</icon:PackIconFontAwesome>
|
||||
<icon:PackIconFontAwesome Grid.Row="2"
|
||||
Grid.Column="5"
|
||||
x:Name="ErrorSummaryIcon"
|
||||
HorizontalAlignment="Center"
|
||||
Foreground="{StaticResource WarningBrush}"
|
||||
Kind="ExclamationTriangleSolid" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="5"
|
||||
|
@ -76,6 +76,7 @@ internal class Program
|
||||
services.AddSingleton<IVerb, Extract>();
|
||||
services.AddSingleton<IVerb, DumpZipInfo>();
|
||||
services.AddSingleton<IVerb, Install>();
|
||||
services.AddSingleton<IVerb, Compile>();
|
||||
services.AddSingleton<IVerb, InstallCompileInstallVerify>();
|
||||
services.AddSingleton<IVerb, HashUrlString>();
|
||||
services.AddSingleton<IVerb, DownloadAll>();
|
||||
|
72
Wabbajack.CLI/Verbs/Compile.cs
Normal file
72
Wabbajack.CLI/Verbs/Compile.cs
Normal file
@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.CommandLine;
|
||||
using System.CommandLine.Invocation;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Wabbajack.Compiler;
|
||||
using Wabbajack.Downloaders;
|
||||
using Wabbajack.Downloaders.GameFile;
|
||||
using Wabbajack.DTOs.JsonConverters;
|
||||
using Wabbajack.Networking.WabbajackClientApi;
|
||||
using Wabbajack.Paths;
|
||||
using Wabbajack.VFS;
|
||||
|
||||
namespace Wabbajack.CLI.Verbs;
|
||||
|
||||
public class Compile : IVerb
|
||||
{
|
||||
private readonly ILogger<Compile> _logger;
|
||||
private readonly Client _wjClient;
|
||||
private readonly DownloadDispatcher _dispatcher;
|
||||
private readonly DTOSerializer _dtos;
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly FileHashCache _cache;
|
||||
private readonly GameLocator _gameLocator;
|
||||
private readonly CompilerSettingsInferencer _inferencer;
|
||||
|
||||
public Compile(ILogger<Compile> logger, Client wjClient, DownloadDispatcher dispatcher, DTOSerializer dtos,
|
||||
FileHashCache cache, GameLocator gameLocator, IServiceProvider serviceProvider, CompilerSettingsInferencer inferencer)
|
||||
{
|
||||
_logger = logger;
|
||||
_wjClient = wjClient;
|
||||
_dispatcher = dispatcher;
|
||||
_dtos = dtos;
|
||||
_serviceProvider = serviceProvider;
|
||||
_cache = cache;
|
||||
_gameLocator = gameLocator;
|
||||
_inferencer = inferencer;
|
||||
}
|
||||
|
||||
public Command MakeCommand()
|
||||
{
|
||||
var command = new Command("compile");
|
||||
command.Add(new Option<AbsolutePath>(new[] {"-i", "-installPath"}, "Install Path"));
|
||||
command.Add(new Option<AbsolutePath>(new[] {"-o", "-output"}, "Output"));
|
||||
command.Description = "Installs a modlist, compiles it, installs it again, verifies it";
|
||||
command.Handler = CommandHandler.Create(Run);
|
||||
return command;
|
||||
}
|
||||
|
||||
public async Task<int> Run(AbsolutePath installPath, AbsolutePath outputPath,
|
||||
CancellationToken token)
|
||||
{
|
||||
_logger.LogInformation("Inferring settings");
|
||||
var inferredSettings = await _inferencer.InferFromRootPath(installPath);
|
||||
if (inferredSettings == null)
|
||||
{
|
||||
_logger.LogInformation("Error inferencing settings");
|
||||
return 2;
|
||||
}
|
||||
|
||||
inferredSettings.UseGamePaths = true;
|
||||
|
||||
var compiler = MO2Compiler.Create(_serviceProvider, inferredSettings);
|
||||
var result = await compiler.Begin(token);
|
||||
if (!result)
|
||||
return result ? 0 : 3;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user