@@ -17,6 +17,16 @@ public class ImageFlasher : IImageFlasher
1717 {
1818 private readonly Regex percentRegex = new Regex ( @"(\d*.\d*)%" ) ;
1919
20+ public string EtcherPath
21+ {
22+ get
23+ {
24+ var platformSuffix = Environment . Is64BitProcess ? "x64" : "x86" ;
25+ var etcherPath = Path . Combine ( "Core" , "Tools" , "Etcher-Cli" , platformSuffix , "Etcher" ) ;
26+ return etcherPath ;
27+ }
28+ }
29+
2030 public async Task Flash ( Disk disk , string imagePath , IObserver < double > progressObserver = null )
2131 {
2232 ISubject < string > outputSubject = new Subject < string > ( ) ;
@@ -29,7 +39,7 @@ public async Task Flash(Disk disk, string imagePath, IObserver<double> progressO
2939 {
3040 if ( ! isValidating && CultureInfo . CurrentCulture . CompareInfo . IndexOf ( s , "validating" , 0 , CompareOptions . IgnoreCase ) != - 1 )
3141 {
32- Log . Verbose ( "Validating flashed image..." ) ;
42+ Log . Information ( "Validating flashed image..." ) ;
3343 isValidating = true ;
3444 }
3545 } )
@@ -38,14 +48,9 @@ public async Task Flash(Disk disk, string imagePath, IObserver<double> progressO
3848 . Subscribe ( progressObserver ) ;
3949 }
4050
41- //etcher.exe -d \\.\PHYSICALDRIVE3 "..\Tutorial Googulator\gpt.zip" --yes
42- var gptSchemeImagePath = Path . Combine ( "Files" , "Core" , "Gpt.zip" ) ;
43-
44- var platformSuffix = Environment . Is64BitProcess ? "x64" : "x86" ;
45- var etcherPath = Path . Combine ( "Files" , "Tools" , "Etcher-Cli" , platformSuffix , "Etcher" ) ;
46- var args = $@ "-d \\.\PHYSICALDRIVE{ disk . Number } ""{ gptSchemeImagePath } "" --yes --no-unmount";
47- Log . Verbose ( "We are about to run Etcher: {ExecName} {Parameters}" , etcherPath , args ) ;
48- var resultCode = await ProcessUtils . RunProcessAsync ( etcherPath , args , outputObserver : outputSubject ) ;
51+ var args = $@ "-d \\.\PHYSICALDRIVE{ disk . Number } ""{ imagePath } "" --yes --no-unmount";
52+ Log . Verbose ( "We are about to run Etcher: {ExecName} {Parameters}" , EtcherPath , args ) ;
53+ var resultCode = await ProcessUtils . RunProcessAsync ( EtcherPath , args , outputObserver : outputSubject ) ;
4954 if ( resultCode != 0 )
5055 {
5156 throw new DeploymentException ( $ "There has been a problem during deployment: Etcher exited with code { resultCode } .") ;
@@ -54,6 +59,7 @@ public async Task Flash(Disk disk, string imagePath, IObserver<double> progressO
5459 progressObserver ? . OnNext ( double . NaN ) ;
5560
5661 stdOutputSubscription ? . Dispose ( ) ;
62+ await disk . LowLevelApi . UpdateStorageCache ( ) ;
5763 }
5864
5965 private double GetPercentage ( string output )
0 commit comments