[
  {
    "Id": "130915",
    "ThreadId": "39456",
    "Html": "Is there a way to add a comment to the ZipEntry when adding the ZipEntry?<br>\r\n<br>\r\nusing (ZipFile NewReportZip = new ZipFile(  sOutputZipFile ))<br>\r\n   {<br>\r\n//   NewReportZip.AddFile(sCurrentReport_FileAndPath,&quot;&quot;,ZipEntryComment);     // Would be nice to able to add the ZipEntry comment here<br>\r\n   NewReportZip.AddFile(sCurrentReport_FileAndPath,&quot;&quot;);                                    // Instead I have to add it<br>\r\n   NewReportZip.Save();<br>\r\n   }<br>\r\n<br>\r\nInstead I found that I have to add the entry (above) then iterate through all the entries to find the one I just added.  I then add the ZipEntry comment and save.<br>\r\n<br>\r\nforeach (ZipEntry ZippedReport in ExistingZip)   // Iterate the files within the zip file - checking for the curent file<br>\r\n   {   // If the names match then the report description of the current report will be added<br>\r\n   if ( Path.GetFileName(ZippedReport.FileName) == sCurrentReport_FileName )<br>\r\n      { <br>\r\n      ZippedReport.Comment = LookupCurrentReportDescription();<br>\r\n      ExistingZip.Save(); <br>\r\n      }<br>\r\n   }<br>\r\n<br>\r\n<br>\r\n<br>\r\n<span style=\"font-size:10px;color:#ffffff\">\r\n<p> </p>\r\n</span>\r\n",
    "PostedDate": "2008-11-07T12:25:04.34-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "130927",
    "ThreadId": "39456",
    "Html": "<p>Yes, you can set the comment on the entry right after you add it:</p>\r\n<pre>using (ZipFile NewReportZip = new ZipFile(  sOutputZipFile ))\r\n{\r\n   ZipEntry e = NewReportZip.AddFile(sCurrentReport_FileAndPath,&quot;&quot;);\r\n   e.Comment = &quot;DotNetZip is so nice to use. As a way of showing my appreciation, &quot; + <br>               &quot;I think I will donate to Cheeo's charity, RIGHT NOW.&quot;;\r\n   NewReportZip.Save();\r\n }\r\n</pre>\r\n<p>You could even combine that to a single line, as in : </p>\r\n<pre>using (ZipFile NewReportZip = new ZipFile(  sOutputZipFile ))\r\n{\r\n   NewReportZip.AddFile(sCurrentReport_FileAndPath,&quot;&quot;).Comment = &quot;Donating seems like the least I could do.&quot;;  \r\n   NewReportZip.Save();\r\n}\r\n</pre>\r\n<p> </p>\r\n<p><a href=\"http://cheeso.members.winisp.net/DotNetZipDonate.aspx\"><br>\r\nhttp://cheeso.members.winisp.net/DotNetZipDonate.aspx</a>  </p>\r\n",
    "PostedDate": "2008-11-07T13:16:27.1-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "130936",
    "ThreadId": "39456",
    "Html": "ps:  also, you do not have to iterate through the zipfile entries and check filenames. <br>\r\nThere is a string indexer. <br>\r\n<br>\r\n<pre>using (ZipFile z= ZipFile.Read(  sInputZipFile ))\r\n{\r\n   z[entryName].Comment = &quot;This is an updated comment.&quot;;\r\n   z.Save();\r\n}\r\n</pre>\r\n",
    "PostedDate": "2008-11-07T14:02:41.9-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]