Telerik Forums
Telerik Document Processing Forum
13 answers
265 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
183 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
148 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
351 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
292 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
395 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
182 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
1 answer
166 views
How to set password on Saving & opening the zip file.
Viktor Tsvetkov
Telerik team
 answered on 14 Sep 2011
2 answers
315 views
Good day,

      I have a code as follows to compress I just copied it from the documentation:

private string CompressString(string str)
        {
            MemoryStream memoryStream = new MemoryStream();
            ZipCompression method = ZipCompression.Default;
            ZipOutputStream zipOutputStream = new ZipOutputStream(memoryStream, method);
            StreamWriter writer = new StreamWriter(zipOutputStream);
            writer.Write(str);
            writer.Flush();
            return Convert.ToBase64String(memoryStream.ToArray());
        }


  What is missing is to decompress it, I tried the following code but it doesn't give me the correct output

private string UnCompressString(string str)
        {

            MemoryStream memoryStream = new MemoryStream(Convert.FromBase64String(str));
            ZipInputStream input = new ZipInputStream(memoryStream);
            StreamReader reader = new StreamReader(input.BaseStream);
            string strData = reader.ReadToEnd();
            return strData;

        }

  When I tried to call the uncompressstring method, it does not give me the original text.

Thanks
Levi
Top achievements
Rank 1
 answered on 07 Sep 2011
6 answers
298 views
Is there a way to unzip from the ZipPackage? My current routine is incorrect.

Here are my two routines (zip and unzip):
        public static void ZipStream(Stream oInStreamstring sFileNameStream oZipStream)
        {
            ZipPackage oZipPackage = ZipPackage.Create(oZipStream);
            oZipPackage.AddStream(sFileNameoInStream);
        }
 
        public static Stream UnzipStream(Stream oZipStreamint iIndex = 0//this is incorrect; returns zipped stream
        {
            ZipPackage oZipPackage = ZipPackage.Open(oZipStreamFileAccess.Read);
            return oZipPackage.ZipPackageEntries[iIndex].OpenInputStream();
        }
Viktor Tsvetkov
Telerik team
 answered on 09 Aug 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?