Skip to content

feat: create 7z archives with the managed LZMA encoder - #214

Merged
nextestudios merged 2 commits into
mainfrom
feature/67-7z-creation
Sep 27, 2026
Merged

nextestudios merged 2 commits into
mainfrom
feature/67-7z-creation

Conversation

@nextestudios

Copy link
Copy Markdown
Owner

Summary

  • Decision (docs/decisions/0008-criacao-de-7z.md): no new dependency. SharpCompress (MIT, already shipped) can't write 7z, but it includes the C# port of the LZMA SDK encoder (public domain). SevenZipWriter writes the 7z container from the SDK's 7zFormat.txt: signature header, one solid LZMA stream, plain header with sizes, per-file CRC-32, UTF-16 names, mtime, attributes, empty files and empty folders. Alternatives evaluated: bundling 7za.exe (LGPL, ~1 MB per arch, external process, unsigned third-party binary) and 7z.dll wrappers (LGPL, native P/Invoke, unmaintained wrappers).
  • Behind the existing IArchiveService.CompressAsync; same safety rules as the other writers (links/junctions not followed, temp file renamed at the end, never overwrite, cancel leaves nothing).
  • Compress dialog: Formato cycles ZIP → TAR.GZ → 7z (existing order unchanged).
  • Dictionary per level: 1 / 8 / 16 MiB, shrunk to the input size (encoder memory ≈ 11× the dictionary). No password, LZMA2 or BCJ filters.

Tests (CI)

  • ArchiveCreatorTests.Round_trip_create_then_extract gains the 7z case; SevenZip_keeps_empty_files_and_folders_and_compresses (fast/max).
  • SevenZipInteropTests (Windows integration): the runner's real 7-Zip runs 7z t and 7z x on the created archive at each level and every file matches byte for byte (fails on CI if 7-Zip is missing).

UI: only the dialog text/option label; no manual checks needed beyond the existing compress flow.

Closes #67

🤖 Generated with Claude Code

nextestudios and others added 2 commits September 27, 2026 19:57
SharpCompress can't write 7z, but it ships the LZMA SDK encoder (public
domain port). SevenZipWriter writes a solid LZMA 7z container following
7zFormat.txt: signature header, packed stream and a plain header with
sizes, per-file CRC-32, UTF-16 names, times, attributes and empty
files/folders. No new dependency or native binary (decision 0008).

The compress dialog cycles ZIP -> TAR.GZ -> 7z; the creator keeps its
rules (links not followed, temp file, never overwrite).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
SharpCompress 1.0.0 reports entries without a data folder as encrypted, so
any 7z with an empty file asked for a password.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@nextestudios
nextestudios merged commit cd468a5 into main Sep 27, 2026
1 check passed
@nextestudios
nextestudios deleted the feature/67-7z-creation branch September 27, 2026 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add 7z archive creation

1 participant