<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.silverlight.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Programming with .NET - General</title><link>http://forums.silverlight.net/forums/17.aspx</link><description>General discussions around authoring Silverlight .NET applications.</description><dc:language>en</dc:language><generator>CommunityServer 2007 (Build: 20416.853)</generator><item><title>Re: Re: Re: how to compress file!</title><link>http://forums.silverlight.net/forums/thread/240298.aspx</link><pubDate>Wed, 01 Jul 2009 14:56:15 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:240298</guid><dc:creator>SaurabhAgg</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/240298.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=240298</wfw:commentRss><description>&lt;p&gt;I&amp;#39;m not sure if I&amp;#39;m missing on to something, but even this won&amp;#39;t allow me to compress a folder with files&amp;nbsp;that can be read using winzip / winrar (saw this in the comments).&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;</description></item><item><title>Re: Re: how to compress file!</title><link>http://forums.silverlight.net/forums/thread/240277.aspx</link><pubDate>Wed, 01 Jul 2009 14:12:08 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:240277</guid><dc:creator>joji777</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/240277.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=240277</wfw:commentRss><description>&lt;p&gt;ok then try this one, this should help&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.eggheadcafe.com/tutorials/aspnet/d566463d-83bd-486a-8633-53aa54f405bf/silverlight-2-beta-2-doi.aspx"&gt;http://www.eggheadcafe.com/tutorials/aspnet/d566463d-83bd-486a-8633-53aa54f405bf/silverlight-2-beta-2-doi.aspx&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Re: Re: how to compress file!</title><link>http://forums.silverlight.net/forums/thread/240275.aspx</link><pubDate>Wed, 01 Jul 2009 14:00:27 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:240275</guid><dc:creator>SaurabhAgg</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/240275.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=240275</wfw:commentRss><description>&lt;p&gt;Thanks for the quick reply &lt;img src="http://silverlight.net/emoticons/emotion-1.gif" alt="Smile" /&gt;.. actually what I want to do is that I have some folders &amp;amp; files which I want to&amp;nbsp;be packaged in&amp;nbsp;a zip file. Using SharpZipLib, &amp;nbsp;I guess we can just compress a single file, and that too can&amp;#39;t be read using winzip / winrar.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;</description></item><item><title>Re: Re: how to compress file!</title><link>http://forums.silverlight.net/forums/thread/240271.aspx</link><pubDate>Wed, 01 Jul 2009 13:47:28 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:240271</guid><dc:creator>joji777</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/240271.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=240271</wfw:commentRss><description>&lt;p&gt;have a look on this thread, hope it will help&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="http://silverlight.net/forums/t/21392.aspx"&gt;http://silverlight.net/forums/t/21392.aspx&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Re: Re: how to compress file!</title><link>http://forums.silverlight.net/forums/thread/240266.aspx</link><pubDate>Wed, 01 Jul 2009 13:38:52 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:240266</guid><dc:creator>SaurabhAgg</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/240266.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=240266</wfw:commentRss><description>&lt;p&gt;@Mog Liang&lt;/p&gt;
&lt;p&gt;I couldn&amp;#39;t find any ZipOutputStream class&amp;nbsp;for Silverlight, is this from vjslib.dll ?&lt;/p&gt;
&lt;p&gt;If yes, then&amp;nbsp;is there any way we can create a zip of a folder in Silverlight ?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;-Saurabh&lt;/p&gt;</description></item><item><title>Re: how to compress file!</title><link>http://forums.silverlight.net/forums/thread/234999.aspx</link><pubDate>Thu, 18 Jun 2009 12:56:22 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:234999</guid><dc:creator>joji777</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/234999.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=234999</wfw:commentRss><description>&lt;p&gt;in above mentioned code if you add following 2 lines, you will not get exception if you trying to unzip file in java&lt;/p&gt;&lt;font size="2"&gt;zipEntry.CompressionMethod = &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;CompressionMethod&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.Deflated;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;zipEntry.Size = actualfilebufer.Length;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;&lt;/font&gt;</description></item><item><title>Re: how to compress file!</title><link>http://forums.silverlight.net/forums/thread/234983.aspx</link><pubDate>Thu, 18 Jun 2009 12:13:29 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:234983</guid><dc:creator>joji777</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/234983.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=234983</wfw:commentRss><description>&lt;p&gt;one critical issue i am unable to figure out so far is follwoing exception. my requirments are like, I zip a file in silverlight component and later i have to read that file for my java applet. when we try to open file in java following exception occur.&lt;/p&gt;&lt;font face="Tms Rmn"&gt;
&lt;p dir="ltr"&gt;Exception in thread &amp;quot;main&amp;quot; java.util.zip.ZipException: invalid entry size (expected 4294967295 but got 8628524 bytes)&lt;/p&gt;
&lt;p dir="ltr"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at java.util.zip.ZipInputStream.readEnd(ZipInputStream.java:373)&lt;/p&gt;
&lt;p dir="ltr"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at java.util.zip.ZipInputStream.read(ZipInputStream.java:141)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:105)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;why header is incorrect ??&lt;/p&gt;&lt;/font&gt;</description></item><item><title>Re: how to compress file!</title><link>http://forums.silverlight.net/forums/thread/234808.aspx</link><pubDate>Thu, 18 Jun 2009 02:33:16 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:234808</guid><dc:creator>ksleung</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/234808.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=234808</wfw:commentRss><description>That&amp;#39;s way too long to zip.&amp;nbsp; Perhaps you wanna look at ZipForge which is another zip package.&amp;nbsp; I have no issue with it.&amp;nbsp; Perhaps more efficient than SharpZipLib?&lt;br /&gt;</description></item><item><title>Re: how to compress file!</title><link>http://forums.silverlight.net/forums/thread/234806.aspx</link><pubDate>Thu, 18 Jun 2009 02:29:45 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:234806</guid><dc:creator>Mog Liang - MSFT</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/234806.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=234806</wfw:commentRss><description>&lt;p&gt;my code, compress&amp;nbsp;6MB wma file spend 2 seconds&lt;pre class="coloredcode"&gt;    &lt;span class="kwd"&gt;private&lt;/span&gt; MemoryStream CompressFile(FileInfo inputfile)
    {
        FileStream inputstream = inputfile.OpenRead();
        MemoryStream stream1 = &lt;span class="kwd"&gt;new&lt;/span&gt; MemoryStream();
        ZipOutputStream stream2 = &lt;span class="kwd"&gt;new&lt;/span&gt; ZipOutputStream(stream1);

        &lt;span class="cmt"&gt;//read file&lt;/span&gt;
        &lt;span class="kwd"&gt;byte&lt;/span&gt;[] buffer1 = &lt;span class="kwd"&gt;new byte&lt;/span&gt;[(&lt;span class="kwd"&gt;int&lt;/span&gt;)inputstream.Length];
        inputstream.Read(buffer1, 0, (&lt;span class="kwd"&gt;int&lt;/span&gt;) inputstream.Length);
        inputstream.Close();
        inputstream.Dispose();

        &lt;span class="cmt"&gt;//compress&lt;/span&gt;
        ZipEntry entry = &lt;span class="kwd"&gt;new&lt;/span&gt; ZipEntry(inputfile.Name);
        stream2.PutNextEntry(entry);
        stream2.Write(buffer1, 0, buffer1.Length);
        stream2.CloseEntry();
        stream1.Flush();
       
        &lt;span class="kwd"&gt;return&lt;/span&gt; stream1;
    }&lt;/pre&gt;&amp;nbsp;</description></item><item><title>Re: how to compress file!</title><link>http://forums.silverlight.net/forums/thread/234516.aspx</link><pubDate>Wed, 17 Jun 2009 13:11:52 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:234516</guid><dc:creator>joji777</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/234516.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=234516</wfw:commentRss><description>&lt;p&gt;many thanks for code samples and guidance, I just tried it with memory stream and it still takes same amount of time to zip. May be i am doing something wrong, can you please update your snippet doing it with memory stream, that will makes me clear if i am suing memory stream in right way or not.&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;</description></item><item><title>Re: how to compress file!</title><link>http://forums.silverlight.net/forums/thread/234375.aspx</link><pubDate>Wed, 17 Jun 2009 07:49:40 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:234375</guid><dc:creator>ksleung</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/234375.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=234375</wfw:commentRss><description>&lt;p&gt;Is this code built on SL2 or SL3?&amp;nbsp; A while ago I reported an IsolatedStorage write performance bug, and it was mentioned that this will be fixed in SL3, although I haven&amp;#39;t tested it as I dealt with it using the &amp;quot;workaround&amp;quot; already.&amp;nbsp; The zip package may very well exercise the same performance problem.&lt;/p&gt;&lt;p&gt;See this thread &lt;a href="http://silverlight.net/forums/p/75315/180892.aspx" title="http://silverlight.net/forums/p/75315/180892.aspx"&gt;http://silverlight.net/forums/p/75315/180892.aspx&lt;/a&gt; &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: how to compress file!</title><link>http://forums.silverlight.net/forums/thread/234345.aspx</link><pubDate>Wed, 17 Jun 2009 06:37:47 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:234345</guid><dc:creator>Mog Liang - MSFT</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/234345.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=234345</wfw:commentRss><description>&lt;p&gt;For 1st question, based on my test,&amp;nbsp;&amp;nbsp;write isolatedstorage file cost up to 90% time, compress and decompress only cost about 7% time, so if you&amp;nbsp;use memorystream instead of isolatedstoragefilestream, the process will speed up 10 times&lt;/p&gt;
&lt;p&gt;For second question, try use &lt;a href="http://msdn.microsoft.com/en-us/library/cc221403(VS.95).aspx"&gt;BackgroundWorker&lt;/a&gt; to run compression on other thread.&lt;/p&gt;
&lt;p&gt;my code.&amp;nbsp;&amp;nbsp;&lt;pre class="coloredcode"&gt;        FileInfo _fileinfo;
        &lt;span class="kwd"&gt;private void&lt;/span&gt; Button_Click(&lt;span class="kwd"&gt;object&lt;/span&gt; sender, RoutedEventArgs e)
        {
            var ofd1 = &lt;span class="kwd"&gt;new&lt;/span&gt; OpenFileDialog();
            var result = ofd1.ShowDialog();
            &lt;span class="kwd"&gt;if&lt;/span&gt; (result.HasValue &amp;amp;&amp;amp; result.Value)
            {
                tb1.Text = &lt;span class="st"&gt;&amp;quot;Compressing...&amp;quot;&lt;/span&gt;;
                _fileinfo = ofd1.File;

                BackgroundWorker bw = &lt;span class="kwd"&gt;new&lt;/span&gt; BackgroundWorker();
                bw.DoWork += &lt;span class="kwd"&gt;new&lt;/span&gt; DoWorkEventHandler(bw_DoWork);
                bw.RunWorkerCompleted += &lt;span class="kwd"&gt;new&lt;/span&gt; RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);
                bw.RunWorkerAsync();
            }
        }

        &lt;span class="kwd"&gt;void&lt;/span&gt; bw_RunWorkerCompleted(&lt;span class="kwd"&gt;object&lt;/span&gt; sender, RunWorkerCompletedEventArgs e)
        {
            &lt;span class="cmt"&gt;//tb1.Text = &amp;quot;Compression complete.&amp;quot;;&lt;/span&gt;
        }

        &lt;span class="kwd"&gt;void&lt;/span&gt; bw_DoWork(&lt;span class="kwd"&gt;object&lt;/span&gt; sender, DoWorkEventArgs e)
        {
            DateTime starttime = DateTime.Now;
            &lt;span class="kwd"&gt;string&lt;/span&gt; timestring=&lt;span class="st"&gt;&amp;quot;&amp;quot;&lt;/span&gt;;

            &lt;span class="cmt"&gt;//read file to byte[]&lt;/span&gt;
            Stream fileStream = _fileinfo.OpenRead();
            var filebuffer = &lt;span class="kwd"&gt;new byte&lt;/span&gt;[(&lt;span class="kwd"&gt;int&lt;/span&gt;)fileStream.Length];
            fileStream.Read(filebuffer, 0, (&lt;span class="kwd"&gt;int&lt;/span&gt;)fileStream.Length);
            fileStream.Close();
            fileStream.Dispose();

            timestring += &lt;span class="st"&gt;&amp;quot;read file stream: &amp;quot;&lt;/span&gt; + (DateTime.Now - starttime).TotalMilliseconds;
            starttime = DateTime.Now;

            &lt;span class="cmt"&gt;//create isolatedstorage file&lt;/span&gt;
            var isolatedStorageFile = IsolatedStorageFile.GetUserStoreForApplication();
            var filestream2 = isolatedStorageFile.CreateFile(_fileinfo.Name + &lt;span class="st"&gt;&amp;quot;.zip&amp;quot;&lt;/span&gt;);

            timestring += &lt;span class="st"&gt;&amp;quot;\ncreate isolatedstorage file: &amp;quot;&lt;/span&gt; + (DateTime.Now - starttime).TotalMilliseconds;
            starttime = DateTime.Now;

            &lt;span class="cmt"&gt;//zip&lt;/span&gt;
            var zs = &lt;span class="kwd"&gt;new&lt;/span&gt; ZipOutputStream(filestream2);
            var entry = &lt;span class="kwd"&gt;new&lt;/span&gt; ZipEntry(_fileinfo.Name);
            zs.PutNextEntry(entry);
            zs.Write(filebuffer, 0, filebuffer.Length);
            zs.CloseEntry();
            zs.Close();
            filestream2.Close();
            filestream2.Dispose();

            timestring += &lt;span class="st"&gt;&amp;quot;\nzip and write isolatedstoreage file: &amp;quot;&lt;/span&gt; + (DateTime.Now - starttime).TotalMilliseconds;
            starttime = DateTime.Now;

            &lt;span class="cmt"&gt;//get isolatedstorage file&lt;/span&gt;
            var filestream3 = isolatedStorageFile.OpenFile(_fileinfo.Name + &lt;span class="st"&gt;&amp;quot;.zip&amp;quot;&lt;/span&gt;, FileMode.Open);

            &lt;span class="cmt"&gt;//unzip&lt;/span&gt;
            &lt;span class="kwd"&gt;byte&lt;/span&gt;[] buff1 = &lt;span class="kwd"&gt;new byte&lt;/span&gt;[1024];
            var memstream1 = &lt;span class="kwd"&gt;new&lt;/span&gt; MemoryStream();
            var zis = &lt;span class="kwd"&gt;new&lt;/span&gt; ZipInputStream(filestream3);
            zis.GetNextEntry();
            &lt;span class="kwd"&gt;int&lt;/span&gt; readlength = 0;
            &lt;span class="kwd"&gt;while&lt;/span&gt; (&lt;span class="kwd"&gt;true&lt;/span&gt;)
            {
                readlength = zis.Read(buff1, 0, buff1.Length);
                memstream1.Write(buff1, 0, readlength);
                &lt;span class="kwd"&gt;if&lt;/span&gt; (readlength &amp;lt;= 0)
                    &lt;span class="kwd"&gt;break&lt;/span&gt;;
            }

            timestring += &lt;span class="st"&gt;&amp;quot;\nunzip file: &amp;quot;&lt;/span&gt; + (DateTime.Now - starttime).TotalMilliseconds;
            starttime = DateTime.Now;

            &lt;span class="cmt"&gt;//display.
            //use Dispather switch to UI thread.&lt;/span&gt;
            Dispatcher.BeginInvoke(&lt;span class="kwd"&gt;delegate&lt;/span&gt;
            {
                var bitmap1 = &lt;span class="kwd"&gt;new&lt;/span&gt; BitmapImage();
                bitmap1.SetSource(memstream1);
                img1.Source = bitmap1;
                tb1.Text = timestring;
            });
        }&amp;nbsp; &lt;/pre&gt;
&lt;p&gt;For 3rd question, you can&amp;nbsp;use MemoryStream.&lt;/p&gt;</description></item><item><title>Re: how to compress file!</title><link>http://forums.silverlight.net/forums/thread/234315.aspx</link><pubDate>Wed, 17 Jun 2009 04:25:58 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:234315</guid><dc:creator>joji777</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/234315.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=234315</wfw:commentRss><description>&lt;p&gt;Hi Mog Liang,&lt;/p&gt;
&lt;p&gt;Thanks for sharing the code, yes it works. However I found following issues, can you please help me out for these issues as well:&lt;/p&gt;
&lt;p&gt;1) I used your given code and it took 2 minutes 25 seconds to compress an audio file size 8.22 Mb, only addition in my code was I set zipoutputstream.SetLevel(9) , I wanted to make maximum compressed file.&lt;/p&gt;
&lt;p&gt;2) In silvelright after user select a file in open file dilaouge it keep the dilaouge showing while compression routine is running, it shows kind of stuck, how can I update the look and give message to user &amp;quot;compressing....&amp;quot; i tried but as soon compression code starts it stucks until compression is done.&lt;/p&gt;
&lt;p&gt;3) is there anyway to get a compressed stream in byte array, wihtout reading it again from stored place ?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Regards&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: how to compress file!</title><link>http://forums.silverlight.net/forums/thread/234300.aspx</link><pubDate>Wed, 17 Jun 2009 03:49:02 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:234300</guid><dc:creator>Mog Liang - MSFT</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/234300.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=234300</wfw:commentRss><description>&lt;p&gt;You need create ZipEntry for each file in zip file.&lt;/p&gt;
&lt;p&gt;I wrote a sample to test compress and decompress image, then display.&lt;/p&gt;&lt;pre class="coloredcode"&gt;        &lt;span class="kwd"&gt;private void&lt;/span&gt; Button_Click(&lt;span class="kwd"&gt;object&lt;/span&gt; sender, RoutedEventArgs e)
        {
            var ofd1 = &lt;span class="kwd"&gt;new&lt;/span&gt; OpenFileDialog();
            var result = ofd1.ShowDialog();
            &lt;span class="kwd"&gt;if&lt;/span&gt; (result.HasValue &amp;amp;&amp;amp; result.Value)
            {
                &lt;span class="cmt"&gt;//read file to byte[]&lt;/span&gt;
                Stream fileStream = ofd1.File.OpenRead();
                var filebuffer = &lt;span class="kwd"&gt;new byte&lt;/span&gt;[(&lt;span class="kwd"&gt;int&lt;/span&gt;)fileStream.Length];
                fileStream.Read(filebuffer, 0, (&lt;span class="kwd"&gt;int&lt;/span&gt;)fileStream.Length);
                fileStream.Close();
                fileStream.Dispose();

                &lt;span class="cmt"&gt;//create isolatedstorage file&lt;/span&gt;
                var isolatedStorageFile = IsolatedStorageFile.GetUserStoreForApplication();
                var filestream2 = isolatedStorageFile.CreateFile(ofd1.File.Name+&lt;span class="st"&gt;&amp;quot;.zip&amp;quot;&lt;/span&gt;);

                &lt;span class="cmt"&gt;//zip&lt;/span&gt;
                var zs = &lt;span class="kwd"&gt;new&lt;/span&gt; ZipOutputStream(filestream2);
                var entry = &lt;span class="kwd"&gt;new&lt;/span&gt; ZipEntry(ofd1.File.Name);
                zs.PutNextEntry(entry);
                zs.Write(filebuffer, 0, filebuffer.Length);
                zs.CloseEntry();
                zs.Close();
                filestream2.Close();
                filestream2.Dispose();

                &lt;span class="cmt"&gt;//get isolatedstorage file&lt;/span&gt;
                var filestream3 = isolatedStorageFile.OpenFile(ofd1.File.Name + &lt;span class="st"&gt;&amp;quot;.zip&amp;quot;&lt;/span&gt;, FileMode.Open);
                
                &lt;span class="cmt"&gt;//unzip&lt;/span&gt;
                &lt;span class="kwd"&gt;byte&lt;/span&gt;[] buff1 = &lt;span class="kwd"&gt;new byte&lt;/span&gt;[1024];
                var memstream1 = &lt;span class="kwd"&gt;new&lt;/span&gt; MemoryStream();
                var zis = &lt;span class="kwd"&gt;new&lt;/span&gt; ZipInputStream(filestream3);
                zis.GetNextEntry();
                &lt;span class="kwd"&gt;int&lt;/span&gt; readlength=0;
                &lt;span class="kwd"&gt;while&lt;/span&gt; (&lt;span class="kwd"&gt;true&lt;/span&gt;)
                {
                    readlength = zis.Read(buff1, 0, buff1.Length);
                    memstream1.Write(buff1, 0, readlength);
                    &lt;span class="kwd"&gt;if&lt;/span&gt; (readlength &amp;lt;= 0)
                        &lt;span class="kwd"&gt;break&lt;/span&gt;;
                }

                &lt;span class="cmt"&gt;//display&lt;/span&gt;
                var bitmap1 = &lt;span class="kwd"&gt;new&lt;/span&gt; BitmapImage();
                bitmap1.SetSource(memstream1);
                img1.Source = bitmap1;
            }
        }&lt;/pre&gt;&amp;nbsp;</description></item><item><title>Re: how to compress file!</title><link>http://forums.silverlight.net/forums/thread/233453.aspx</link><pubDate>Mon, 15 Jun 2009 13:37:05 GMT</pubDate><guid isPermaLink="false">d0d632c8-a6f7-4f68-b0ce-26aaafd62132:233453</guid><dc:creator>joji777</dc:creator><slash:comments>0</slash:comments><comments>http://forums.silverlight.net/forums/thread/233453.aspx</comments><wfw:commentRss>http://forums.silverlight.net/forums/commentrss.aspx?SectionID=17&amp;PostID=233453</wfw:commentRss><description>&lt;p&gt;i tried with memory stream and i sitll see the same error. Can anyone please help me to figure out why sharp zip lib raising this error &amp;quot;No open entry.&amp;quot;.&lt;/p&gt;</description></item></channel></rss>