Telerik Forums
Telerik Document Processing Forum
1 answer
186 views
Hey together,

I've got a little problem with the ZipPackage in the Telerik.Windows.Zip library.

I'm developing in a Silverlight environment (Silverlight Business Application). On the server side I zip a user specified amount of files (which are stored in a Microsoft SQL database).

At first a little code snippet:

MemoryStream ms = new MemoryStream();
byte[] zip = null;
 
using ( ZipPackage zipfile = ZipPackage.Create(ms) ) {
    foreach ( var kvp in files ) {
        zipfile.AddStream(new MemoryStream(kvp.Value), kvp.Key, ZipCompression.Default, DateTime.Now);
    }
 
    zip = new byte[(int) ms.Length];
    ms.Seek(0, SeekOrigin.Begin);
    ms.Read(zip, 0, (int) ms.Length);
    ms.Dispose();
}
 
return zip;

As you can see, I store the ZipPackage in a MemoryStream. After the "using" code block I return the content of the MemoryStream (ms) back to the client side of my application (the above procedure is called due to an InvokeOperation). On the client side, the returned byte array will be stored under a user specified filename in the local file system. This works really proper, but after opening the stored zip file, I see, that filenames (containing german umlauts like ä, ö, ü) are not well encoded.

For example:
A filename in the database is called "Aufsätze.docx". After storing this file with this filename in the zippackage and save the file on my hard disk, the filename is called "Aufs+ñtze.docx".

I've tried a lot with encoding ... default, utf8, etc. but nothing works.

Do you have an idea, what else I can do or try? If you need more information or code snippets, please let me know it.

Kind regards,
Chris
Kiril Vandov
Telerik team
 answered on 01 Nov 2013
3 answers
212 views
Hi,

i got a question using the ZipLibrary.

We got a .zip file with about 20 files zipped.

Some of the filenames contains german umlauts like ä,ö,ü ....

Now, when using the ziplibrary the filenames which got german umlauts are incorrect.

Here is the function to get the files.

Dim fname As String = System.IO.Path.Combine(System.Configuration.ConfigurationManager.AppSettings("GlobalUploadPath"), Filename)
            Dim fs As New FileStream(fname, FileMode.Open, FileAccess.Read)
 
            Try
 
                Using package = ZipPackage.Open(fs)
 
                    Dim allEntries As List(Of ZipPackageEntry) = package.ZipPackageEntries
                    For Each entry As ZipPackageEntry In allEntries
                        Dim filename As String = System.IO.Path.GetFileNameWithoutExtension(entry.FileNameInZip.ToLower)
 
                  -->> wrong filenames in entry.FileNameInZip
 
                        If tableList.Contains(filename) Then
               ' Reading the Data
                        End If
 
                    Next
 
                End Using


Any hint's ?

thank you

Martin
Telerik team
 answered on 09 Aug 2013
1 answer
151 views
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


Tina Stancheva
Telerik team
 answered on 17 Jul 2013
3 answers
352 views
Does anyone know if the ZipPackage can accept a folder or set of folders and build a valid zip file from them? I haven't seen any examples or documentation on this.
maxscan
Top achievements
Rank 1
 answered on 21 May 2013
5 answers
439 views
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
Vladislav
Telerik team
 answered on 17 Apr 2013
1 answer
207 views
Hello telerik!

Is GZip supported now?
Thanks,
Tim.
Tina Stancheva
Telerik team
 answered on 01 Mar 2013
1 answer
162 views
Hello
is it possible to send a file to the end user without a repsonse.end, that way it would be possible to show a loading panel while the zip is building
Maria Ilieva
Telerik team
 answered on 01 Mar 2013
1 answer
111 views
Hi i need to zip files of 10 gb. How can i do it? (i got an exception)

Marcos
Vladislav
Telerik team
 answered on 04 Feb 2013
1 answer
206 views
Hi, could you help me use the ZipPackage to decompress RAR File, can this be realized?  Thanks!
Vladislav
Telerik team
 answered on 10 Oct 2012
2 answers
150 views
Hello


I'm trying to create a ZIP file from Silverlight with a list of JSON data and compresses well. The problem is to receive it in the server because I have no library Telerik receive the Zip to extract and process the result. The library I am using is IonicZip to receive the result but I get error trying to read the MemoryStream. Is there a library for ASP.net Telerik decompress the ZIP file

Code in Silverlight:
MemoryStream memoryStream = new MemoryStream();
ZipCompression method = ZipCompression.Default;
Telerik.Windows.Zip.ZipOutputStream zipOutputStream = new Telerik.Windows.Zip.ZipOutputStream(memoryStream, method);
StreamWriter writer = new StreamWriter(zipOutputStream);
writer.Write(listSave.ToJSON());
writer.Flush();
ServicesClient context = new ServicesClient();
context.SetZipFileAsync( Convert.ToBase64String(memoryStream.ToArray()));
Code in WCF:
public void SetZipFile(string _parameter)
     {
         if (!string.IsNullOrWhiteSpace(_parameter))
         {
             var info = Convert.FromBase64String(_parameter);
             MemoryStream stream = new MemoryStream(info);
             string dataList = string.Empty;
             MemoryStream output = new MemoryStream();
             StreamReader read = new StreamReader(output);
             using (ZipFile zip = ZipFile.Read(stream))
             {
                 ZipEntry item = zip[0];
                 item.Extract(output);
                 output.Seek(0, SeekOrigin.Begin);
                 dataList = read.ReadToEnd();
             }
         }
     }
Alexander
Top achievements
Rank 2
 answered on 12 Sep 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?