如何使用SharpZipLib在gzip中提取或访问特定文件的流?

Paw*_*elZ 2 c# compact-framework

如何使用SharpZipLib从tar.gz(tar文件和文件夹然后gzip)中提取特定文件(或具有流式访问权限)?或者也许在.NET cf 3.5中有人有类似的库吗?

Tho*_*mas 7

using ( FileStream inputStream = File.OpenRead ( aPackage ) )
{
    using ( GzipInputStream gzStream = new GzipInputStream ( inputStream ) )
    {
        using ( TarInputStream tarStream = new TarInputStream ( gzStream ) )
        {
            TarEntry entry = tarStream.GetNextEntry();
            while ( entry != null )
            {
                if ( entry == theOneIWant )
                {
                    tarStream.CopyEntryContents (outputStream );
                    break;
                }
                entry = tarStream.GetNextEntry();
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)