SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Problem: CreateZipFile in Compact Framework 2.0

Last post 03-20-2007 8:07 PM by JohnReilly. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 03-16-2007 12:29 PM

    • gas12
    • Not Ranked
    • Joined on 03-16-2007
    • Posts 3

    Problem: CreateZipFile in Compact Framework 2.0

    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
     

     

  • 03-19-2007 11:50 AM In reply to

    • gas12
    • Not Ranked
    • Joined on 03-16-2007
    • Posts 3

    Re: Problem: CreateZipFile in Compact Framework 2.0

    I have resolved the problem simply changing library. Exactly I have used the SharpZipLib 0.84.0.0

    what of thoughts you?

    it was a known problem?

     

     

  • 03-19-2007 7:20 PM In reply to

    Re: Problem: CreateZipFile in Compact Framework 2.0

    Hi,

    Did you recompile the assembly or just use the one supplied?  It needs to be rebuilt with some defines.

    Something to tidy up for sure.

    Cheers, -jr-

  • 03-20-2007 10:46 AM In reply to

    • gas12
    • Not Ranked
    • Joined on 03-16-2007
    • Posts 3

    Re: Problem: CreateZipFile in Compact Framework 2.0

    No, I use a one compiled version library. (0.84) and I not rebuilt it.
  • 03-20-2007 8:07 PM In reply to

    Re: Problem: CreateZipFile in Compact Framework 2.0

    That will indeed work fine for older versions but not the current one.

    Cheers, -jr-

Page 1 of 1 (5 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.