@@ -201,22 +201,19 @@ protected virtual void _httpClient_UpdateAssetProgress(int size, DownloadProgres
201201 double percentage = ConverterTool . GetPercentageNumber ( _progressAllSizeCurrent , _progressAllSizeTotal ) ;
202202
203203 // Update current progress percentages and speed
204- if ( _progress != null )
204+ lock ( _progress )
205205 {
206206 _progress . ProgressAllPercentage = percentage ;
207207 }
208208
209209 // Update current activity status
210- if ( _status != null )
211- {
212- _status . IsProgressAllIndetermined = false ;
213- string timeLeftString = string . Format ( Lang . _Misc . TimeRemainHMSFormat , timeLeftSpan ) ;
214- _status . ActivityAll = string . Format ( Lang . _Misc . Downloading + ": {0}/{1} " , _progressAllCountCurrent ,
215- _progressAllCountTotal )
216- + string . Format ( $ "({ Lang . _Misc . SpeedPerSec } )",
217- ConverterTool . SummarizeSizeSimple ( speedClamped ) )
218- + $ " | { timeLeftString } ";
219- }
210+ _status . IsProgressAllIndetermined = false ;
211+ string timeLeftString = string . Format ( Lang . _Misc . TimeRemainHMSFormat , timeLeftSpan ) ;
212+ _status . ActivityAll = string . Format ( Lang . _Misc . Downloading + ": {0}/{1} " , _progressAllCountCurrent ,
213+ _progressAllCountTotal )
214+ + string . Format ( $ "({ Lang . _Misc . SpeedPerSec } )",
215+ ConverterTool . SummarizeSizeSimple ( speedClamped ) )
216+ + $ " | { timeLeftString } ";
220217
221218 // Trigger update
222219 UpdateAll ( ) ;
@@ -462,15 +459,12 @@ protected void UpdateSophonFileDownloadProgress(long downloadedWrite, long curre
462459 protected void UpdateSophonDownloadStatus ( SophonAsset asset )
463460 {
464461 Interlocked . Add ( ref _progressAllCountCurrent , 1 ) ;
465- if ( _status != null )
466- {
467- _status . ActivityStatus = string . Format ( "{0}: {1}" ,
468- _isSophonInUpdateMode
469- ? Lang . _Misc . Updating
470- : Lang . _Misc . Downloading ,
471- string . Format ( Lang . _Misc . PerFromTo , _progressAllCountCurrent ,
472- _progressAllCountTotal ) ) ;
473- }
462+ _status . ActivityStatus = string . Format ( "{0}: {1}" ,
463+ _isSophonInUpdateMode
464+ ? Lang . _Misc . Updating
465+ : Lang . _Misc . Downloading ,
466+ string . Format ( Lang . _Misc . PerFromTo , _progressAllCountCurrent ,
467+ _progressAllCountTotal ) ) ;
474468
475469 UpdateStatus ( ) ;
476470 }
@@ -884,17 +878,13 @@ protected async Task<bool> TryRunExamineThrow(Task<bool> action)
884878 }
885879 finally
886880 {
887- // Define that the status is not running
888- if ( _status != null )
881+ // Clear the _assetIndex after that
882+ if ( _status is { IsCompleted : false } )
889883 {
890- // Clear the _assetIndex after that
891- if ( _status is { IsCompleted : false } )
892- {
893- _assetIndex . Clear ( ) ;
894- }
895-
896- _status . IsRunning = false ;
884+ _assetIndex . Clear ( ) ;
897885 }
886+
887+ _status . IsRunning = false ;
898888 }
899889 }
900890
0 commit comments