[
  {
    "Id": "259986",
    "ThreadId": "76014",
    "Html": "<p>I'm encountering the following problem...</p>\r\n<p>For an validated .epub file it's necessarry to insert (as the first file) an uncompressed&nbsp;mimetype file with the following content (without any linefeed/linetermination ..)</p>\r\n<p>application/epub+zip</p>\r\n<p>I do this with this code:</p>\r\n<p><span style=\"font-size:x-small\"></span>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>\r\n</p>\r\n<div style=\"color:Black;background-color:White\">\r\n<pre>ZipFile zip = <span style=\"color:Blue\">new</span> ZipFile();\r\nzip.CompressionLevel = Ionic.Zlib.CompressionLevel.Level0; // tried .None also\r\nzip.AddFile(System.IO.Path.Combine(f_WorkingFolder, <span style=\"color:#A31515\">&quot;mimetype&quot;</span>), <span style=\"color:#A31515\">&quot;&quot;</span>);\r\nzip.Save(f_OutputFile);\r\n</pre>\r\n</div>\r\n<div style=\"color:Black;background-color:White\">..but..</div>\r\n<div style=\"color:Black;background-color:White\">If you look at&nbsp;my file with a hex editor, it should have application/epub+zip at bytes 0x26 to 0x3A, immediately following the mimetype filename.<br>In&nbsp;the zipped&nbsp;file the mimetype filename is in the right place, but the file contents doesn't immediately follow it.</div>\r\n<div style=\"color:Black;background-color:White\">Als a result..the .epub file can't be validated</div>\r\n<div style=\"color:Black;background-color:White\">Any thoughts...or even better...a solution ?</div>\r\n<div style=\"color:Black;background-color:White\">Regards,</div>\r\n<div style=\"color:Black;background-color:White\">Martin</div>\r\n<div style=\"color:Black;background-color:White\">&nbsp;</div>\r\n<div style=\"color:Black;background-color:White\">&nbsp;</div>",
    "PostedDate": "2009-11-23T13:58:00.843-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "260010",
    "ThreadId": "76014",
    "Html": "<p>I don't understand.</p>\r\n<p>Why are you looking at the zip file with a hex editor?&nbsp; What's the problem with the zip file - is it not being read successfully?</p>\r\n<p>If you want to insert a file like that, I suggest something like this:</p>\r\n<div style=\"color:Black;background-color:White\">\r\n<pre><span style=\"color:Blue\">using</span> (ZipFile zip = <span style=\"color:Blue\">new</span> ZipFile())\r\n{\r\n  <span style=\"color:Blue\">var</span> e = zip.AddEntry(<span style=\"color:#A31515\">&quot;mimetype&quot;</span>, <span style=\"color:#A31515\">&quot;application/epub+zip&quot;</span>);\r\n  e.CompressionLevel = Ionic.Zlib.CompressionLevel.None; \r\n  <span style=\"color:Green\">// add other files here</span>\r\n  <span style=\"color:Green\">// ...</span>\r\n  zip.Save(f_OutputFile);\r\n}\r\n</pre>\r\n</div>\r\n<p>The AddEntry() will insert an entry into the zip file with the given name, and the given content. <a href=\"http://cheeso.members.winisp.net/DotNetZipHelp/html/22d20868-e8bf-555a-10e7-f6e7cada6826.htm\">Check the doc for more info</a>.</p>\r\n<p>Also, You can set the CompressionLevel on an individual entry or on the entire file. I'm not sure which you need to do, but my code shows how to do it on the individual entry.</p>\r\n<p>By default, Zip entries created by DotNetZip will include extra data, for the timestamp on the file. This data will appear in the zip file immediately after the filename, and immediately before the file content. Normally this is tolerated by zip tools that read the files.&nbsp; In some cases it is not.&nbsp; To turn off the timestamp, set <a href=\"http://cheeso.members.winisp.net/DotNetZipHelp/html/c049346b-8560-ab16-66e5-cefdb0ac5c31.htm\">EmitTimesInWindowsFormatWhenSaving</a> to false, on the ZipEntry.&nbsp; This would be (e.EmitTimesInWindowsFormatWhenSaving = false;)</p>\r\n<p>That will eliminate the extra data between the filename and the file content.</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-11-23T14:44:52.207-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "260121",
    "ThreadId": "76014",
    "Html": "<p>Hi Cheeso,</p>\r\n<p>I didn't invent the rules: <a href=\"http://en.wikipedia.org/wiki/EPUB\">http://en.wikipedia.org/wiki/EPUB</a>.</p>\r\n<p>I've posted my mimefile to some .epub wizards and they came up with the hex differences.</p>\r\n<p>Thank you for your info. I will look into it your solutions..</p>\r\n<p>Regards...</p>",
    "PostedDate": "2009-11-24T00:06:25.2-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "260127",
    "ThreadId": "76014",
    "Html": "<p>YOU JUST MADE MY DAY !!!</p>\r\n<p>Thank you cheeso...it worked...</p>\r\n<p>Martin</p>",
    "PostedDate": "2009-11-24T00:30:11.033-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]