@@ -251,7 +251,7 @@ public async Task BootstrapAsync (string targetPath, IProgress<SdkBootstrapProgr
251251 } )
252252 . FirstOrDefault ( ) ;
253253
254- if ( cmdlineTools == null || string . IsNullOrEmpty ( cmdlineTools . DownloadUrl ) ) {
254+ if ( cmdlineTools is null || string . IsNullOrEmpty ( cmdlineTools . DownloadUrl ) ) {
255255 throw new InvalidOperationException ( "Could not find command-line tools in the Android manifest feed." ) ;
256256 }
257257
@@ -454,7 +454,7 @@ public async Task BootstrapAsync (string targetPath, IProgress<SdkBootstrapProgr
454454 public async Task < ( IReadOnlyList < SdkPackage > Installed , IReadOnlyList < SdkPackage > Available ) > ListAsync ( CancellationToken cancellationToken = default )
455455 {
456456 var sdkManagerPath = FindSdkManagerPath ( ) ;
457- if ( sdkManagerPath == null )
457+ if ( sdkManagerPath is null )
458458 throw new InvalidOperationException ( "sdkmanager not found. Run BootstrapAsync first to install command-line tools." ) ;
459459
460460 logger ( TraceLevel . Info , "Running sdkmanager --list..." ) ;
@@ -476,11 +476,11 @@ public async Task BootstrapAsync (string targetPath, IProgress<SdkBootstrapProgr
476476 /// <param name="cancellationToken">Cancellation token.</param>
477477 public async Task InstallAsync ( IEnumerable < string > packages , bool acceptLicenses = true , CancellationToken cancellationToken = default )
478478 {
479- if ( packages == null || ! packages . Any ( ) )
479+ if ( packages is null || ! packages . Any ( ) )
480480 throw new ArgumentException ( "At least one package must be specified." , nameof ( packages ) ) ;
481481
482482 var sdkManagerPath = FindSdkManagerPath ( ) ;
483- if ( sdkManagerPath == null )
483+ if ( sdkManagerPath is null )
484484 throw new InvalidOperationException ( "sdkmanager not found. Run BootstrapAsync first." ) ;
485485
486486 var packageList = string . Join ( " " , packages . Select ( p => $ "\" { p } \" ") ) ;
@@ -504,11 +504,11 @@ public async Task InstallAsync (IEnumerable<string> packages, bool acceptLicense
504504 /// <param name="cancellationToken">Cancellation token.</param>
505505 public async Task UninstallAsync ( IEnumerable < string > packages , CancellationToken cancellationToken = default )
506506 {
507- if ( packages == null || ! packages . Any ( ) )
507+ if ( packages is null || ! packages . Any ( ) )
508508 throw new ArgumentException ( "At least one package must be specified." , nameof ( packages ) ) ;
509509
510510 var sdkManagerPath = FindSdkManagerPath ( ) ;
511- if ( sdkManagerPath == null )
511+ if ( sdkManagerPath is null )
512512 throw new InvalidOperationException ( "sdkmanager not found. Run BootstrapAsync first." ) ;
513513
514514 var packageList = string . Join ( " " , packages . Select ( p => $ "\" { p } \" ") ) ;
@@ -532,7 +532,7 @@ public async Task UninstallAsync (IEnumerable<string> packages, CancellationToke
532532 public async Task UpdateAsync ( CancellationToken cancellationToken = default )
533533 {
534534 var sdkManagerPath = FindSdkManagerPath ( ) ;
535- if ( sdkManagerPath == null )
535+ if ( sdkManagerPath is null )
536536 throw new InvalidOperationException ( "sdkmanager not found. Run BootstrapAsync first." ) ;
537537
538538 logger ( TraceLevel . Info , "Updating all installed packages..." ) ;
@@ -554,7 +554,7 @@ public async Task UpdateAsync (CancellationToken cancellationToken = default)
554554 public async Task AcceptLicensesAsync ( CancellationToken cancellationToken = default )
555555 {
556556 var sdkManagerPath = FindSdkManagerPath ( ) ;
557- if ( sdkManagerPath == null )
557+ if ( sdkManagerPath is null )
558558 throw new InvalidOperationException ( "sdkmanager not found. Run BootstrapAsync first." ) ;
559559
560560 logger ( TraceLevel . Info , "Accepting SDK licenses..." ) ;
@@ -574,7 +574,7 @@ public async Task AcceptLicensesAsync (CancellationToken cancellationToken = def
574574 public async Task < IReadOnlyList < SdkLicense > > GetPendingLicensesAsync ( CancellationToken cancellationToken = default )
575575 {
576576 var sdkManagerPath = FindSdkManagerPath ( ) ;
577- if ( sdkManagerPath == null )
577+ if ( sdkManagerPath is null )
578578 throw new InvalidOperationException ( "sdkmanager not found. Run BootstrapAsync first." ) ;
579579
580580 logger ( TraceLevel . Verbose , "Checking for pending licenses..." ) ;
@@ -632,11 +632,11 @@ public async Task<IReadOnlyList<SdkLicense>> GetPendingLicensesAsync (Cancellati
632632 /// <param name="cancellationToken">Cancellation token.</param>
633633 public async Task AcceptLicensesAsync ( IEnumerable < string > licenseIds , CancellationToken cancellationToken = default )
634634 {
635- if ( licenseIds == null || ! licenseIds . Any ( ) )
635+ if ( licenseIds is null || ! licenseIds . Any ( ) )
636636 return ;
637637
638638 var sdkManagerPath = FindSdkManagerPath ( ) ;
639- if ( sdkManagerPath == null )
639+ if ( sdkManagerPath is null )
640640 throw new InvalidOperationException ( "sdkmanager not found. Run BootstrapAsync first." ) ;
641641
642642 // Accept licenses by writing the hash to the licenses directory
@@ -676,7 +676,7 @@ internal static IReadOnlyList<SdkLicense> ParseLicenseOutput (string output)
676676 // License header: "License android-sdk-license:"
677677 if ( line . StartsWith ( "License " , StringComparison . OrdinalIgnoreCase ) && line . TrimEnd ( ) . EndsWith ( ":" ) ) {
678678 // Save previous license if any
679- if ( currentLicenseId != null && currentLicenseText . Length > 0 ) {
679+ if ( currentLicenseId is not null && currentLicenseText . Length > 0 ) {
680680 licenses . Add ( new SdkLicense {
681681 Id = currentLicenseId ,
682682 Text = currentLicenseText . ToString ( ) . Trim ( )
@@ -692,7 +692,7 @@ internal static IReadOnlyList<SdkLicense> ParseLicenseOutput (string output)
692692
693693 // End of license text when we see the accept prompt
694694 if ( line . Contains ( "Accept?" ) || line . Contains ( "(y/N)" ) ) {
695- if ( currentLicenseId != null && currentLicenseText . Length > 0 ) {
695+ if ( currentLicenseId is not null && currentLicenseText . Length > 0 ) {
696696 licenses . Add ( new SdkLicense {
697697 Id = currentLicenseId ,
698698 Text = currentLicenseText . ToString ( ) . Trim ( )
@@ -705,7 +705,7 @@ internal static IReadOnlyList<SdkLicense> ParseLicenseOutput (string output)
705705 }
706706
707707 // Accumulate license text
708- if ( inLicenseText && currentLicenseId != null ) {
708+ if ( inLicenseText && currentLicenseId is not null ) {
709709 // Skip separator lines
710710 if ( ! line . TrimStart ( ) . StartsWith ( "-------" , StringComparison . Ordinal ) ) {
711711 currentLicenseText . AppendLine ( line ) ;
@@ -714,7 +714,7 @@ internal static IReadOnlyList<SdkLicense> ParseLicenseOutput (string output)
714714 }
715715
716716 // Add last license if not yet added
717- if ( currentLicenseId != null && currentLicenseText . Length > 0 ) {
717+ if ( currentLicenseId is not null && currentLicenseText . Length > 0 ) {
718718 licenses . Add ( new SdkLicense {
719719 Id = currentLicenseId ,
720720 Text = currentLicenseText . ToString ( ) . Trim ( )
@@ -776,7 +776,7 @@ internal static (IReadOnlyList<SdkPackage> Installed, IReadOnlyList<SdkPackage>
776776 continue ;
777777 }
778778
779- if ( currentSection == null || string . IsNullOrWhiteSpace ( trimmed ) )
779+ if ( currentSection is null || string . IsNullOrWhiteSpace ( trimmed ) )
780780 continue ;
781781
782782 // Skip header and separator lines
@@ -900,7 +900,7 @@ async Task DownloadFileAsync (string url, string destinationPath, long expectedS
900900 await fileStream . WriteAsync ( buffer , 0 , bytesRead , cancellationToken ) . ConfigureAwait ( false ) ;
901901 totalRead += bytesRead ;
902902
903- if ( totalSize > 0 && progress != null ) {
903+ if ( totalSize > 0 && progress is not null ) {
904904 var percent = ( int ) ( ( totalRead * 100 ) / totalSize ) ;
905905 progress . Report ( new SdkBootstrapProgress {
906906 Phase = SdkBootstrapPhase . Downloading ,
@@ -957,7 +957,7 @@ static void SetExecutablePermissions (string directory, Action<TraceLevel, strin
957957 } ;
958958 var process = Process . Start ( psi ) ;
959959 process ? . WaitForExit ( ) ;
960- if ( process == null || process . ExitCode != 0 ) {
960+ if ( process is null || process . ExitCode != 0 ) {
961961 throw new InvalidOperationException ( $ "chmod failed for '{ file } ' with exit code { process ? . ExitCode ?? - 1 } ") ;
962962 }
963963 }
0 commit comments