AInstaller ctor parameters made more picky for required input

This commit is contained in:
Justin Swanson 2019-12-01 14:22:33 -06:00
parent 57c421967d
commit 5bb291a310
7 changed files with 54 additions and 29 deletions

View File

@ -18,15 +18,23 @@ namespace Wabbajack.Lib
{
public bool IgnoreMissingFiles { get; internal set; } = false;
public string OutputFolder { get; set; }
public string DownloadFolder { get; set; }
public string OutputFolder { get; private set; }
public string DownloadFolder { get; private set; }
public ModManager ModManager;
public abstract ModManager ModManager { get; }
public string ModListArchive { get; internal set; }
public ModList ModList { get; internal set; }
public string ModListArchive { get; private set; }
public ModList ModList { get; private set; }
public Dictionary<string, string> HashedArchives { get; set; }
public AInstaller(string archive, ModList modList, string outputFolder, string downloadFolder)
{
ModList = modList;
ModListArchive = archive;
OutputFolder = outputFolder;
DownloadFolder = downloadFolder;
}
public void Info(string msg)
{
Utils.Log(msg);

View File

@ -17,17 +17,19 @@ namespace Wabbajack.Lib
{
public bool WarnOnOverwrite { get; set; } = true;
public MO2Installer(string archive, ModList modList, string outputFolder)
{
ModManager = ModManager.MO2;
ModListArchive = archive;
OutputFolder = outputFolder;
DownloadFolder = Path.Combine(OutputFolder, "downloads");
ModList = modList;
}
public override ModManager ModManager => ModManager.MO2;
public string GameFolder { get; set; }
public MO2Installer(string archive, ModList modList, string outputFolder, string downloadFolder)
: base(
archive: archive,
modList: modList,
outputFolder: outputFolder,
downloadFolder: downloadFolder)
{
}
protected override bool _Begin()
{
ConfigureProcessor(17, RecommendQueueSize());

View File

@ -10,14 +10,19 @@ namespace Wabbajack.Lib
{
public GameMetaData GameInfo { get; internal set; }
public VortexInstaller(string archive, ModList modList)
{
ModManager = ModManager.Vortex;
ModListArchive = archive;
ModList = modList;
public override ModManager ModManager => ModManager.Vortex;
public VortexInstaller(string archive, ModList modList, string outputFolder, string downloadFolder)
: base(
archive: archive,
modList: modList,
outputFolder: outputFolder,
downloadFolder: downloadFolder)
{
#if DEBUG
// TODO: only for testing
IgnoreMissingFiles = true;
#endif
GameInfo = GameRegistry.Games[ModList.GameType];
}

View File

@ -49,9 +49,12 @@ namespace Wabbajack.Test
protected void Install(MO2Compiler compiler)
{
var modlist = AInstaller.LoadFromFile(compiler.ModListOutputFile);
var installer = new MO2Installer(compiler.ModListOutputFile, modlist, utils.InstallFolder);
var installer = new MO2Installer(
archive: compiler.ModListOutputFile,
modList: modlist,
outputFolder: utils.InstallFolder,
downloadFolder: utils.DownloadsFolder);
installer.WarnOnOverwrite = false;
installer.DownloadFolder = utils.DownloadsFolder;
installer.GameFolder = utils.GameFolder;
installer.Begin().Wait();
}

View File

@ -62,9 +62,12 @@ namespace Wabbajack.Test
protected void Install(VortexCompiler vortexCompiler)
{
var modList = AInstaller.LoadFromFile(vortexCompiler.ModListOutputFile);
var installer = new MO2Installer(vortexCompiler.ModListOutputFile, modList, utils.InstallFolder)
var installer = new MO2Installer(
archive: vortexCompiler.ModListOutputFile,
modList: modList,
outputFolder: utils.InstallFolder,
downloadFolder: utils.DownloadsFolder)
{
DownloadFolder = utils.DownloadsFolder,
GameFolder = utils.GameFolder,
};
installer.Begin().Wait();

View File

@ -147,8 +147,11 @@ namespace Wabbajack.Test
private void Install(MO2Compiler compiler)
{
var modlist = AInstaller.LoadFromFile(compiler.ModListOutputFile);
var installer = new MO2Installer(compiler.ModListOutputFile, modlist, utils.InstallFolder);
installer.DownloadFolder = utils.DownloadsFolder;
var installer = new MO2Installer(
archive: compiler.ModListOutputFile,
modList: modlist,
outputFolder: utils.InstallFolder,
downloadFolder: utils.DownloadsFolder);
installer.GameFolder = utils.GameFolder;
installer.Begin().Wait();
}

View File

@ -328,10 +328,11 @@ namespace Wabbajack
try
{
installer = new MO2Installer(ModListPath.TargetPath, ModList.SourceModList, Location.TargetPath)
{
DownloadFolder = DownloadLocation.TargetPath
};
installer = new MO2Installer(
archive: ModListPath.TargetPath,
modList: ModList.SourceModList,
outputFolder: Location.TargetPath,
downloadFolder: DownloadLocation.TargetPath);
}
catch (Exception ex)
{