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 SystemParameters? SystemParameters { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public AInstaller(AbsolutePath archive, ModList modList, AbsolutePath outputFolder, AbsolutePath downloadFolder, SystemParameters? parameters, int steps, Game game)
|
public AInstaller(AbsolutePath archive, ModList modList, AbsolutePath outputFolder, AbsolutePath downloadFolder, SystemParameters? parameters, int steps, Game game)
|
||||||
: base(steps)
|
: base(steps)
|
||||||
{
|
{
|
||||||
@ -44,6 +45,14 @@ namespace Wabbajack.Lib
|
|||||||
Game = game.MetaData();
|
Game = game.MetaData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ExtractedFiles? ExtractedModListFiles { get; set; } = null;
|
||||||
|
public async Task ExtractModlist()
|
||||||
|
{
|
||||||
|
ExtractedModListFiles = await FileExtractor.ExtractAll(Queue, ModListArchive);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void Info(string msg)
|
public void Info(string msg)
|
||||||
{
|
{
|
||||||
Utils.Log(msg);
|
Utils.Log(msg);
|
||||||
@ -62,16 +71,8 @@ namespace Wabbajack.Lib
|
|||||||
|
|
||||||
public async Task<byte[]> LoadBytesFromPath(RelativePath path)
|
public async Task<byte[]> LoadBytesFromPath(RelativePath path)
|
||||||
{
|
{
|
||||||
await using var fs = new FileStream((string)ModListArchive, FileMode.Open, FileAccess.Read, FileShare.Read);
|
await using var e = ExtractedModListFiles![path].OpenRead();
|
||||||
using var ar = new ZipArchive(fs, ZipArchiveMode.Read);
|
return await e.ReadAllAsync();
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ModList LoadFromFile(AbsolutePath path)
|
public static ModList LoadFromFile(AbsolutePath path)
|
||||||
|
@ -39,7 +39,7 @@ namespace Wabbajack.Lib
|
|||||||
outputFolder: outputFolder,
|
outputFolder: outputFolder,
|
||||||
downloadFolder: downloadFolder,
|
downloadFolder: downloadFolder,
|
||||||
parameters: parameters,
|
parameters: parameters,
|
||||||
steps: 20,
|
steps: 21,
|
||||||
game: modList.GameType)
|
game: modList.GameType)
|
||||||
{
|
{
|
||||||
var gameExe = Consts.GameFolderFilesDir.Combine(modList.GameType.MetaData().MainExecutable!);
|
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");
|
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;
|
if (cancel.IsCancellationRequested) return false;
|
||||||
UpdateTracker.NextStep("Priming VFS");
|
UpdateTracker.NextStep("Priming VFS");
|
||||||
await PrimeVFS();
|
await PrimeVFS();
|
||||||
|
Loading…
Reference in New Issue
Block a user