Skip to content

Conversation

@Nanook
Copy link
Collaborator

@Nanook Nanook commented Jul 23, 2025

Add ZStandard compression support and enhanced Zip creation tests

This PR introduces ZStandard compression support for ZIP archives with configurable compression levels, along with comprehensive test coverage for various compression algorithms and performance validation.

Key Changes:
• ZStandard ZIP Support: Added ZStandard compression capability with full compression level control
• Enhanced CompressionLevel API: Updated WriterOptions.CompressionLevel to use int type, enabling support for various compression algorithms with different level ranges (e.g., ZStandard levels 1-22, Deflate levels 1-9)
• Backward Compatibility: All changes maintain backward compatibility with existing APIs

New Test Coverage:
• Comprehensive Zip Creation Tests: Added extensive test suite using a deterministic pseudo-text stream generator
• Multi-Algorithm Testing: Tests cover Deflate, ZStandard, BZip2, LZMA, and uncompressed scenarios
• Compression Level Validation: Validates compression effectiveness across different levels with realistic ratio expectations
• Large File Testing: Tests with multi-megabyte files to exercise IStackStream buffering and rewind capabilities more thoroughly
• CRC32 Verification: All tests include end-to-end CRC32 validation to ensure data integrity

@Nanook Nanook requested review from adamhathcock and Copilot July 24, 2025 00:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces comprehensive ZStandard compression support for ZIP archives with configurable compression levels, along with enhanced testing infrastructure for validating compression algorithms and their effectiveness.

  • ZStandard compression integration with full level control (1-22 range)
  • Enhanced compression level API using int type instead of enum for broader algorithm support
  • Comprehensive test suite with deterministic pseudo-text generation and CRC32 validation

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tests/SharpCompress.Test/Zip/ZipMemoryArchiveWithCrcTests.cs Comprehensive test suite for multiple compression algorithms with CRC32 validation and compression ratio testing
tests/SharpCompress.Test/Zip/TestPseudoTextStream.cs Deterministic pseudo-text generator for creating compressible test data
tests/SharpCompress.Test/ArchiveTests.cs Enhanced base test infrastructure with CRC32 utilities and compression verification methods
src/SharpCompress/Writers/Zip/ZipWriterOptions.cs Updated compression level API with backward compatibility and ZStandard support
src/SharpCompress/Writers/Zip/ZipWriterEntryOptions.cs Modernized compression level properties with deprecation handling
src/SharpCompress/Writers/Zip/ZipWriter.cs Core ZStandard compression implementation and int-based compression level support
src/SharpCompress/Writers/WriterOptions.cs Base compression level property with algorithm-specific defaults
src/SharpCompress/Writers/GZip/GZipWriterOptions.cs Updated to use new int-based compression level system
src/SharpCompress/Writers/GZip/GZipWriter.cs Adapted for new compression level type
src/SharpCompress/Common/Zip/ZipFilePart.cs Updated ZStandard compression method reference
src/SharpCompress/Common/Zip/ZipEntry.cs Added ZStandard compression type mapping
src/SharpCompress/Common/Zip/ZipCompressionMethod.cs Renamed ZStd to ZStandard for consistency
src/SharpCompress/Common/CompressionType.cs Added ZStandard compression type enum

Nanook and others added 6 commits July 24, 2025 01:28
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Nanook
Copy link
Collaborator Author

Nanook commented Jul 24, 2025

Copilot not doing a great job there heh.

Copy link
Owner

@adamhathcock adamhathcock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again!

I'm gonna have to look at what you're using for AI too. The PR summarizes are good but generated?

@adamhathcock adamhathcock merged commit 35aee6e into adamhathcock:master Jul 24, 2025
2 checks passed
@Nanook
Copy link
Collaborator Author

Nanook commented Jul 24, 2025

I used github copilot to rewrite my version of the changes. Then I read it carefully to ensure it's what I want it to say and ask it to correct things I'm not happy with.

Just experimental usage at the moment really :). I find it's to eagre to big things up too much. I have to dial it back a lot. I do like how it's able to restructure and format though. I'll not use it if you don't like it though :)

@adamhathcock
Copy link
Owner

I 100% like AI and I use copilot at work as well. I'm just taking in things slowly instead of going full vibe coding

@Nanook
Copy link
Collaborator Author

Nanook commented Jul 24, 2025

I switched from C# professionally to Typescript in AWS, AI has been invaluable in the transition. I'm not a fan of it integrating in to my dev environment though too much. I prefer to engage with it like having an expert sat next to me that I can probe about design, best practice and snippets so I can cherry pick and I retain the understanding of what I'm doing ha. Sounds like what you describe too.

I've dipped my toe into vibe coding with bugs and errors resolution for a quick win, I've too often found myself going around in circles ;-)

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.

2 participants