Telerik Forums
Telerik Document Processing Forum
1 answer
143 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
111 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
180 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
162 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
160 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
110 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
3 answers
281 views
Hi,

I'm using the PersistenceManager to persist a RadWindow into a database and I would like to know if
it's possible to compress the resulting stream of the SAVE method before save it into my database?

Can you provide me a small example for both scenario?

Here is the scenario 1:
- Persist a RadWindow using the PersistenceManager
- Compress the resulting stream of the SAVE method
- Save the compressed stream into the database

here is the scenraio 2:
- Load the compressed stream from the database
- Uncompress the loaded stream
- Load the RadWindow uncompressed stream

Thank's
Tina Stancheva
Telerik team
 answered on 30 Nov 2011
5 answers
249 views
I have a Silverlight application that is importing Shape files (.shp) and parsing them as streams.  A shape file usually also include other companion files that have the same file name other than having a different extension (such as .dbf and .prj).  

Because I want to be able to import these file groups directly or from within ZIPs, I wrote some logic to first add all the imported files to a list, then explode any imported zip files' file contents into that same list.  When I pass a ZipInputStream to my parsing logic, I get errors and strange behavior that I don't get when I import the files directly.  Here's the error I usually get:

System.IO.EndOfStreamException: Attempted to read past the end of the stream.

What am I doing wrong?  Why can't I just parse the ZipInputStreams the same way I parse the FileStreams that come from the OpenFileDialog?

NOTE: Sample project is available here.  First try importing the sample data files directly (test.shp, test.dbf, test.prj) by multi-selecting them in the OpenFileDialog.  Then, try importing the ZIP file (test.zip) which contains the exact same three files and see the error.

Thanks,
J. Tower
Falafel Support
Top achievements
Rank 1
 answered on 29 Nov 2011
3 answers
348 views
Hi

I want to be able to upload a zip file to the server (using RadUpload) and then extract the files within it to the server once uploaded.

How do i do this?

Many Thanks
Tracey
Tina Stancheva
Telerik team
 answered on 22 Nov 2011
1 answer
149 views
Hello,

I am having a lot of success with this new addition to the Telerik WPF library, however i cannot see how I can add a directory to the archive?
Thanks,

Xavier.
Tina Stancheva
Telerik team
 answered on 30 Sep 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?