@@ -117,11 +117,9 @@ AppContentSummary latestVersionContentSummary
117117 + _lowestVersionWithContentId +
118118 " and currently installed version id is "
119119 + installedVersionId +
120- ". Uninstalling to prepare for content strategy ." ) ;
120+ ". Reinstalling ." ) ;
121121
122- IUninstallCommand uninstall = _commandFactory . CreateUninstallCommand ( Context ) ;
123- uninstall . Prepare ( _status , cancellationToken ) ;
124- uninstall . Execute ( cancellationToken ) ;
122+ ReinstallContent ( cancellationToken ) ;
125123 }
126124 else if ( repairCost < contentSize )
127125 {
@@ -131,15 +129,8 @@ AppContentSummary latestVersionContentSummary
131129 }
132130 else
133131 {
134- DebugLogger . Log ( string . Format ( "Content cost {0} is smaller than repair {1}. Uninstalling to prepare for content strategy." , contentSize , repairCost ) ) ;
135- IUninstallCommand uninstall = _commandFactory . CreateUninstallCommand ( Context ) ;
136- uninstall . Prepare ( _status , cancellationToken ) ;
137- uninstall . Execute ( cancellationToken ) ;
138-
139- // not catching any exceptions here, because exception during content installation in this place should be fatal
140- var contentStrategy = new AppUpdaterContentStrategy ( Context , _status ) ;
141- contentStrategy . RepairOnError = false ; // do not attempt to repair content to not cause a loop
142- contentStrategy . Update ( cancellationToken ) ;
132+ DebugLogger . Log ( string . Format ( "Content cost {0} is smaller than repair {1}. Reinstalling." , contentSize , repairCost ) ) ;
133+ ReinstallContent ( cancellationToken ) ;
143134 }
144135
145136 return false ;
@@ -178,5 +169,17 @@ private long CalculateRepairCost(AppContentSummary contentSummary, IEnumerable<F
178169 . Select ( f => contentSummary . Files . FirstOrDefault ( e => e . Path == f . FileName ) )
179170 . Sum ( f => f . Size ) ;
180171 }
172+
173+ private void ReinstallContent ( PatchKit . Unity . Patcher . Cancellation . CancellationToken cancellationToken )
174+ {
175+ IUninstallCommand uninstall = _commandFactory . CreateUninstallCommand ( Context ) ;
176+ uninstall . Prepare ( _status , cancellationToken ) ;
177+ uninstall . Execute ( cancellationToken ) ;
178+
179+ // not catching any exceptions here, because exception during content installation in this place should be fatal
180+ var contentStrategy = new AppUpdaterContentStrategy ( Context , _status ) ;
181+ contentStrategy . RepairOnError = false ; // do not attempt to repair content to not cause a loop
182+ contentStrategy . Update ( cancellationToken ) ;
183+ }
181184 }
182185}
0 commit comments