mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
0c11f11839
* added more visible error messages to avoid user confusion added hard drive free space detection, added red error message text, removed overwrite checkbox, added wiki button link extended the error text for starting wabbajack in protected location removed debug code shortened error message to fit in text box * restored warning removed in error, updated changelog, removed debug includes * Update InstallerVM.cs * Update InstallerVM.cs * Update MainWindowViewModel.cs * added json optional flag to only show version number over modlist image in installer view, if the modlist image already contains the title removed debug code change to pascal case and match existing code style update changelog * Fix manual downloads sometimes launching in browser * Fix manual downloads from secure servers * Remove duplicate user agent code * Create configuration project and performance settings * Bind new performance settings to UI * Use performance settings to limit maximum memory per download * Remove unused settings and related classes * Updated CHANGELOG.md * update CHANGELOG.md * moved the existing files popup to an error message , heralding the return of the overwrite install checkbox * added newline * reverted erroneous edit * gogID for fallout4 added * update CHANGELOG.md * Fix deadlock when loading new settings * change folder/directory check logic * update CHANGELOG.md * revert unnecessary change * update CHANGELOG.md * Bump Wabbajack to .NET 7 * Bump ReactiveUI packages & deps * Update GameFinder to 4.0.0 * Update CHANGELOG.md * Update CHANGELOG.md * Don't try to add cookies if array is empty * Start download from scratch if .download_package can't be parsed * Log when application is shutting down * update CHANGELOG.md * exclude the "SP Consent Message" on nexus from the cleared iframes * Actually use the --outputPath compile option if the user provides one It was just not being used, defaulting to the parent of installPath. it still does, if the user does not specify a directory using --outputPath * update Wabbajack.Compression.BSA dependencies * improve log message to include storage space reference * clearing temp folder when the app closes * update logging message * update CHANGELOG.md * update CHANGELOG.md * update logging for possible exceptions thrown when clearing temp folder * fix cloudflare captcha --------- Co-authored-by: JanuarySnow <bobfordiscord12@gmail.com> Co-authored-by: JanuarySnow <85711747+JanuarySnow@users.noreply.github.com> Co-authored-by: UrbanCMC <UrbanCMC@web.de> Co-authored-by: trawzified <55751269+tr4wzified@users.noreply.github.com> Co-authored-by: Marco Antonio Jaguaribe Costa <marco.antonio.costa@gmail.com> Co-authored-by: Timothy Baldridge <tbaldridge@gmail.com>
75 lines
2.6 KiB
C#
75 lines
2.6 KiB
C#
using System;
|
|
using System.CommandLine;
|
|
using System.CommandLine.NamingConventionBinder;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.Extensions.Logging;
|
|
using Wabbajack.CLI.Builder;
|
|
using Wabbajack.Compiler;
|
|
using Wabbajack.Downloaders;
|
|
using Wabbajack.Downloaders.GameFile;
|
|
using Wabbajack.DTOs.JsonConverters;
|
|
using Wabbajack.Networking.WabbajackClientApi;
|
|
using Wabbajack.Paths;
|
|
using Wabbajack.Paths.IO;
|
|
using Wabbajack.VFS;
|
|
|
|
namespace Wabbajack.CLI.Verbs;
|
|
|
|
public class Compile
|
|
{
|
|
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 static VerbDefinition Definition = new("compile", "Compiles a modlist",
|
|
new[]
|
|
{
|
|
new OptionDefinition(typeof(AbsolutePath), "i", "installPath", "Install Path"),
|
|
new OptionDefinition(typeof(AbsolutePath), "o", "outputPath", "OutputPath")
|
|
});
|
|
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;
|
|
|
|
if(outputPath.DirectoryExists())
|
|
{
|
|
inferredSettings.OutputFile = outputPath.Combine(inferredSettings.OutputFile.FileName);
|
|
_logger.LogInformation("Output file will be in: {outputPath}", inferredSettings.OutputFile);
|
|
}
|
|
|
|
var compiler = MO2Compiler.Create(_serviceProvider, inferredSettings);
|
|
var result = await compiler.Begin(token);
|
|
if (!result)
|
|
return result ? 0 : 3;
|
|
|
|
return 0;
|
|
}
|
|
} |