mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-04 05:25:00 +00:00
Merge fixes
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user