Zipping in a memory stream

6 posts, 0 answers
  1. Patrick
    Patrick avatar
    2 posts
    Member since:
    Dec 2011

    Posted 11 Dec 2012 Link to this post

    I am trying to zip files to a memory stream but the stream content is always 0 even if the stream length seem correct.

    MemoryStream ms = new MemoryStream();

                Telerik.Windows.Zip.ZipPackage z = null;

                        z = Telerik.Windows.Zip.ZipPackage.Create(ms);
                        z.Add(fi.FullName);

                Data = null;

                System.IO.BinaryReader reader = new System.IO.BinaryReader(ms);
                Data = new byte[(int)ms.Length];
                reader.Read(Data, 0, (int)ms.Length);            
                ms.Close();

    --> Data contains only "0".

    Can you pls advise ?

    Thanks

    Patrick
  2. Patrick
    Patrick avatar
    2 posts
    Member since:
    Dec 2011

    Posted 12 Dec 2012 Link to this post

    ok solved the issue, I was reading the mem stream at the wrong location

    Sorry for that
  3. Raghavendra
    Raghavendra avatar
    5 posts
    Member since:
    Aug 2012

    Posted 09 Apr 2013 Link to this post

    We are using the target framework as 4.5. Telerik.Windows.Zip dll is not compiling with our code as it used to. Is there a easy fix/solution? Why is this not upward compatible?
  4. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 12 Apr 2013 Link to this post

    Hi Raghavendra,

    I'm not sure where do you try to reference the Telerik.Windows.Zip.dll and why you can't compile the solution. As this forum thread is regarding the Silverlight version of the ZipLibrary, I'm not sure if you're trying to use the library in a Silverlight 5 application or not.

    However, please note that if you need to use the library in a Web solution, you'll need to get the version of the Telerik.Windows.Zip.dll that is provided within the WPF 4.5 assemblies as this is the plain .Net version assembly that can be used within Web solutions.

    All the best,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  5. Raghavendra
    Raghavendra avatar
    5 posts
    Member since:
    Aug 2012

    Posted 12 Apr 2013 Link to this post

    If we use WPF 4.5 version for Telerik.Windows.Zip.dll to zip data on Web Service, can we unzip the data on our Silverlight 5 UI with silverlight version of Telerik.Windows.Zip.dll without any shortcomings/issues/errors?
  6. Vladislav
    Admin
    Vladislav avatar
    275 posts

    Posted 17 Apr 2013 Link to this post

    Hello Raghavendra,

    It is absolutely valid scenario to use the Telerik.Windows.Zip.dll in the described way.
    If you encounter any issue using the ZipLibrary in the described way, this will mean that there is a problem in the ZipLibrary itself, rather than of an inappropriate use of it.

    Please let us know if you encounter any problem using it this way.

    Kind regards,
    Vladislav
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top