@@ -18,28 +18,22 @@ class GitInstaller : IGitInstaller
18
18
private readonly CancellationToken cancellationToken ;
19
19
private readonly IEnvironment environment ;
20
20
private readonly ILogging logger ;
21
-
22
- private delegate void ExtractZipFile ( string archive , string outFolder , CancellationToken cancellationToken ,
23
- IProgress < float > zipFileProgress = null , IProgress < long > estimatedDurationProgress = null ) ;
24
- private ExtractZipFile extractCallback ;
21
+ private readonly IZipHelper zipHelper ;
25
22
26
23
public GitInstaller ( IEnvironment environment , CancellationToken cancellationToken )
27
- : this ( environment , null , cancellationToken )
24
+ : this ( environment , ZipHelper . Instance , cancellationToken )
28
25
{
29
26
}
30
27
31
- public GitInstaller ( IEnvironment environment , IZipHelper sharpZipLibHelper , CancellationToken cancellationToken )
28
+ public GitInstaller ( IEnvironment environment , IZipHelper zipHelper , CancellationToken cancellationToken )
32
29
{
33
30
Guard . ArgumentNotNull ( environment , nameof ( environment ) ) ;
34
31
35
32
logger = Logging . GetLogger ( GetType ( ) ) ;
36
33
this . cancellationToken = cancellationToken ;
37
34
38
35
this . environment = environment ;
39
- this . extractCallback = sharpZipLibHelper != null
40
- ? ( ExtractZipFile ) sharpZipLibHelper . Extract
41
- : ZipHelper . ExtractZipFile ;
42
-
36
+ this . zipHelper = zipHelper ;
43
37
44
38
GitInstallationPath = environment . GetSpecialFolder ( Environment . SpecialFolder . LocalApplicationData )
45
39
. ToNPath ( ) . Combine ( ApplicationInfo . ApplicationName , PackageNameWithVersion ) ;
@@ -184,7 +178,7 @@ public Task<bool> SetupGitIfNeeded(NPath tempPath, IProgress<float> zipFileProgr
184
178
{
185
179
logger . Trace ( "Extracting \" {0}\" to \" {1}\" " , archiveFilePath , unzipPath ) ;
186
180
187
- extractCallback ( archiveFilePath , unzipPath , cancellationToken , zipFileProgress ,
181
+ zipHelper . Extract ( archiveFilePath , unzipPath , cancellationToken , zipFileProgress ,
188
182
estimatedDurationProgress ) ;
189
183
}
190
184
catch ( Exception ex )
@@ -249,7 +243,7 @@ public Task<bool> SetupGitLfsIfNeeded(NPath tempPath, IProgress<float> zipFilePr
249
243
{
250
244
logger . Trace ( "Extracting \" {0}\" to \" {1}\" " , archiveFilePath , unzipPath ) ;
251
245
252
- extractCallback ( archiveFilePath , unzipPath , cancellationToken , zipFileProgress ,
246
+ zipHelper . Extract ( archiveFilePath , unzipPath , cancellationToken , zipFileProgress ,
253
247
estimatedDurationProgress ) ;
254
248
}
255
249
catch ( Exception ex )
0 commit comments