How to use System.IO.Packaging in MonoTouch

1.1k views Asked by At

I got a problem while trying to use the System.IO.Packaging in MonoTouch. I cant found this ressource. Can anybody tell me where to find this ressource?

3

There are 3 answers

0
Jamie On BEST ANSWER

As far as I can see I'ts not available in MonoTouch.

If you need Zip Support, SharpZibLib works with MonoTouch.

If you use SharpZipLib watch out for this issue: Monotouch - ICSharpCode.SharpZipLib giving an error

1
Krumelur On

If you want to zip/unzip something you might also want to have a look at System.IO.Compression.GZIPStream() which is also available in MT. Use it like this:

string sContent;
string sDest = "zipped file with text content.zip";
using ( FileStream oIn = File.OpenRead( sDest ) )
using ( MemoryStream oOut = new MemoryStream() )
using ( GZipStream oZip = new GZipStream( oIn, CompressionMode.Decompress ) )
using ( StreamReader oReader = new StreamReader( oOut ) )
{
    oZip.CopyTo( oOut );
    oOut.Seek( 0, SeekOrigin.Begin );
    sContent = oReader.ReadToEnd();
}
1
poupou On

System.IO.Packaging is part of WindowsBase.dll which is not shipped with MonoTouch (5.x).

However it's types, like ZipPackage are not fully compatible with normal zip files so this might not be ideal if you're looking to process .zip files. In this case you better use alternative libraries like the one mentioned by @Jamie.

If you really want some specific types System.IO.Packaging then you can try building the assembly from Mono source code (open source) which is available from gihub.