mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
WIP bugfixes
This commit is contained in:
parent
f99f4a7538
commit
3d61847b0b
@ -1,9 +1,10 @@
|
||||
using System;
|
||||
using Wabbajack.Paths;
|
||||
|
||||
namespace Wabbajack.Compiler;
|
||||
|
||||
public class MO2CompilerSettings : CompilerSettings
|
||||
{
|
||||
public string Profile { get; set; }
|
||||
public RelativePath[] AlwaysEnabled { get; set; }
|
||||
public string Profile { get; set; } = "";
|
||||
public RelativePath[] AlwaysEnabled { get; set; } = Array.Empty<RelativePath>();
|
||||
}
|
@ -3,6 +3,7 @@ using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Wabbajack.DTOs.JsonConverters;
|
||||
using Wabbajack.Networking.WabbajackClientApi;
|
||||
using Wabbajack.Services.OSIntegrated;
|
||||
|
||||
namespace Wabbajack.DTOs.Test;
|
||||
|
||||
@ -10,10 +11,6 @@ public class Startup
|
||||
{
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddDTOConverters();
|
||||
services.AddDTOSerializer();
|
||||
services.AddWabbajackClient();
|
||||
services.AddSingleton(new ParallelOptions {MaxDegreeOfParallelism = 2});
|
||||
services.AddSingleton<HttpClient>();
|
||||
services.AddOSIntegrated();
|
||||
}
|
||||
}
|
@ -7,10 +7,10 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FsCheck.Xunit" Version="3.0.0-beta1"/>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0"/>
|
||||
<PackageReference Include="xunit" Version="2.4.2-pre.12"/>
|
||||
<PackageReference Include="Xunit.DependencyInjection" Version="7.7.0"/>
|
||||
<PackageReference Include="FsCheck.Xunit" Version="3.0.0-beta1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
|
||||
<PackageReference Include="xunit" Version="2.4.2-pre.12" />
|
||||
<PackageReference Include="Xunit.DependencyInjection" Version="7.7.0" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
@ -19,14 +19,15 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="YamlDotNet" Version="11.2.1"/>
|
||||
<PackageReference Include="YamlDotNet" Version="11.2.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Wabbajack.Common\Wabbajack.Common.csproj"/>
|
||||
<ProjectReference Include="..\Wabbajack.DTOs\Wabbajack.DTOs.csproj"/>
|
||||
<ProjectReference Include="..\Wabbajack.Networking.WabbajackClientApi\Wabbajack.Networking.WabbajackClientApi.csproj"/>
|
||||
<ProjectReference Include="..\Wabbajack.Paths.IO\Wabbajack.Paths.IO.csproj"/>
|
||||
<ProjectReference Include="..\Wabbajack.Common\Wabbajack.Common.csproj" />
|
||||
<ProjectReference Include="..\Wabbajack.DTOs\Wabbajack.DTOs.csproj" />
|
||||
<ProjectReference Include="..\Wabbajack.Networking.WabbajackClientApi\Wabbajack.Networking.WabbajackClientApi.csproj" />
|
||||
<ProjectReference Include="..\Wabbajack.Paths.IO\Wabbajack.Paths.IO.csproj" />
|
||||
<ProjectReference Include="..\Wabbajack.Services.OSIntegrated\Wabbajack.Services.OSIntegrated.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -76,7 +76,6 @@ public class FileExtractor
|
||||
|
||||
|
||||
IDictionary<RelativePath, T> results;
|
||||
using var job = await _limiter.Begin($"Extracting {sFn.Name}", 0, token);
|
||||
|
||||
switch (sig)
|
||||
{
|
||||
@ -93,7 +92,7 @@ public class FileExtractor
|
||||
{
|
||||
await using var tempFolder = _manager.CreateFolder();
|
||||
results = await GatheringExtractWith7Zip(sFn, shouldExtract,
|
||||
mapfn, onlyFiles, job, token);
|
||||
mapfn, onlyFiles, token);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -153,7 +152,7 @@ public class FileExtractor
|
||||
return results;
|
||||
}
|
||||
|
||||
public static async Task<Dictionary<RelativePath, T>> GatheringExtractWithBSA<T>(IStreamFactory sFn,
|
||||
public async Task<Dictionary<RelativePath, T>> GatheringExtractWithBSA<T>(IStreamFactory sFn,
|
||||
FileType sig,
|
||||
Predicate<RelativePath> shouldExtract,
|
||||
Func<RelativePath, IExtractedFile, ValueTask<T>> mapFn,
|
||||
@ -171,7 +170,8 @@ public class FileExtractor
|
||||
var result = await mapFn(entry.Path, new ExtractedMemoryFile(await entry.GetStreamFactory(token)));
|
||||
results.Add(entry.Path, result);
|
||||
}
|
||||
|
||||
|
||||
_logger.LogInformation("Finished extracting {Name}", sFn.Name);
|
||||
return results;
|
||||
}
|
||||
|
||||
@ -179,7 +179,6 @@ public class FileExtractor
|
||||
Predicate<RelativePath> shouldExtract,
|
||||
Func<RelativePath, IExtractedFile, ValueTask<T>> mapfn,
|
||||
IReadOnlyCollection<RelativePath>? onlyFiles,
|
||||
Job<FileExtractor> job,
|
||||
CancellationToken token)
|
||||
{
|
||||
TemporaryPath? tmpFile = null;
|
||||
@ -187,7 +186,8 @@ public class FileExtractor
|
||||
|
||||
TemporaryPath? spoolFile = null;
|
||||
AbsolutePath source;
|
||||
|
||||
|
||||
var job = await _limiter.Begin($"Extracting {sf.Name}", 0, token);
|
||||
try
|
||||
{
|
||||
if (sf.Name is AbsolutePath abs)
|
||||
@ -202,7 +202,7 @@ public class FileExtractor
|
||||
source = spoolFile.Value.Path;
|
||||
}
|
||||
|
||||
_logger.LogInformation("Extracting {source}", source.FileName);
|
||||
_logger.LogInformation("Extracting {Source}", source.FileName);
|
||||
|
||||
|
||||
var initialPath = "";
|
||||
@ -278,6 +278,8 @@ public class FileExtractor
|
||||
Utils.Status($"Extracting {source.FileName} - done", Percent.One, alsoLog: true);
|
||||
}*/
|
||||
|
||||
|
||||
job.Dispose();
|
||||
var results = await dest.Path.EnumerateFiles()
|
||||
.PMapAll(async f =>
|
||||
{
|
||||
@ -295,6 +297,8 @@ public class FileExtractor
|
||||
}
|
||||
finally
|
||||
{
|
||||
job.Dispose();
|
||||
|
||||
if (tmpFile != null) await tmpFile.Value.DisposeAsync();
|
||||
|
||||
if (spoolFile != null) await spoolFile.Value.DisposeAsync();
|
||||
|
@ -11,8 +11,12 @@ public class Job<T> : IJob, IDisposable
|
||||
public bool Started { get; internal set; }
|
||||
public IResource<T> Resource { get; init; }
|
||||
|
||||
private bool _isFinished = false;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (!_isFinished) return;
|
||||
_isFinished = true;
|
||||
Resource.Finish(this);
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ public class Resource<T> : IResource<T>
|
||||
private long _totalUsed;
|
||||
|
||||
|
||||
public Resource(string? humanName = null, int? maxTasks = 0, long maxThroughput = long.MaxValue)
|
||||
public Resource(string? humanName = null, int? maxTasks = null, long maxThroughput = long.MaxValue)
|
||||
{
|
||||
Name = humanName ?? "<unknown>";
|
||||
MaxTasks = maxTasks ?? Environment.ProcessorCount;
|
||||
|
@ -63,6 +63,9 @@ public static class ServiceExtensions
|
||||
service.AddAllSingleton<IResource, IResource<FileExtractor.FileExtractor>>(s =>
|
||||
new Resource<FileExtractor.FileExtractor>("File Extractor", 12));
|
||||
|
||||
service.AddAllSingleton<IResource, IResource<ACompiler>>(s =>
|
||||
new Resource<ACompiler>("Compiler", 12));
|
||||
|
||||
service.AddSingleton<LoggingRateLimiterReporter>();
|
||||
|
||||
service.AddScoped<Context>();
|
||||
|
@ -18,6 +18,10 @@ public class Startup
|
||||
.AddAllSingleton<IResource, IResource<FileExtractor.FileExtractor>, Resource<FileExtractor.FileExtractor>>(
|
||||
s =>
|
||||
new Resource<FileExtractor.FileExtractor>("File Extractor", 2));
|
||||
service
|
||||
.AddAllSingleton<IResource, IResource<Context>, Resource<Context>>(
|
||||
s =>
|
||||
new ("VFS Context", 2));
|
||||
|
||||
// Keep this fixed at 2 so that we can detect deadlocks in the VFS parallelOptions
|
||||
service.AddSingleton(new ParallelOptions {MaxDegreeOfParallelism = 2});
|
||||
|
@ -156,11 +156,6 @@ public class Context
|
||||
async file => await HandleFile(file, new ExtractedNativeFile(file.AbsoluteName) {CanMove = false}));
|
||||
}
|
||||
|
||||
private class Box<T>
|
||||
{
|
||||
public T Value { get; set; }
|
||||
}
|
||||
|
||||
#region KnownFiles
|
||||
|
||||
private List<HashRelativePath> _knownFiles = new();
|
||||
|
Loading…
Reference in New Issue
Block a user