Question : c# unzip

tried using System.IO.Compression.DeflateStream but get the error to uinzip a file
{"Block length does not match with its complement."}

Any ideas?  Alternatively any other methods for unzipping with standard c# libraries - don't really want another 3rd party library
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
public string Unzip(string sourcepath)
        {
            FileStream inputfile = File.OpenRead(sourcepath);
 
            DeflateStream deflatestream = new DeflateStream(inputfile, CompressionMode.Decompress);
            byte[] buffer = new byte[inputfile.Length + 100];
 
            int offset = 0;
            int ct = 0;
 
            while (true)
            { 
                int bytesread = deflatestream.Read(buffer, offset, 100);
                if(bytesread == 0)
                {   
                    break;
                }
 
                offset += bytesread;
                ct += bytesread;
            }
            
            FileStream outputfile = File.Create(Path.ChangeExtension(sourcepath, "xml"));    
            outputfile.Write(buffer, 0, buffer.Length);
            outputfile.Close();
 
            return "Done";
        }

Answer : c# unzip

As I understand it, the Deflate algorithm is not compatible with standard .zip files.
I think this blog explains it:
http://www.chiramattel.com/george/blog/2007/09/09/deflatestream-block-length-does-not-match.html
Random Solutions  
 
programming4us programming4us