locked
Unzipping Files in Windows phone apps after being downloaded

    Question

  • I am trying to unzip a file after being downloaded. I have tried quite of a lot of searching and haven't found any compatible UNZIpper library for Windows 8.1 Runtime project. However i have tried using SharpZip

    I can extract the zip, There are multiple files in it. But i am not sure how can i extract them since Sharpzip is made for silverlight and

    SystemResourceInfo

    is missing from project.

    Here is its code

            public Stream GetFileStream(string filename)
            {
                if (fileEntries == null)
                    fileEntries = ParseCentralDirectory(); //We need to do this in case the zip is in a format Silverligth doesn't like
                long position = this.stream.Position;
                this.stream.Seek(0, SeekOrigin.Begin);
                if (stream != null)
                    return stream.Stream;
                return null;
            }

    I need to convert this piece of code into Windows 8.1 runtime. Not sure how cna i do that.


    Tuesday, November 25, 2014 6:28 PM

Answers

All replies

  • Have you tried using the classes in System.IO.Compression?
    http://msdn.microsoft.com/en-us/library/vstudio/System.IO.Compression(v=vs.110).aspx


    Eric Fleck, Windows Store and Windows Phone Developer Support. If you would like to provide feedback or suggestions for future improvements to the Windows Phone SDK please go to http://wpdev.uservoice.com/ where you can post your suggestions and/or cast your votes for existing suggestions.

    Tuesday, November 25, 2014 11:31 PM
    Moderator
  • Refer to this Windows Store code sample from OneCode team:

    How to download and extract zip file in Windows Store apps

    The APIs in this sample can also be used in Windows phone 8.1.

    BTW, this sample will be upgraded to universal Windows app soon.

    Wednesday, November 26, 2014 3:38 AM
  • Just confirmed by creating a blank windows phone runtime app and also check the documentation, ZipArchive Class is the one you need.

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Sunday, December 07, 2014 2:28 PM
    Moderator