Search code examples
silverlightwindows-phone-7sharpziplib

How do I extract zip file in Windows Phone 7?


I have a zip file in my Windows Phone 7 project. I have set the Build Action to Content and Copy to output directory to Always. The zip file contains the folder structure. I want this to be copied entirely as it is in my Phone Project. I am using SharpZipLib for this. This is the code :-

 Stream stremInfo = Application.GetResourceStream(new Uri("xip.zip", UriKind.Relative)).Stream;



        new FastZip(). ExtractZip(stremInfo,
            "",FastZip.Overwrite.Always,null,null,null,true,true);

However I get error when ExractZip is called. The exception I get is "MethodAccessException". Cannot call GetFullPath(). Can anybody let me know what am I missing? What can I do to avoid it?


Solution

  • Check out this utility, it may help you out.

    http://www.sharpgis.net/post/2009/04/22/REALLY-small-unzip-utility-for-Silverlight.aspx