Fix ReaderFactory.OpenAsyncReader to use async IsArchiveAsync methods

Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-01-16 09:12:54 +00:00
parent 75cc36849b
commit 2906529080
13 changed files with 37 additions and 37 deletions

View File

@@ -24,7 +24,7 @@ public static class ReaderFactory
/// <param name="options"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static IAsyncReader OpenAsyncReader(
public static ValueTask<IAsyncReader> OpenAsyncReader(
string filePath,
ReaderOptions? options = null,
CancellationToken cancellationToken = default
@@ -47,7 +47,7 @@ public static class ReaderFactory
/// <param name="options"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public static IAsyncReader OpenAsyncReader(
public static ValueTask<IAsyncReader> OpenAsyncReader(
FileInfo fileInfo,
ReaderOptions? options = null,
CancellationToken cancellationToken = default
@@ -110,7 +110,7 @@ public static class ReaderFactory
);
}
public static IAsyncReader OpenAsyncReader(
public static async ValueTask<IAsyncReader> OpenAsyncReader(
Stream stream,
ReaderOptions? options = null,
CancellationToken cancellationToken = default
@@ -136,7 +136,7 @@ public static class ReaderFactory
if (testedFactory is IReaderFactory readerFactory)
{
((IStreamStack)bStream).StackSeek(pos);
if (testedFactory.IsArchive(bStream))
if (await testedFactory.IsArchiveAsync(bStream, cancellationToken: cancellationToken))
{
((IStreamStack)bStream).StackSeek(pos);
return readerFactory.OpenAsyncReader(bStream, options, cancellationToken);
@@ -152,7 +152,7 @@ public static class ReaderFactory
continue; // Already tested above
}
((IStreamStack)bStream).StackSeek(pos);
if (factory is IReaderFactory readerFactory && factory.IsArchive(bStream))
if (factory is IReaderFactory readerFactory && await factory.IsArchiveAsync(bStream, cancellationToken: cancellationToken))
{
((IStreamStack)bStream).StackSeek(pos);
return readerFactory.OpenAsyncReader(bStream, options, cancellationToken);