Telerik Forums
Telerik Document Processing Forum
5 answers
414 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
195 views
Hello telerik!

Is GZip supported now?
Thanks,
Tim.
Tina Stancheva
Telerik team
 answered on 01 Mar 2013
1 answer
147 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
102 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
176 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
136 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
2 answers
214 views
Hello,

I am trying the ZIP control for silverlight, but i keep having an issue.
I am trying to Compress and Uncompress a stream which is getting read from a WAV file.
the issue is that the size of the stream before compression and after decompression is different. this causes the uncomressed stream to be invalid and therefore not to be played by the basic media element of silverlight.

I am attaching a sample of code to demonstrate the zip and unzip methods that i use.

string wavFilePath = @"C:\1\cheer.wav";
string wavFileNewPath = @"C:\1\cheerNew.wav";
string zipFilePath = @"c:\1\123.zip";
 
private void btnCompress(object sender, RoutedEventArgs e)
{
    FileStream fs = new FileStream(wavFilePath, FileMode.Open);
    SizeBefore.Text = fs.Length.ToString();
    using (ZipPackage zipFile = ZipPackage.CreateFile(zipFilePath))
    {
         zipFile.AddStream(fs, "cheer.wav", ZipCompression.Default, DateTime.Now);
         zipFile.Close(true);
     }       
}
 
private void btnUncompress(object sender, RoutedEventArgs e)
{
     using (ZipPackage zipFile = ZipPackage.OpenFile(zipFilePath, FileAccess.Read))
     {
         ZipPackageEntry zipEntry = zipFile.ZipPackageEntries[0];
         Stream strm = zipEntry.OpenInputStream();
         byte[] Bytes = new byte[strm.Length];
         strm.Read(Bytes, 0, (int)strm.Length);
         using (FileStream fs = new FileStream(wavFileNewPath, FileMode.Create))
         {
              fs.Write(Bytes, 0, Bytes.Length);
              fs.Close();               
         }
    }
 }

I wanted to also note that I did encounter the decompress example which is online here. but it does not help me since dealing with string will not give me the expected result.

Thank you in advance for nay help about this...

kob490.
Koby
Top achievements
Rank 1
 answered on 13 Jun 2012
13 answers
247 views
I am compressing a string on the client (and can uncompress it on the client). Thus, I know it is working.

However, what is the appropriate technical for uncompressing the string once its been sent over to the server?
 
I am using WCF web services.

I've added a reference to Telerik.Windows.Zip but the DLL throws an error when I attempt to create the object:

 

 

 

 

 

Dim inputStream As New ZipInputStream(memStream)

Can the DLL not be used on the server side? If not, how do I uncompress the data?

-Dave

Luc
Top achievements
Rank 1
 answered on 05 Apr 2012
3 answers
181 views
Hello,
I was wondering if I can use ZipLibrary to compress WCF data transfer instead of radcompression,I've found no talks about that nor example...is it possible?

Thanks
Tina Stancheva
Telerik team
 answered on 06 Mar 2012
2 answers
138 views

Hi there,

I've got a small application and now stuck in the task "Appending Files in Zip".

As far as it looks the ZipPackage only allow to Read or Write. Not both.

The Codeblock with the routine

ZipPackage zipPackage;
  
if (File.Exists(appPath + @"\" + currentMonthZip))
{
    Stream stream = File.OpenRead(appPath + @"\" + currentMonthZip);
    zipPackage = ZipPackage.Open(stream, FileAccess.ReadWrite);
}
else
{
    Stream stream = File.Create(appPath + @"\" + currentMonthZip);
    zipPackage = ZipPackage.Create(stream);
}
  
foreach (string folderName in logFoldernames)
{
    string[] listLogs = Directory.GetFiles(appPath + @"\" + folderName);
    foreach (string listLogName in listLogs)
    {
        zipPackage.Add(listLogName, folderName + @"\" + Path.GetFileName(listLogName));
    }
  
    Directory.Delete(appPath + @"\" + folderName);
}

I'm aware that maybe the problem lays here but change the FileAccess or FileMOde ends in exceptions (Stream not for Read/Write)

Stream stream = File.OpenRead(appPath + @"\" + currentMonthZip); 
zipPackage = ZipPackage.Open(stream, FileAccess.ReadWrite);

So what's the suggested approach to open an existing Zip and just attach some new Files in it?

Do I really have to create a temporary zip with old and new content and afterwards delete the old zip and rename the new to the proper name? 

Thanks for any help.

Adrian
Top achievements
Rank 1
 answered on 10 Jan 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?