Removed unused IAsyncDisposable on BSAReader

This commit is contained in:
Justin Swanson 2020-06-26 14:01:10 -05:00
parent 64cfba67a5
commit 6b2d762e70
10 changed files with 24 additions and 30 deletions

View File

@ -96,7 +96,7 @@ namespace Compression.BSA.Test
var tempFile = ((RelativePath)"tmp.bsa").RelativeToEntryPoint();
var size = bsa.Size;
await using var a = await BSADispatch.OpenRead(bsa);
var a = await BSADispatch.OpenRead(bsa);
await a.Files.PMap(Queue, async file =>
{
var absName = _tempDir.Combine(file.Path);
@ -132,7 +132,7 @@ namespace Compression.BSA.Test
}
TestContext.WriteLine($"Verifying {bsa}");
await using var b = await BSADispatch.OpenRead(tempFile);
var b = await BSADispatch.OpenRead(tempFile);
TestContext.WriteLine($"Performing A/B tests on {bsa}");
Assert.Equal(a.State.ToJson(), b.State.ToJson());

View File

@ -50,7 +50,7 @@ namespace Compression.BSA
Miscellaneous = 0x100
}
public class BSAReader : IAsyncDisposable, IBSAReader
public class BSAReader : IBSAReader
{
internal uint _archiveFlags;
internal uint _fileCount;
@ -127,10 +127,6 @@ namespace Compression.BSA
}
}
public async ValueTask DisposeAsync()
{
}
private async ValueTask LoadHeaders()
{
var fourcc = Encoding.ASCII.GetString(_rdr.ReadBytes(4));

View File

@ -5,7 +5,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Platforms>x64</Platforms>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
<Version>1.1</Version>
<Version>3.0</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">

View File

@ -6,7 +6,7 @@ using Wabbajack.Common;
namespace Compression.BSA
{
public interface IBSAReader : IAsyncDisposable
public interface IBSAReader
{
/// <summary>
/// The files defined by the archive

View File

@ -14,7 +14,7 @@ namespace Wabbajack.CLI.Verbs
protected override async Task<ExitCode> Run()
{
await using var bsa = await BSADispatch.OpenRead(Input.RelativeTo(AbsolutePath.GetCurrentDirectory()));
var bsa = await BSADispatch.OpenRead(Input.RelativeTo(AbsolutePath.GetCurrentDirectory()));
bsa.Dump(Console.WriteLine);
return ExitCode.Ok;
}

View File

@ -6,7 +6,7 @@
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
<Nullable>enable</Nullable>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageVersion>2.0.9.1</PackageVersion>
<PackageVersion>3.0</PackageVersion>
<Title>Wabbajack Common Lib</Title>
<Authors>Wabbajack Team</Authors>
<Copyright>2020</Copyright>
@ -14,7 +14,7 @@
<PackageLicenseUrl>https://raw.githubusercontent.com/wabbajack-tools/wabbajack/master/LICENSE.txt</PackageLicenseUrl>
<PackageIconUrl>https://www.wabbajack.org/favicon.ico</PackageIconUrl>
<RepositoryUrl>https://github.com/wabbajack-tools/wabbajack</RepositoryUrl>
<Version>1.1</Version>
<Version>3.0</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DocumentationFile>Wabbajack.Common.xml</DocumentationFile>

View File

@ -20,7 +20,7 @@ namespace Wabbajack.Lib.CompilationSteps
public DeconstructBSAs(ACompiler compiler) : base(compiler)
{
_mo2Compiler = (MO2Compiler) compiler;
_mo2Compiler = (MO2Compiler)compiler;
_includeDirectly = _mo2Compiler.ModInis.Where(kv =>
{
var general = kv.Value.General;
@ -60,10 +60,10 @@ namespace Wabbajack.Lib.CompilationSteps
if (_includeDirectly.Any(path => source.Path.StartsWith(path)))
defaultInclude = true;
if (source.AbsolutePath.Size >= (long) 2 << 31)
if (source.AbsolutePath.Size >= (long)2 << 31)
{
await using var bsa = await BSADispatch.OpenRead(source.AbsolutePath);
if (bsa.State is BSAStateObject)
var bsaTest = await BSADispatch.OpenRead(source.AbsolutePath);
if (bsaTest.State is BSAStateObject)
{
Utils.Error(
$"BSA {source.AbsolutePath.FileName} is over 2GB in size, very few programs (Including Wabbajack) can create BSA files this large without causing CTD issues." +
@ -83,7 +83,7 @@ namespace Wabbajack.Lib.CompilationSteps
{
_cleanup = await source.File.Context.Stage(source.File.Children);
}
var matches = await sourceFiles.PMap(_mo2Compiler.Queue, e => _mo2Compiler.RunStack(stack, new RawSourceFile(e, Consts.BSACreationDir.Combine((RelativePath)id, (RelativePath)e.Name))));
@ -95,16 +95,14 @@ namespace Wabbajack.Lib.CompilationSteps
}
CreateBSA directive;
await using (var bsa = await BSADispatch.OpenRead(source.AbsolutePath))
var bsa = await BSADispatch.OpenRead(source.AbsolutePath);
directive = new CreateBSA(
state: bsa.State,
items: bsa.Files.Select(f => f.State).ToList())
{
directive = new CreateBSA(
state: bsa.State,
items: bsa.Files.Select(f => f.State).ToList())
{
To = source.Path,
TempID = (RelativePath)id,
};
}
To = source.Path,
TempID = (RelativePath)id,
};
if (_cleanup != null)
await _cleanup();

View File

@ -521,7 +521,7 @@ namespace Wabbajack.Lib
var bsaId = (RelativePath)((string)to).Split('\\')[1];
var bsa = InstallDirectives.OfType<CreateBSA>().First(b => b.TempID == bsaId);
await using var a = await BSADispatch.OpenRead(MO2Folder.Combine(bsa.To));
var a = await BSADispatch.OpenRead(MO2Folder.Combine(bsa.To));
var find = (RelativePath)Path.Combine(((string)to).Split('\\').Skip(2).ToArray());
var file = a.Files.First(e => e.Path == find);
var returnStream = new TempStream();

View File

@ -13,7 +13,7 @@ namespace Wabbajack.VirtualFileSystem
private IAsyncDisposable _disposable;
private AbsolutePath _tempFolder;
public ExtractedFiles(Dictionary<RelativePath, IExtractedFile> files, IAsyncDisposable disposeOther)
public ExtractedFiles(Dictionary<RelativePath, IExtractedFile> files, IAsyncDisposable disposeOther = null)
{
_files = files;
_disposable = disposeOther;

View File

@ -114,9 +114,9 @@ namespace Wabbajack.VirtualFileSystem
{
try
{
await using var arch = await BSADispatch.OpenRead(source);
var arch = await BSADispatch.OpenRead(source);
var files = arch.Files.ToDictionary(f => f.Path, f => (IExtractedFile)new ExtractedBSAFile(f));
return new ExtractedFiles(files, arch);
return new ExtractedFiles(files);
}
catch (Exception ex)
{