File tree Expand file tree Collapse file tree 1 file changed +15
-13
lines changed Expand file tree Collapse file tree 1 file changed +15
-13
lines changed Original file line number Diff line number Diff line change @@ -144,17 +144,7 @@ protected async System.Threading.Tasks.Task<ExitCodes> DownloadAndExtractAsync()
144144 . ToList ( ) ;
145145 }
146146
147- if ( fwFiles . Any ( ) )
148- {
149- // get file creation date (from the 1st one)
150- if ( ( DateTime . UtcNow - File . GetLastWriteTimeUtc ( fwFiles . First ( ) . FullName ) ) . TotalHours < 4 )
151- {
152- // fw package has less than 4 hours
153- // skip download
154- skipDownload = true ;
155- }
156- }
157-
147+
158148 if ( ! skipDownload )
159149 {
160150 // try to perform request
@@ -321,8 +311,20 @@ protected async System.Threading.Tasks.Task<ExitCodes> DownloadAndExtractAsync()
321311
322312 if ( fwFiles . Any ( ) )
323313 {
324- // take the 1st one
325- fwFileName = fwFiles . First ( ) . FullName ;
314+ if ( string . IsNullOrEmpty ( _fwVersion ) )
315+ { // take the 1st one
316+ fwFileName = fwFiles . First ( ) . FullName ;
317+ }
318+ else
319+ {
320+ string targetFileName = $ "{ _targetName } -{ _fwVersion } .zip";
321+ fwFileName = fwFiles . Where ( w => w . Name == targetFileName ) . Select ( s => s . FullName ) . FirstOrDefault ( ) ;
322+ }
323+
324+ if ( string . IsNullOrEmpty ( fwFileName ) )
325+ {
326+ return ExitCodes . E9007 ;
327+ }
326328
327329 // get the version form the file name
328330 var pattern = @"(\d+\.\d+\.\d+)(\.\d+|-.+)(?=\.zip)" ;
You can’t perform that action at this time.
0 commit comments