[PR #658] [MERGED] Added Split archive support with unit tests. … #1139

Open
opened 2026-01-29 22:19:10 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/adamhathcock/sharpcompress/pull/658
Author: @Nanook
Created: 4/21/2022
Status: Merged
Merged: 4/21/2022
Merged by: @adamhathcock

Base: masterHead: master


📝 Commits (1)

  • ec1999f Added Split archive support with unit tests. Added ArchiveFactory.IsArchive() and minor refactor.

📊 Changes

33 files changed (+439 additions, -48 deletions)

View changed files

📝 src/SharpCompress/Archives/ArchiveFactory.cs (+137 -48)
src/SharpCompress/IO/SplitStream.cs (+150 -0)
📝 tests/SharpCompress.Test/ArchiveTests.cs (+62 -0)
📝 tests/SharpCompress.Test/Rar/RarArchiveTests.cs (+65 -0)
📝 tests/SharpCompress.Test/SevenZip/SevenZipArchiveTests.cs (+14 -0)
📝 tests/SharpCompress.Test/Zip/ZipArchiveTests.cs (+11 -0)
tests/TestArchives/Archives/7Zip.BZip2.split.001 (+0 -0)
tests/TestArchives/Archives/7Zip.BZip2.split.002 (+0 -0)
tests/TestArchives/Archives/7Zip.BZip2.split.003 (+0 -0)
tests/TestArchives/Archives/7Zip.BZip2.split.004 (+0 -0)
tests/TestArchives/Archives/7Zip.BZip2.split.005 (+0 -0)
tests/TestArchives/Archives/7Zip.BZip2.split.006 (+0 -0)
tests/TestArchives/Archives/7Zip.BZip2.split.007 (+0 -0)
tests/TestArchives/Archives/Rar4.multi.part01.rar (+0 -0)
tests/TestArchives/Archives/Rar4.multi.part02.rar (+0 -0)
tests/TestArchives/Archives/Rar4.multi.part03.rar (+0 -0)
tests/TestArchives/Archives/Rar4.multi.part04.rar (+0 -0)
tests/TestArchives/Archives/Rar4.multi.part05.rar (+0 -0)
tests/TestArchives/Archives/Rar4.multi.part06.rar (+0 -0)
tests/TestArchives/Archives/Rar4.multi.part07.rar (+0 -0)

...and 13 more files

📄 Description

…Added ArchiveFactory.IsArchive() and minor refactor.

ArchiveFactory.cs has new static methods to test if a file is an archive and will also return "out" the ArchiveType. ArchiveFactory.cs was refactored around this to simplify it a bit. A new Open() method was added to allow split archives and multipart rar to be opened - also supporting single file archives too. This method is able to open all types.

A SplitStream class has been added that allows split archives to be read as one file.

Rar4 unit tests have been added, along with split archive tests.

I'm not sure how this change affects some of the other classes and properties with regard to indicating that an archive IsSplit etc. A minor enhancement would be be able to give the library the first part of a multipart or split archive and have the library find the other parts. Currently you have to pass them all in to the new Open() method.

Hope this is useful for the repo.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/adamhathcock/sharpcompress/pull/658 **Author:** [@Nanook](https://github.com/Nanook) **Created:** 4/21/2022 **Status:** ✅ Merged **Merged:** 4/21/2022 **Merged by:** [@adamhathcock](https://github.com/adamhathcock) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (1) - [`ec1999f`](https://github.com/adamhathcock/sharpcompress/commit/ec1999f73d78d2a699b1a2d124aac22d66c4fe37) Added Split archive support with unit tests. Added ArchiveFactory.IsArchive() and minor refactor. ### 📊 Changes **33 files changed** (+439 additions, -48 deletions) <details> <summary>View changed files</summary> 📝 `src/SharpCompress/Archives/ArchiveFactory.cs` (+137 -48) ➕ `src/SharpCompress/IO/SplitStream.cs` (+150 -0) 📝 `tests/SharpCompress.Test/ArchiveTests.cs` (+62 -0) 📝 `tests/SharpCompress.Test/Rar/RarArchiveTests.cs` (+65 -0) 📝 `tests/SharpCompress.Test/SevenZip/SevenZipArchiveTests.cs` (+14 -0) 📝 `tests/SharpCompress.Test/Zip/ZipArchiveTests.cs` (+11 -0) ➕ `tests/TestArchives/Archives/7Zip.BZip2.split.001` (+0 -0) ➕ `tests/TestArchives/Archives/7Zip.BZip2.split.002` (+0 -0) ➕ `tests/TestArchives/Archives/7Zip.BZip2.split.003` (+0 -0) ➕ `tests/TestArchives/Archives/7Zip.BZip2.split.004` (+0 -0) ➕ `tests/TestArchives/Archives/7Zip.BZip2.split.005` (+0 -0) ➕ `tests/TestArchives/Archives/7Zip.BZip2.split.006` (+0 -0) ➕ `tests/TestArchives/Archives/7Zip.BZip2.split.007` (+0 -0) ➕ `tests/TestArchives/Archives/Rar4.multi.part01.rar` (+0 -0) ➕ `tests/TestArchives/Archives/Rar4.multi.part02.rar` (+0 -0) ➕ `tests/TestArchives/Archives/Rar4.multi.part03.rar` (+0 -0) ➕ `tests/TestArchives/Archives/Rar4.multi.part04.rar` (+0 -0) ➕ `tests/TestArchives/Archives/Rar4.multi.part05.rar` (+0 -0) ➕ `tests/TestArchives/Archives/Rar4.multi.part06.rar` (+0 -0) ➕ `tests/TestArchives/Archives/Rar4.multi.part07.rar` (+0 -0) _...and 13 more files_ </details> ### 📄 Description …Added ArchiveFactory.IsArchive() and minor refactor. ArchiveFactory.cs has new static methods to test if a file is an archive and will also return "out" the ArchiveType. ArchiveFactory.cs was refactored around this to simplify it a bit. A new Open() method was added to allow split archives and multipart rar to be opened - also supporting single file archives too. This method is able to open all types. A SplitStream class has been added that allows split archives to be read as one file. Rar4 unit tests have been added, along with split archive tests. I'm not sure how this change affects some of the other classes and properties with regard to indicating that an archive IsSplit etc. A minor enhancement would be be able to give the library the first part of a multipart or split archive and have the library find the other parts. Currently you have to pass them all in to the new Open() method. Hope this is useful for the repo. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 22:19:10 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#1139