This is a migrated thread and some comments may be shown as answers.

Stream compression not working

1 Answer 56 Views
ZipLibrary
This is a migrated thread and some comments may be shown as answers.
Syed
Top achievements
Rank 1
Syed asked on 12 Jul 2013, 09:48 AM
Hi,

we have requirement to generate zip file from list of images and allow it to download in Silverlight.
All images are stored on remote machine(\\192.168.1.7\\abc\\\abc\year\month\1234\1234.jpg).
so I have implemented functionality to get the list of images and passed it to wcf service as an argument
and it returns list of byte array.
I have implemented the below code to create the zip file from list of stream.
busyIndicator.IsBusy = true;
            if (ListPic.Count > 0)
            {
                //Save zip File
                SaveFileDialog dialog = new SaveFileDialog();
                dialog.Filter = "Zip File | *.zip";
                bool? dialogResult = dialog.ShowDialog();
                if (dialogResult == true)
                {
                    using (ZipPackage zipPackage = ZipPackage.Create(dialog.OpenFile()))
                    {
 
                        foreach (PictureFile pic in ListPic)
                        {
                            Stream picStream = new MemoryStream(pic.PictureStream);
                            zipPackage.AddStream(picStream, System.IO.Path.GetFileName(pic.PictureName),ZipCompression.Deflated,DateTime.Now);
                             
                        }
                    }
 
                     
                }
                busyIndicator.IsBusy = false;
                this.DialogResult = false;

                 
            }
            else
            {
                busyIndicator.IsBusy = false;
                this.DialogResult = false;
            }

In above code I have used to deflate compression to compress stream but it always returns the size and compression not works.
Is there any more configuration required for compression to work?

Thanks
Rahul


1 Answer, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 17 Jul 2013, 12:58 PM
Hi Rahul,

Unfortunately just looking through your code, I can't see what might be going wrong. Can you try to isolate the issue in a sample solution and send it over? Or you can try to reproduce it in the sample solution I attached. It basically zips an xml file stream. If you can even extend it to demonstrate your issues, we'll be able to take a closer look at the issue.

Regards,
Tina Stancheva
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
ZipLibrary
Asked by
Syed
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Share this question
or