I came across an article on Codeproject that show how to use the built-in Microsoft .Net 4 classes (hidden) to handle more generic zip files. .Net does have a public System.IO.Compression namespace but it only expose gzip class. There is also the System.IO.Packaging classes but it is proprietary interface to support only things like Office Open XML.
Fortunately the .Net 4 assembly WindowsBase.DLL contains some more generic zip file handling routines (MS.Internal.IO.Zip) but unfortunately it is not exposed publicly. With the use of reflection you can access it – although it is probably not recommended for general use as Microsoft can change the interfaces any time they like because it is not public. Also, because it uses reflection there might be a performance hit plus issues trying to use it while not running under Full Trust because it requires ‘ReflectionPermission’ permissions.
At least this is a potential alternative. On the long run it would be better if Microsoft expose a generic public zip file handling interface. There might be a licensing issue that is causing them not to include it – since the zip standard as far as I remember is owned by PKWARE and it is not public.
0 Comments.