title: Unzipping a File in vb.net
body: <p>I have an embedded resource in my .exe that is a zip file, I would like to move it out of the resources and unzip it to a specific folder.</p>
  
  <pre><code>Private Sub btnNext_Click(sender As Object, e As EventArgs) Handles btn_Install.Click
      Dim Dir_File As String = "C:\FTB"
      Dim Dir_Temp As String = "C:\Temp\Unleashed.zip"
  
      System.IO.File.WriteAllBytes(Dir_Temp, My.Resources.Unleashed)
  
      Dim directorySelected As DirectoryInfo = New DirectoryInfo(Dir_Temp)
  
  End Sub
  </code></pre>
  
  <p>But I have no way of extracting the the .zip file to a directory. So all I need now is a way to actual extract the .zip.</p>
  
  <p>I tried this:</p>
  
  <pre><code>Dim directorySelected As DirectoryInfo = New DirectoryInfo(Dir_Temp)
      For Each fileToDecompress As FileInfo In directorySelected.GetFiles("Unleashed.zip")
          Using OriginalFileStream As FileStream = fileToDecompress.OpenRead()
              Using decompressedFileStream As FileStream = File.Create(Dir_File &amp; "\Unleashed")
                  Using decompressionStream As GZipStream = New GZipStream(OriginalFileStream, CompressionMode.Decompress)
                      decompressionStream.CopyTo(decompressedFileStream)
                  End Using
              End Using
          End Using
      Next
  </code></pre>
  
  <p>But all that did was give me an error about a magic number.
  Any help is very much appreciated.</p>