Can anybody help out with this error? I'm not new to .net, but very new to Mono.
Full error message:
DllNotFoundException: MonoPosixHelper
System.IO.Compression.DeflateStream..ctor (System.IO.Stream compressedStream, CompressionMode mode, Boolean leaveOpen, Boolean gzip)
(wrapper remoting-invoke-with-check) System.IO.Compression.DeflateStream:.ctor (System.IO.Stream,System.IO.Compression.CompressionMode,bool,bool)
System.IO.Compression.GZipStream..ctor (System.IO.Stream compressedStream, CompressionMode mode, Boolean leaveOpen)
System.IO.Compression.GZipStream..ctor (System.IO.Stream compressedStream, CompressionMode mode)
(wrapper remoting-invoke-with-check) System.IO.Compression.GZipStream:.ctor (System.IO.Stream,System.IO.Compression.CompressionMode)
Demeter.Zipper.Decompress (System.IO.Stream source, System.IO.Stream destination)
Demeter.DataArchive.GetItemFromArchive[StringLibrary] (System.String folder, System.String fileName) [0x00000]
TestScript.Start () (at Assets\Scripts\TestScript.cs:29)
I'm definitely targeting Windows for my app and hoping to target Macs.
Here's my nifty Zipper class:
/// /// Simple stream compression utlity class /// Source: http://blogs.msdn.com/bclteam/archive/2005/06/15/429542.aspx ///
public static class Zipper
{
/// <summary>
/// Compress the source stream to the destination
/// </summary>
/// <param name="source"></param>
/// <param name="destination"></param>
public static void Compress(Stream source, Stream destination)
{
// We must explicitly close the output stream, or GZipStream will not
// write the compression's footer to the file. So we'll get a file, but
// we won't be able to decompress it. We'll get back 0 bytes.
using (GZipStream output = new GZipStream(destination, CompressionMode.Compress))
{
Pump(source, output);
}
}
/// <summary>
/// Decompress the source stream to the destination
/// </summary>
/// <param name="source"></param>
/// <param name="destination"></param>
public static void Decompress(Stream source, Stream destination)
{
using (GZipStream input = new GZipStream(source, CompressionMode.Decompress))
{
Pump(input, destination);
}
}
/// <summary>
/// private buffer pumper to shove one stream into another
/// </summary>
/// <param name="input"></param>
/// <param name="output"></param>
private static void Pump(Stream input, Stream output)
{
byte[] bytes = new byte[4096];
int n;
while ((n = input.Read(bytes, 0, bytes.Length)) != 0)
{
output.Write(bytes, 0, n);
}
}
}
Thanks for the deep research, Lucas. I have asked the follow up question here: http://answers.unity3d.com/questions/10650/whats-the-best-way-to-implement-file-compression
– Bioplasm