[
  {
    "Id": "232191",
    "ThreadId": "68272",
    "Html": "<p>Hi Cheeso,</p>\r\n<p>Any chance of having the IsZipFile methods available to COM clients or variation of? I think because its shared its not exposed</p>\r\n<p>I want to use - <span>Public</span> <span>Shared</span> <span>Function</span> <span>IsZipFile</span> (&nbsp;f<span>ileName</span> <span>As</span> <a href=\"http://msdn2.microsoft.com/en-us/library/s1wwdcbf\">String</a>,&nbsp;<span>testExtract</span> <span>As</span> <a href=\"http://msdn2.microsoft.com/en-us/library/a28wyd50\">Boolean</a>) <span>As</span> <a href=\"http://msdn2.microsoft.com/en-us/library/a28wyd50\">Boolean</a>&nbsp;(none of the overloads are available)</p>\r\n<p>I can't create my own implementation within my app (catching errors on the way) as I don't have access to a Stream.Null to dump the entries on extract</p>\r\n<p>Hope you can work your magic or suggest an alternative</p>\r\n<p>Thanks</p>\r\n<p>Matt</p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-09-08T05:50:19.923-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "232288",
    "ThreadId": "68272",
    "Html": "<p>Hmm, I'll have to think about it.</p>",
    "PostedDate": "2009-09-08T09:52:16.7-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "232377",
    "ThreadId": "68272",
    "Html": "<p>I don't think so.</p>\r\n<p>COM uses instances, and allows you to invoke methods on those instances. The easiest way to do what you want would be to create a wrapper class in .NET that did nothing but invoke the static IsZipFile method on the Ionic.ZipFile class. Stream.Null is also a static property, so also inaccessible to COM clients.</p>\r\n<p>What is the COM environment you're working in?&nbsp;</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-09-08T13:01:59.127-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "232472",
    "ThreadId": "68272",
    "Html": "<p>Here;s a wrapper class that does what you need.</p>\r\n<div style=\"color:Black;background-color:White\">\r\n<pre><span style=\"color:Green\">// ZipHelper.cs</span>\r\n<span style=\"color:Green\">// ------------------------------------------------------------------</span>\r\n<span style=\"color:Green\">//</span>\r\n<span style=\"color:Green\">// a wrapper class that allows COM clients to call static methods exposed by the Ionic.Zip assembly.</span>\r\n<span style=\"color:Green\">//</span>\r\n<span style=\"color:Green\">// Build this with:</span>\r\n<span style=\"color:Green\">//       csc.exe  /debug+ /target:library /R:&quot;c:\\program files\\dino chiesa\\DotNetZip Tools v1.9\\Ionic.Zip.dll&quot; ZipHelper.cs</span>\r\n<span style=\"color:Green\">// </span>\r\n<span style=\"color:Green\">// Before using this component from COM, you must register it with:</span>\r\n<span style=\"color:Green\">//       regasm /codebase ZipHelper.dll </span>\r\n<span style=\"color:Green\">// </span>\r\n<span style=\"color:Green\">// ------------------------------------------------------------------</span>\r\n<span style=\"color:Green\">//</span>\r\n<span style=\"color:Green\">// Copyright (c) 2009 by Dino Chiesa</span>\r\n<span style=\"color:Green\">// All rights reserved!</span>\r\n<span style=\"color:Green\">//</span>\r\n<span style=\"color:Green\">// ------------------------------------------------------------------</span>\r\n\r\n<span style=\"color:Blue\">using</span> System;\r\n<span style=\"color:Blue\">using</span> System.Reflection;\r\n<span style=\"color:Blue\">using</span> System.Security;\r\n<span style=\"color:Blue\">using</span> System.Runtime.CompilerServices;\r\n<span style=\"color:Blue\">using</span> Interop=System.Runtime.InteropServices;\r\n\r\n<span style=\"color:Blue\">using</span> Ionic.Zip;\r\n\r\n\r\n<span style=\"color:Green\">// Setting ComVisible to false makes the types in this assembly not visible </span>\r\n<span style=\"color:Green\">// to COM components.  If you need to access a type in this assembly from </span>\r\n<span style=\"color:Green\">// COM, set the ComVisible attribute to true on that type.</span>\r\n[<span style=\"color:Blue\">assembly</span>: Interop.ComVisible(false)]\r\n\r\n<span style=\"color:Green\">// The following GUID is for the ID of the typelib if this project is exposed to COM</span>\r\n[<span style=\"color:Blue\">assembly</span>: Interop.Guid(<span style=\"color:#A31515\">&quot;cd7f0cd4-d916-4964-8bc0-688ece38ffba&quot;</span>)]\r\n[<span style=\"color:Blue\">assembly</span>:System.CLSCompliant(true)]\r\n\r\n\r\n<span style=\"color:Blue\">namespace</span> Ionic.Wrappers\r\n{\r\n    [Interop.GuidAttribute(<span style=\"color:#A31515\">&quot;C6F3AF2D-053F-3A3C-91DB-15FBD94DBBC5&quot;</span>)]\r\n    [Interop.ComVisible(<span style=\"color:Blue\">true</span>)]\r\n    [Interop.ClassInterface(Interop.ClassInterfaceType.AutoDispatch)]\r\n\r\n    <span style=\"color:Blue\">public</span> <span style=\"color:Blue\">class</span><span style=\"color:MediumTurquoise\"> ZipHelper\r\n    </span>{\r\n        <span style=\"color:Blue\">public</span> <span style=\"color:Blue\">bool</span> IsZipFile(<span style=\"color:Blue\">string</span> filename)\r\n        {\r\n            <span style=\"color:Blue\">return</span> ZipFile.IsZipFile(filename);\r\n        }\r\n\r\n        <span style=\"color:Green\">// Cannot use &quot;overloaded&quot; Method names in COM interop.</span>\r\n        <span style=\"color:Green\">// So, use a unique name. </span>\r\n        <span style=\"color:Blue\">public</span> <span style=\"color:Blue\">bool</span> IsZipFileWithExtract(<span style=\"color:Blue\">string</span> filename)\r\n        {\r\n            <span style=\"color:Blue\">return</span> ZipFile.IsZipFile(filename, <span style=\"color:Blue\">true</span>);\r\n        }\r\n    }\r\n    \r\n}\r\n\r\n</pre>\r\n</div>\r\n<p>You need to have the Ionic.Zip.dll installed in the GAC for this to work.&nbsp; (run this command:&nbsp;&nbsp; gacutil -i Ionic.Zip.dll)&nbsp;</p>\r\n<p>And here's a javascript client that uses the wrapper class.</p>\r\n<div style=\"color:Black;background-color:White\">\r\n<pre>    <span style=\"color:Blue\">try</span> \r\n    {\r\n        <span style=\"color:Blue\">var</span> obj = <span style=\"color:Blue\">new</span> ActiveXObject(<span style=\"color:#A31515\">&quot;Ionic.Wrappers.ZipHelper&quot;</span>);\r\n        <span style=\"color:Blue\">var</span> result = obj.IsZipFile(<span style=\"color:#A31515\">&quot;TestZipHelper.js&quot;</span>);\r\n        WScript.Echo(<span style=\"color:#A31515\">&quot;result : &quot;</span> + result);\r\n\r\n        result = obj.IsZipFileWithExtract(<span style=\"color:#A31515\">&quot;dunc.zip&quot;</span>);\r\n        WScript.Echo(<span style=\"color:#A31515\">&quot;result : &quot;</span> + result);\r\n    }\r\n    <span style=\"color:Blue\">catch</span> (e2)\r\n    {\r\n        WScript.Echo(e2.number + <span style=\"color:#A31515\">&quot;: &quot;</span> + e2.name);\r\n        WScript.Echo(e2.message);\r\n    }\r\n\r\n</pre>\r\n</div>",
    "PostedDate": "2009-09-08T18:48:34.04-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "232495",
    "ThreadId": "68272",
    "Html": "This discussion has been copied to a work item. Click <a href=\"http://dotnetzip.codeplex.com/WorkItem/View.aspx?WorkItemId=8698\">here</a> to go to the work item and continue the discussion.",
    "PostedDate": "2009-09-08T20:19:32.6-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "232502",
    "ThreadId": "68272",
    "Html": "<p>I decided to implement the wrapper class&nbsp;in DotNetZip.&nbsp;</p>\r\n<p>The class name is Ionic.Zip.ComHelper.&nbsp; It exposes a method called IsZipFile(), that accepts a string.</p>\r\n<p>This change is in v1.9.0.3 of the library.</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-09-08T20:39:23.16-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "232852",
    "ThreadId": "68272",
    "Html": "<p>Thanks Cheeso you're are star!</p>\r\n<p>Works perfectly!</p>\r\n<p>I really appreciate&nbsp;you added the wrapper within your libary. I didn't want to have to create and maintain&nbsp;my own version.&nbsp;I believe it also enhances your library. looking forward to further COM enhancements.</p>\r\n<p>In answer to your question I'm currently using vbscript in WSH and SQL Server Data Transformation Services - I know time to upgrade but life is never that easy</p>\r\n<p>Some things i noticed on&nbsp;1.9.0.3</p>\r\n<p>the DotNetZipLib-Runtime-v1.9.msi once run is titled 1.8 and installs to 1.8.</p>\r\n<p>Within the chm on the ComHelper documentation the&nbsp;functions&nbsp;ReturnValue&nbsp;is &quot;[Missing &lt;returns&gt; documentation for &quot;......&quot;</p>\r\n<p>perhaps a couple of tweaks for your next release</p>\r\n<p>Thanks again Matt</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-09-09T15:27:53.127-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "232923",
    "ThreadId": "68272",
    "Html": "<p>Matt, thanks for the feedback and bug reports.</p>\r\n<p>I'll fix those things.</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-09-09T20:54:06.677-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "232928",
    "ThreadId": "68272",
    "Html": "<p>ps: I tried using that wrapper, and it worked, but it was too much of a hassle to set up.&nbsp;&nbsp; It needed to be registered, and The Ionic.Zip.dll needed to be in the GAC, and all that was just a hassle.&nbsp; So I decided it would be worth it just having the helper class inside the library.&nbsp;&nbsp; I'm glad you like it.</p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>\r\n<p>&nbsp;</p>",
    "PostedDate": "2009-09-09T21:16:19.917-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]