1- using  System ; 
1+ using  ICSharpCode . SharpZipLib . GZip ; 
2+ using  System ; 
23using  System . Diagnostics ; 
34using  System . IO ; 
45using  System . IO . Compression ; 
56using  System . Net ; 
67using  System . Runtime . InteropServices ; 
8+ using  ICSharpCode . SharpZipLib . Tar ; 
79using  WebDriverManager . Helpers ; 
810
911namespace  WebDriverManager . Services . Impl 
@@ -21,10 +23,14 @@ public string SetupBinary(string url, string zipDestination, string binDestinati
2123            { 
2224                File . Copy ( zipDestination ,  binDestination ) ; 
2325            } 
24-             else 
26+             else   if   ( zipDestination . EndsWith ( ".zip" ,   StringComparison . OrdinalIgnoreCase ) ) 
2527            { 
2628                UnZip ( zipDestination ,  binDestination ,  binaryName ) ; 
2729            } 
30+             else  if  ( zipDestination . EndsWith ( ".tar.gz" ,  StringComparison . OrdinalIgnoreCase ) ) 
31+             { 
32+                 UnZipTgz ( zipDestination ,  binDestination ) ; 
33+             } 
2834
2935            if  ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux )  || 
3036                RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ) 
@@ -71,6 +77,21 @@ protected string UnZip(string path, string destination, string name)
7177            return  destination ; 
7278        } 
7379
80+         protected  void  UnZipTgz ( string  gzArchiveName ,  string  destination ) 
81+         { 
82+             using  ( var  inStream  =  File . OpenRead ( gzArchiveName ) ) 
83+             { 
84+                 using  ( var  gzipStream  =  new  GZipInputStream ( inStream ) ) 
85+                 { 
86+                     var  destFolder  =  Path . GetDirectoryName ( destination ) ; 
87+                     using  ( var  tarArchive  =  TarArchive . CreateInputTarArchive ( gzipStream ) ) 
88+                     { 
89+                         tarArchive . ExtractContents ( destFolder ) ; 
90+                     } 
91+                 } 
92+             } 
93+         } 
94+ 
7495        protected  void  RemoveZip ( string  path ) 
7596        { 
7697            File . Delete ( path ) ; 
0 commit comments