Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/SharpCompress/Common/SevenZip/SevenZipFilePart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public CompressionType CompressionType
}
}

private const uint K_COPY = 0x0;
private const uint K_LZMA2 = 0x21;
private const uint K_LZMA = 0x030101;
private const uint K_PPMD = 0x030401;
Expand All @@ -82,6 +83,7 @@ private CompressionType GetCompression()
var coder = Folder.NotNull()._coders.First();
return coder._methodId._id switch
{
K_COPY => CompressionType.None,
K_LZMA or K_LZMA2 => CompressionType.LZMA,
K_PPMD => CompressionType.PPMd,
K_B_ZIP2 => CompressionType.BZip2,
Expand Down
6 changes: 3 additions & 3 deletions src/SharpCompress/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,9 @@
"net8.0": {
"Microsoft.NET.ILLink.Tasks": {
"type": "Direct",
"requested": "[8.0.17, )",
"resolved": "8.0.17",
"contentHash": "x5/y4l8AtshpBOrCZdlE4txw8K3e3s9meBFeZeR3l8hbbku2V7kK6ojhXvrbjg1rk3G+JqL1BI26gtgc1ZrdUw=="
"requested": "[8.0.0, )",
"resolved": "8.0.0",
"contentHash": "B3etT5XQ2nlWkZGO2m/ytDYrOmSsQG1XNBaM6ZYlX5Ch/tDrMFadr0/mK6gjZwaQc55g+5+WZMw4Cz3m8VEF7g=="
},
"Microsoft.SourceLink.GitHub": {
"type": "Direct",
Expand Down
19 changes: 19 additions & 0 deletions tests/SharpCompress.Test/SevenZip/SevenZipArchiveTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,25 @@ public void SevenZipArchive_BZip2_Split_FirstFileRead() =>
//"7Zip.BZip2.split.006",
//"7Zip.BZip2.split.007"

[Fact]
public void SevenZipArchive_Copy_StreamRead() => ArchiveStreamRead("7Zip.Copy.7z");

[Fact]
public void SevenZipArchive_Copy_PathRead() => ArchiveFileRead("7Zip.Copy.7z");

[Fact]
public void SevenZipArchive_Copy_CompressionType()
{
using (Stream stream = File.OpenRead(Path.Combine(TEST_ARCHIVES_PATH, "7Zip.Copy.7z")))
using (var archive = SevenZipArchive.Open(stream))
{
foreach (var entry in archive.Entries.Where(e => !e.IsDirectory))
{
Assert.Equal(CompressionType.None, entry.CompressionType);
}
}
}

[Fact]
public void SevenZipArchive_ZSTD_StreamRead() => ArchiveStreamRead("7Zip.ZSTD.7z");

Expand Down
Binary file added tests/TestArchives/Archives/7Zip.Copy.7z
Binary file not shown.