[
  {
    "Id": "229544",
    "ThreadId": "67537",
    "Html": "<p>First, it is a brilliant&nbsp;library!</p>\r\n<p>It is reasonable that the date and time is appropriate for each zipped file within one zip file, however, some (commercial) programs still create zip file that contains files with strange date and time (not limitted to the cases already better handled by the latest version).</p>\r\n<p>Since this bad date and time exception will cause failure when read such zip files, it would be great if an option could be provided in version 1.9 that indicate whether to ignore such bad date and time, and default value for this option could be&nbsp;true, and&nbsp;user can turn if off if they want a strict check on date time for the zipped file.</p>\r\n<p>It could be&nbsp;a public static bool property&nbsp;for ZipFile class, or other better idea/implementation.</p>\r\n<p>Following is a rough&nbsp;implementation within <strong>PackedToDateTime</strong> function to illustrate the&nbsp;basic idea&nbsp;(better implementation would be more than welcome):</p>\r\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...</p>\r\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch (System.ArgumentOutOfRangeException)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (<span style=\"color:#0000ff\">IgnoreBadDateTime</span>)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return new System.DateTime(1980, 1, 1, 0, 0, 0, 0);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb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bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p>\r\n<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...</p>\r\n<p>&nbsp;</p>\r\n<p>Thanks a lot.</p>\r\n<p>Best regards.</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-08-31T19:49:24.723-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "229559",
    "ThreadId": "67537",
    "Html": "<p>Thank you for the suggestion.</p>\r\n<p>I don't really understand how your proposed change would work.&nbsp; What specific problem do you see it solving?&nbsp;</p>\r\n<p>Maybe you could provide for me a description of what happens now, and what would be better with the proposed change?</p>\r\n<p>In looking at your code, I can see that the IgnoreBadDateTime property applies when the parsing of the embedded time within a zip file has failed. There is handling for those failed times already, as you can see.&nbsp; In the error handling that exists today, I use an approach that relaxes constraints progressively as parsing the time fails.&nbsp; I did this because people had brought me zip files that had valid times, but invalid dates.&nbsp;&nbsp;</p>\r\n<p>What would your flag do differently?</p>\r\n<p>I'm trying to understand why it would be better.</p>\r\n<p>Also you suggested that there are commercial programs that generate broken zip files.&nbsp; Which programs?&nbsp; Why not ask them to generate correct zip files?&nbsp; And, what is different about the bad dates in those files that is not well handled in the current approach?</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-08-31T20:34:59.547-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "229626",
    "ThreadId": "67537",
    "Html": "<p>Thanks a lot for your swift reply.</p>\r\n<p>The bad date time example&nbsp;I encountered is: year = 1980, <strong>month = <span style=\"color:#ff0000\">1</span></strong>, day = 0, so it finally&nbsp;causes an exception even with current exception handling in latest 1.8.4.22, and the zip file is OK, not currupted (other zip tools can open them), but only bad on date time data (and is different to the cases already better handled by current code).</p>\r\n<p>I guess possible other (commercial) tools&nbsp;may create other different bad/strange date time cases as well (though we do not know how it would be yet), since such zip files are OK except for only bad date time issue, an option would be better to handle all similar&nbsp;cases in the future, otherwise, has to adjust the exception handling code each time when encounter a new kind of&nbsp;such&nbsp;bad date time&nbsp;zip file.</p>\r\n<p>For the comercial programs,&nbsp;I am&nbsp;not powerful enough to influence their development team, but&nbsp;have to handle such zip files :-(.</p>\r\n<p>BTW, the extension for the example&nbsp;file is *.xlz (zipped xliff file), not zip.</p>\r\n<p>Sorry that I could not provide&nbsp;the whole example zip file&nbsp;to you because&nbsp;it is from one of our&nbsp;real&nbsp;projects&nbsp;which contains customer data, following&nbsp;are the head bytes for the entry, hope it would be useful:</p>\r\n<p>50 4B 03 04 14 00 00 00 08 00 00 00 20 00 EE AD F8 66 A9 BE 02 00 E2 C5 14 00 13 00 00 00 77 6F 72 6B 62 65 6E 63 68 5F 74 61 73 6B 73 2E 78 6C 66</p>\r\n<p>&nbsp;</p>\r\n<p>Thanks again.</p>",
    "PostedDate": "2009-09-01T02:38:15.72-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "229765",
    "ThreadId": "67537",
    "Html": "<p>OK I understand.</p>\r\n<p>I am reluctant to add new interfaces to the library, new things to document and deal with. I'd rather the library just handle poorly formatted dates automatically. So I don't like the idea of another property on the zipfile class.&nbsp; I propose making a change from this</p>\r\n<div style=\"color:Black;background-color:White\">\r\n<pre><span style=\"color:Blue\">catch</span> (System.ArgumentOutOfRangeException)\r\n{\r\n    <span style=\"color:Blue\">if</span> (year == 1980 &amp;&amp; month == 0 &amp;&amp; day == 0)\r\n    {\r\n        <span style=\"color:Blue\">try</span>\r\n        {\r\n\r\n</pre>\r\n</div>\r\n<p>...to this:</p>\r\n<div style=\"color:Black;background-color:White\">\r\n<pre><span style=\"color:Blue\">catch</span> (System.ArgumentOutOfRangeException)\r\n{\r\n    <span style=\"color:Blue\">if</span> (year == 1980 &amp;&amp; (month == 0 || day == 0))\r\n    {\r\n        <span style=\"color:Blue\">try</span>\r\n        {\r\n\r\n</pre>\r\n</div>\r\n<p>This should handle your case, right?</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-09-01T09:24:12.78-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "229976",
    "ThreadId": "67537",
    "Html": "<p>Understood. Thank you.</p>\r\n<p>The proposed change will be welcome.</p>\r\n<p>It would be a pity that&nbsp;there might be other new kind of bad date time in the future (seems&nbsp;some programs does not care about&nbsp;the date time in zip file - this include even Office 2007 format files, such as docx, xlsx, pptx, etc.).</p>\r\n<p>Anyway, I can adjust and re-compile the library locally when necessary if it is not good to add new interfaces to the library globally.</p>\r\n<p>Best Regards.</p>",
    "PostedDate": "2009-09-01T18:20:49.257-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]