mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge pull request #832 from wabbajack-tools/faster-inlined-file-installation
Speed up loading of patches and inlined files.
This commit is contained in:
commit
4357564347
@ -33,6 +33,7 @@ namespace Wabbajack.Lib
|
||||
|
||||
public SystemParameters? SystemParameters { get; set; }
|
||||
|
||||
|
||||
public AInstaller(AbsolutePath archive, ModList modList, AbsolutePath outputFolder, AbsolutePath downloadFolder, SystemParameters? parameters, int steps, Game game)
|
||||
: base(steps)
|
||||
{
|
||||
@ -44,6 +45,14 @@ namespace Wabbajack.Lib
|
||||
Game = game.MetaData();
|
||||
}
|
||||
|
||||
private ExtractedFiles? ExtractedModListFiles { get; set; } = null;
|
||||
public async Task ExtractModlist()
|
||||
{
|
||||
ExtractedModListFiles = await FileExtractor.ExtractAll(Queue, ModListArchive);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void Info(string msg)
|
||||
{
|
||||
Utils.Log(msg);
|
||||
@ -62,16 +71,8 @@ namespace Wabbajack.Lib
|
||||
|
||||
public async Task<byte[]> LoadBytesFromPath(RelativePath path)
|
||||
{
|
||||
await using var fs = new FileStream((string)ModListArchive, FileMode.Open, FileAccess.Read, FileShare.Read);
|
||||
using var ar = new ZipArchive(fs, ZipArchiveMode.Read);
|
||||
await using var ms = new MemoryStream();
|
||||
var entry = ar.GetEntry((string)path);
|
||||
await using (var e = entry.Open())
|
||||
{
|
||||
await e.CopyToAsync(ms);
|
||||
}
|
||||
|
||||
return ms.ToArray();
|
||||
await using var e = ExtractedModListFiles![path].OpenRead();
|
||||
return await e.ReadAllAsync();
|
||||
}
|
||||
|
||||
public static ModList LoadFromFile(AbsolutePath path)
|
||||
|
@ -39,7 +39,7 @@ namespace Wabbajack.Lib
|
||||
outputFolder: outputFolder,
|
||||
downloadFolder: downloadFolder,
|
||||
parameters: parameters,
|
||||
steps: 20,
|
||||
steps: 21,
|
||||
game: modList.GameType)
|
||||
{
|
||||
var gameExe = Consts.GameFolderFilesDir.Combine(modList.GameType.MetaData().MainExecutable!);
|
||||
@ -129,6 +129,10 @@ namespace Wabbajack.Lib
|
||||
Error("Cannot continue, was unable to download one or more archives");
|
||||
}
|
||||
|
||||
if (cancel.IsCancellationRequested) return false;
|
||||
UpdateTracker.NextStep("Extracting Modlist contents");
|
||||
await ExtractModlist();
|
||||
|
||||
if (cancel.IsCancellationRequested) return false;
|
||||
UpdateTracker.NextStep("Priming VFS");
|
||||
await PrimeVFS();
|
||||
|
Loading…
Reference in New Issue
Block a user