66using ByteSizeLib ;
77using CommandLine ;
88using Deployer ;
9+ using Deployer . FileSystem ;
910using Deployer . Lumia . NetFx ;
1011using Deployer . Raspberry ;
1112using Deployer . Tasks ;
@@ -44,8 +45,6 @@ private static async Task Execute(IEnumerable<string> args, Subject<double> subj
4445 {
4546 var optionsProvider = new WindowsDeploymentOptionsProvider ( ) ;
4647
47- var deployer = GetDeployer ( optionsProvider , subject ) ;
48-
4948 var parserResult = Parser . Default
5049 . ParseArguments < WindowsDeploymentCmdOptions ,
5150 NonWindowsDeploymentCmdOptions > ( args ) ;
@@ -54,26 +53,31 @@ await parserResult
5453 . MapResult (
5554 ( WindowsDeploymentCmdOptions opts ) =>
5655 {
56+ var deployer = GetDeployer ( optionsProvider , opts . DiskNumber , subject ) ;
5757 optionsProvider . Options = new WindowsDeploymentOptions
5858 {
5959 ImageIndex = opts . Index ,
6060 ImagePath = opts . WimImage ,
61- SizeReservedForWindows = ByteSize . FromGigaBytes ( opts . ReservedSizeForWindowsInGb ) ,
6261 UseCompact = opts . UseCompact ,
6362 } ;
6463 return deployer . Deploy ( ) ;
6564 } ,
66- ( NonWindowsDeploymentCmdOptions opts ) => deployer . Deploy ( ) ,
65+ ( NonWindowsDeploymentCmdOptions opts ) =>
66+ {
67+ var deployer = GetDeployer ( optionsProvider , opts . DiskNumber , subject ) ;
68+ return deployer . Deploy ( ) ;
69+ } ,
6770 HandleErrors ) ;
6871 }
6972
70- private static IWoaDeployer GetDeployer ( WindowsDeploymentOptionsProvider op , Subject < double > progress )
73+ private static IWoaDeployer GetDeployer ( WindowsDeploymentOptionsProvider op , int diskNumber , Subject < double > progress )
7174 {
7275 var container = new DependencyInjectionContainer ( ) ;
7376
7477 container . Configure ( x =>
7578 {
7679 x . Configure ( op ) ;
80+ x . ExportFactory ( ( ILowLevelApi lla ) => new DeviceProvider ( ) { Device = new RaspberryPi ( lla , diskNumber ) } ) . As < IDeviceProvider > ( ) . Lifestyle . Singleton ( ) ;
7781 x . Export < ConsoleMarkdownDisplayer > ( ) . As < IMarkdownDisplayer > ( ) ;
7882 x . ExportInstance ( progress ) . As < IObserver < double > > ( ) ;
7983 } ) ;
0 commit comments