[
  {
    "Id": "89779",
    "ThreadId": "26859",
    "Html": "\r\nPerhaps I'm missing something.<br />I'm trying to add different streams to the same zip file from within different functions.<br />The problem is that after AddFileStream is called, the corresponding stream cannot go out of scope while the ZipFile object is still in scope. If it does I get an exception. This occurs even if a Save() function is called right after AddFileStream.<br />Trying to create a separate ZipFile object within each function doesn't work either, since the last function call then just overwrites the previous ones.<br />Is there a way to do this?<br /><br /><br />",
    "PostedDate": "2008-04-29T21:30:34.077-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "91241",
    "ThreadId": "26859",
    "Html": "\r\nI'm running into the exact same issue - any input would be truly appriciated.<br /><br />Ellery<br />",
    "PostedDate": "2008-05-08T08:23:41.273-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "91269",
    "ThreadId": "26859",
    "Html": "\r\nSo here's my solution: I no longer use DotNetZip for saving. (However, I still use it for loading.)<br />For saving I use a utility called ZipStorer, located at http://69.10.233.10/KB/recipes/ZipStorer.aspx in the CodeProject by a guy called Jaime Olivares.<br />It's a small c# program that creates a zip archive, but WITHOUT COMPRESSION. (I didn't really want compression anyhow, since most of the files I'm archiving are already compressed.) So I use ZipStorer to create the zip, and it has no problems with adding to streams from different functions.<br />I still use DotNet Zip to read from a zip.<br />Bit strange using a separate libraries for reading and writing, I agree. However, can't use DotNetZip for both because a) The stream problem mentioned above, and b) No way to turn off compression (I posted a question about this, but nobody had any suggestions).<br />And can't use ZipStorer for both because (so far) it only has the capability to write to a zip, not to read from a zip. Even if ZipStorer added reading capability from uncompressed zips, I'd probably still use DotNetZip for reading. This is because I can then also robustly handle zips created outside my app.<br />From my testing so far, this solution seems robust.<br />But if you want to compress on writing, you'll obviously need an extra layer.<br />Hope this helps.<br />Adrian<br />",
    "PostedDate": "2008-05-08T09:58:26.85-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "91549",
    "ThreadId": "26859",
    "Html": "\r\nI actually fixed my issue. The root of my problem was that I was closing the StreamWriter I used to fill them stream. I commented out the streamWriter.Close() calls in all functions, and it works fine now. <br /><br /><div class=\"quote\" style=\"border: dotted .1em #aaa; border-left: none; border-right: none; font-style: italic; margin: 1em 0em 2.5em 3em;padding: .2em;\"><br />aadrian wrote:<br />So here's my solution: I no longer use DotNetZip for saving. (However, I still use it for loading.)<br />For saving I use a utility called ZipStorer, located at http://69.10.233.10/KB/recipes/ZipStorer.aspx in the CodeProject by a guy called Jaime Olivares.<br />It's a small c# program that creates a zip archive, but WITHOUT COMPRESSION. (I didn't really want compression anyhow, since most of the files I'm archiving are already compressed.) So I use ZipStorer to create the zip, and it has no problems with adding to streams from different functions.<br />I still use DotNet Zip to read from a zip.<br />Bit strange using a separate libraries for reading and writing, I agree. However, can't use DotNetZip for both because a) The stream problem mentioned above, and b) No way to turn off compression (I posted a question about this, but nobody had any suggestions).<br />And can't use ZipStorer for both because (so far) it only has the capability to write to a zip, not to read from a zip. Even if ZipStorer added reading capability from uncompressed zips, I'd probably still use DotNetZip for reading. This is because I can then also robustly handle zips created outside my app.<br />From my testing so far, this solution seems robust.<br />But if you want to compress on writing, you'll obviously need an extra layer.<br />Hope this helps.<br />Adrian<br /><br /><br /></div>",
    "PostedDate": "2008-05-09T12:12:05.993-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]