Zip/Unzip stream example

4 posts, 0 answers
  1. Oliver
    Oliver avatar
    263 posts
    Member since:
    Feb 2011

    Posted 22 Nov 2011 Link to this post

    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
  2. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 25 Nov 2011 Link to this post

    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 >>

  3. Oliver
    Oliver avatar
    263 posts
    Member since:
    Feb 2011

    Posted 25 Nov 2011 Link to this post

    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
  4. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 30 Nov 2011 Link to this post

    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 >>

Back to Top