This is a migrated thread and some comments may be shown as answers.

Zip/Unzip stream example

3 Answers 220 Views
ZipLibrary
This is a migrated thread and some comments may be shown as answers.
Oliver
Top achievements
Rank 1
Oliver asked on 22 Nov 2011, 08:55 PM
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

3 Answers, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 25 Nov 2011, 05:29 PM
Hello Oliver,

I attached a sample solution and I hope it will get you started on your task. Please let us know if it helps.

Greetings,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Oliver
Top achievements
Rank 1
answered on 25 Nov 2011, 07:49 PM
Hi Tina,

this is a good start but when I'm trying to compile, I have the following 3 errors:

Error 1 The name 'InitializeComponent' does not exist in the current context D:\xxx\PersistInStreamAndZip\WpfApplication1\MainWindow.xaml.cs 28 4 WpfApplication1

Error 2 'System.IO.Stream' does not contain a definition for 'CopyTo' and no extension method 'CopyTo' accepting a first argument of type 'System.IO.Stream' could be found (are you missing a using directive or an assembly reference?) D:\xxx\PersistInStreamAndZip\WpfApplication1\MainWindow.xaml.cs 48 51 WpfApplication1

Error 3 The name 'InitializeComponent' does not exist in the current context D:\xxx\PersistInStreamAndZip\WpfApplication1\MyWindow.xaml.cs 13 4 WpfApplication1

I'm with VS2008 and I'm on .Net 3.5

Thank's
0
Tina Stancheva
Telerik team
answered on 30 Nov 2011, 04:22 PM
Hi Oliver,

I updated the solution to use .Net 3.5 and to run in VS2008. However in .Net 3.5 the System.IO.Stream.CopyTo() method isn't supported so you'll need to manually read the stream byte by byte and write the bytes in another stream.

Please have a look at the solution and let me know if it works on your side.

All the best,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
ZipLibrary
Asked by
Oliver
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Oliver
Top achievements
Rank 1
Share this question
or