Rebase fixes

This commit is contained in:
erri120 2019-11-17 15:06:28 +01:00
parent a10a3ff1ff
commit c22cc20fc8
No known key found for this signature in database
GPG Key ID: A8C0A18D8D4D3135
5 changed files with 22 additions and 25 deletions

View File

@ -16,7 +16,9 @@ namespace Wabbajack.Lib
{
public bool IgnoreMissingFiles { get; internal set; } = false;
public Context VFS { get; internal set; } = new Context();
public StatusUpdateTracker UpdateTracker { get; protected set; }
public WorkQueue Queue { get; protected set; }
public Context VFS { get; internal set; }
public string OutputFolder { get; set; }
public string DownloadFolder { get; set; }
@ -27,6 +29,11 @@ namespace Wabbajack.Lib
public ModList ModList { get; internal set; }
public Dictionary<string, string> HashedArchives { get; set; }
protected AInstaller()
{
Queue = new WorkQueue();
}
public abstract void Install();
public void Info(string msg)
@ -36,7 +43,7 @@ namespace Wabbajack.Lib
public void Status(string msg)
{
WorkQueue.Report(msg, 0);
Queue.Report(msg, 0);
}
public void Error(string msg)
@ -123,7 +130,7 @@ namespace Wabbajack.Lib
.ToList();
Info("Installing Archives");
archives.PMap(a => InstallArchive(a.Archive, a.AbsolutePath, grouped[a.Archive.Hash]));
archives.PMap(Queue,a => InstallArchive(a.Archive, a.AbsolutePath, grouped[a.Archive.Hash]));
}
private void InstallArchive(Archive archive, string absolutePath, IGrouping<string, FromArchive> grouping)
@ -239,7 +246,7 @@ namespace Wabbajack.Lib
}
missing.Where(a => a.State.GetType() != typeof(ManualDownloader.State))
.PMap(archive =>
.PMap(Queue, archive =>
{
Info($"Downloading {archive.Name}");
var outputPath = Path.Combine(DownloadFolder, archive.Name);
@ -272,7 +279,7 @@ namespace Wabbajack.Lib
{
HashedArchives = Directory.EnumerateFiles(DownloadFolder)
.Where(e => !e.EndsWith(".sha"))
.PMap(e => (HashArchive(e), e))
.PMap(Queue, e => (HashArchive(e), e))
.OrderByDescending(e => File.GetLastWriteTime(e.Item2))
.GroupBy(e => e.Item1)
.Select(e => e.First())

View File

@ -45,8 +45,7 @@ namespace Wabbajack.Lib
public Compiler(string mo2_folder)
{
UpdateTracker = new StatusUpdateTracker(10);
Queue = new WorkQueue();
VFS = new Context(Queue) {UpdateTracker = UpdateTracker};
VFS = new Context(Queue) {UpdateTracker = UpdateTracker};
ModManager = ModManager.MO2;
MO2Folder = mo2_folder;

View File

@ -7,6 +7,7 @@ using Wabbajack.Common;
using Wabbajack.Lib.Downloaders;
using Wabbajack.Lib.NexusApi;
using Wabbajack.Lib.Validation;
using Wabbajack.VirtualFileSystem;
using Directory = Alphaleonis.Win32.Filesystem.Directory;
using File = Alphaleonis.Win32.Filesystem.File;
using FileInfo = Alphaleonis.Win32.Filesystem.FileInfo;
@ -16,12 +17,10 @@ namespace Wabbajack.Lib
{
public class Installer : AInstaller
{
private WorkQueue Queue { get; set; }
public Installer(string archive, ModList mod_list, string output_folder)
{
Queue = new WorkQueue();
VFS = new Context(Queue);
UpdateTracker = new StatusUpdateTracker(10);
VFS = new Context(Queue) {UpdateTracker = UpdateTracker};
ModManager = ModManager.MO2;
ModListArchive = archive;
OutputFolder = output_folder;

View File

@ -32,6 +32,9 @@ namespace Wabbajack.Lib
public VortexCompiler(Game game, string gamePath, string vortexFolder, string downloadsFolder, string stagingFolder)
{
UpdateTracker = new StatusUpdateTracker(10);
VFS = new Context(Queue) {UpdateTracker = UpdateTracker};
ModManager = ModManager.Vortex;
Game = game;
@ -40,8 +43,6 @@ namespace Wabbajack.Lib
GamePath = gamePath;
GameName = GameRegistry.Games[game].NexusName;
Queue = new WorkQueue();
VFS = new Context(Queue);
VortexFolder = vortexFolder;
DownloadsFolder = downloadsFolder;
StagingFolder = stagingFolder;

View File

@ -1,14 +1,8 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Linq;
using Wabbajack.Common;
using Wabbajack.Lib.Downloaders;
using Wabbajack.VirtualFileSystem;
using Directory = Alphaleonis.Win32.Filesystem.Directory;
using File = Alphaleonis.Win32.Filesystem.File;
using FileInfo = Alphaleonis.Win32.Filesystem.FileInfo;
using Path = Alphaleonis.Win32.Filesystem.Path;
namespace Wabbajack.Lib
@ -17,13 +11,10 @@ namespace Wabbajack.Lib
{
public GameMetaData GameInfo { get; internal set; }
public WorkQueue Queue { get; }
public bool IgnoreMissingFiles { get; internal set; }
public VortexInstaller(string archive, ModList modList)
{
Queue = new WorkQueue();
UpdateTracker = new StatusUpdateTracker(10);
VFS = new Context(Queue) {UpdateTracker = UpdateTracker};
ModManager = ModManager.Vortex;
ModListArchive = archive;
ModList = modList;