Use ZipWriterOptions instead of generic

This commit is contained in:
Matt Nadareski
2025-10-08 10:59:51 -04:00
parent 1f58521f51
commit dbd4b55dda
2 changed files with 6 additions and 8 deletions

View File

@@ -31,6 +31,7 @@
- Use null or empty instead of just null
- Guard against unzippable files
- Fix incorrect flagging of a failed check
- Use ZipWriterOptions instead of generic
### 3.4.2 (2025-09-30)

View File

@@ -9,7 +9,8 @@ using SabreTools.RedumpLib.Data;
using SharpCompress.Archives;
using SharpCompress.Archives.Zip;
using SharpCompress.Common;
using SharpCompress.Writers;
using SharpCompress.Compressors.Deflate;
using SharpCompress.Writers.Zip;
#endif
namespace MPF.Processors
@@ -132,14 +133,14 @@ namespace MPF.Processors
switch (logCompression)
{
case LogCompression.DeflateMaximum:
zf.SaveTo(archiveName, new WriterOptions(CompressionType.Deflate, 9));
zf.SaveTo(archiveName, new ZipWriterOptions(CompressionType.Deflate, CompressionLevel.BestCompression) { UseZip64 = true });
break;
case LogCompression.Zstd19:
zf.SaveTo(archiveName, new WriterOptions(CompressionType.ZStandard, 19));
zf.SaveTo(archiveName, new ZipWriterOptions(CompressionType.ZStandard, (CompressionLevel)19) { UseZip64 = true });
break;
case LogCompression.DeflateDefault:
default:
zf.SaveTo(archiveName, new WriterOptions(CompressionType.Deflate, 5));
zf.SaveTo(archiveName, new ZipWriterOptions(CompressionType.Deflate, CompressionLevel.Default) { UseZip64 = true });
break;
}
@@ -422,10 +423,6 @@ namespace MPF.Processors
// Create and add the entry
try
{
// Guard against unzippable files
if (new FileInfo(file).Length > uint.MaxValue)
return false;
archive.AddEntry(entryName, file);
}
catch