Lots of little compiler fixes

This commit is contained in:
Timothy Baldridge 2022-08-22 17:15:19 -06:00
parent 7a681778a2
commit fd37835532
4 changed files with 23 additions and 8 deletions

View File

@ -1,9 +1,10 @@
### Changelog
#### Version - 3.0.0.5 -
* No longer rehashes files on every compile
#### Version - 3.0.0.5 - 8/22/2022
* No longer rehashes files on every compile (faster Add Roots step during compilation)
* Editing paths in the install/compile settings won't crash the app
* Fix for .refcache files not being ignored during compilation
* Greatly reduce the amount of UI hangups during compilation
#### Version - 3.0.0.4 - 8/20/2022
* Fix for: when some optional game files weren't present (like CreationKit.exe), the app would refuse to recognize any files from that game

View File

@ -278,7 +278,9 @@ namespace Wabbajack
try
{
await compiler.Begin(token);
var result = await compiler.Begin(token);
if (!result)
throw new Exception("Compilation Failed");
}
finally
{

View File

@ -447,6 +447,8 @@ public abstract class ACompiler
/// </summary>
protected async Task BuildPatches(CancellationToken token)
{
NextStep("Compiling","Looking for patches");
var toBuild = InstallDirectives.OfType<PatchedFromArchive>()
.Where(p => _patchOptions.GetValueOrDefault(p, Array.Empty<VirtualFile>()).Length > 0)
.SelectMany(p => _patchOptions[p].Select(c => new PatchedFromArchive
@ -487,7 +489,7 @@ public abstract class ACompiler
_logger.LogInformation("Patch size {patchSize} for {to}", patchSize, match.To);
}, token);
}
}, token);
}, token, runInParallel: false);
// Load in the patches
await InstallDirectives.OfType<PatchedFromArchive>()

View File

@ -99,11 +99,11 @@ public class Context
/// <param name="files">Predefined list of files to extract, all others will be skipped</param>
/// <param name="callback">Func called for each file extracted</param>
/// <param name="tempFolder">Optional: folder to use for temporary storage</param>
/// <param name="updateTracker">Optional: Status update tracker</param>
/// <param name="runInParallel">Optional: run `callback`s in parallel</param>
/// <returns></returns>
/// <exception cref="Exception"></exception>
public async Task Extract(HashSet<VirtualFile> files, Func<VirtualFile, IExtractedFile, ValueTask> callback,
CancellationToken token, AbsolutePath? tempFolder = null)
CancellationToken token, AbsolutePath? tempFolder = null, bool runInParallel = true)
{
var top = new VirtualFile();
var filesByParent = files.SelectMany(f => f.FilesInFullPath)
@ -144,8 +144,18 @@ public class Context
}
}
await filesByParent[top].PDoAll(
async file => await HandleFile(file, new ExtractedNativeFile(file.AbsoluteName) {CanMove = false}));
if (runInParallel)
{
await filesByParent[top].PDoAll(
async file => await HandleFile(file, new ExtractedNativeFile(file.AbsoluteName) {CanMove = false}));
}
else
{
foreach (var file in filesByParent[top])
{
await HandleFile(file, new ExtractedNativeFile(file.AbsoluteName) {CanMove = false});
}
}
}
#region KnownFiles