Merge fixes

This commit is contained in:
Adam Hathcock
2025-12-19 14:22:09 +00:00
parent e1aa727513
commit b976961434
2 changed files with 5 additions and 35 deletions

View File

@@ -123,7 +123,7 @@ public static class ArchiveFactory
)
{
using var archive = Open(sourceArchive);
archive.ExtractToDirectory(destinationDirectory, options);
archive.WriteToDirectory(destinationDirectory, options);
}
private static T FindFactory<T>(FileInfo finfo)

View File

@@ -8,7 +8,7 @@ using Xunit;
namespace SharpCompress.Test;
public class ExtractAll : TestBase
public class ExtractAllTests: TestBase
{
[Theory]
[InlineData("Zip.deflate.zip")]
@@ -18,28 +18,13 @@ public class ExtractAll : TestBase
[InlineData("7Zip.solid.7z")]
[InlineData("7Zip.nonsolid.7z")]
[InlineData("7Zip.LZMA.7z")]
public async Task ExtractAllEntries(string archivePath)
public async Task ExtractAllEntriesAsync(string archivePath)
{
var testArchive = Path.Combine(TEST_ARCHIVES_PATH, archivePath);
var options = new ExtractionOptions() { ExtractFullPath = true, Overwrite = true };
using var archive = ArchiveFactory.Open(testArchive);
if (archive.IsSolid || archive.Type == ArchiveType.SevenZip)
{
using var reader = archive.ExtractAllEntries();
while (await reader.MoveToNextEntryAsync())
{
if (!reader.Entry.IsDirectory)
{
await reader.WriteEntryToDirectoryAsync(SCRATCH_FILES_PATH, options);
}
}
}
else
{
archive.ExtractToDirectory(SCRATCH_FILES_PATH, options);
}
await archive.WriteToDirectoryAsync(SCRATCH_FILES_PATH, options);
}
[Theory]
@@ -56,21 +41,6 @@ public class ExtractAll : TestBase
var options = new ExtractionOptions() { ExtractFullPath = true, Overwrite = true };
using var archive = ArchiveFactory.Open(testArchive);
if (archive.IsSolid || archive.Type == ArchiveType.SevenZip)
{
using var reader = archive.ExtractAllEntries();
while (reader.MoveToNextEntry())
{
if (!reader.Entry.IsDirectory)
{
reader.WriteEntryToDirectory(SCRATCH_FILES_PATH, options);
}
}
}
else
{
archive.ExtractToDirectory(SCRATCH_FILES_PATH, options);
}
archive.WriteToDirectory(SCRATCH_FILES_PATH, options);
}
}