Hi! this is my first post in this forum, I use SharpZipLib (vers 0.85) in my Pocket PC project.
I create a simple method that I invoke on button click.
This is the code:
public static void zippa(string source, string dest)
{
try
{
string[] filenames = Directory.GetFiles(source);
using (ICSharpCode.SharpZipLib.Zip.ZipOutputStream s = new ICSharpCode.SharpZipLib.Zip.ZipOutputStream(File.Create(dest)))
{
s.SetLevel(5); // 0 - store only to 9 - means best compression
byte[] buffer = new byte[4096];
foreach (string file in filenames)
{
ICSharpCode.SharpZipLib.Zip.ZipEntry entry = new ICSharpCode.SharpZipLib.Zip.ZipEntry(System.IO.Path.GetFileName(file));
entry.DateTime = DateTime.Now;
s.PutNextEntry(entry);
using (FileStream fs = File.OpenRead(file))
{
int sourceBytes;
do
{
sourceBytes = fs.Read(buffer, 0, buffer.Length);
s.Write(buffer, 0, sourceBytes);
} while (sourceBytes > 0);
}
}
s.Finish();
s.Close();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
I call this method in my button on click :
zippa("\\sistema", "asso1.zip");
But I have this exception:
System.MissingMethodException:
ICSharpCode.SharpZipLib.Zip.Compression.Sreams.DeflaterOutputStream.Close()
This code run under windows application and no problem I have. The problem is when I run this code under Pocket PC with windows mobile 5.
Thank you all... and sorry for my English.
gaspare novara