[
  {
    "Id": "460044",
    "ThreadId": "217353",
    "Html": "<p>I have a zip file that has been created with no compression.</p>\r\n<p>I would like to update the compression level without having to extract all of the files. &nbsp;Is there a method of doing this?</p>\r\n<p>I tried to simply read the zip file and then change the compression level and save the zip, with no luck:</p>\r\n<p>&nbsp;</p>\r\n<div style=\"color:black;background-color:white\">\r\n<pre>ZipFile zip2 = ZipFile.Read(<span style=\"color:#a31515\">@&quot;c:\\users\\daniel.judge.ACTIOFFICE\\Desktop\\Desktop.gt3x&quot;</span>);\r\nzip2.CompressionLevel = Ionic.Zlib.CompressionLevel.BestCompression;\r\nzip2.Save();\r\n</pre>\r\n</div>\r\n<p>Any suggestions?</p>\r\n<p>And btw, your software works wonderfully. &nbsp;We require the use of reading out compressed files byte by byte and it couldn't be simpler. &nbsp;Thanks again!</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2010-06-25T12:07:16.137-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "460809",
    "ThreadId": "217353",
    "Html": "<p>You should be able to do what you want, but you need to set the CompressionLevel property on the individual ZipEntry instances, not on the containing ZipFile.&nbsp;</p>\r\n<p>The way it works is that the CompressionLevel applies to entries, not to the entire zipfile as a whole. &nbsp;So when you set the CompressionLevel on the ZipFile, this is the level that is ued for all subsequently added ZipEntries. &nbsp;If you then call AddEntry(), the newly added entry will get the CompressionLevel from the ZipFile container.&nbsp;</p>\r\n<p>For updating a zip file, you'd need to set the compression level on each entry, then re-save the ZipFile. &nbsp;</p>\r\n<p>\r\n<div style=\"color:black;background-color:white\">\r\n<pre><span style=\"color:blue\">using</span> (<span style=\"color:blue\">var</span> zip = ZipFile.Read(<span style=\"color:#a31515\">&quot;c:\\\\myzip.zip&quot;</span>))\r\n{\r\n  <span style=\"color:blue\">foreach</span>(<span style=\"color:blue\">var</span> e <span style=\"color:blue\">in</span> zip) \r\n  {\r\n    e.CompressionLevel = CompressionLevel.Best;\r\n  }\r\n  zip.Save();\r\n}\r\n\r\n\r\n</pre>\r\n</div>\r\n</p>",
    "PostedDate": "2010-06-28T13:01:09.25-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]