Example #1
0
 public void Configure(IExportRegistrationBlock block)
 {
     block.Export <ZipExtractor>().As <IZipExtractor>();
     block.Export <FileSystemOperations>().As <IFileSystemOperations>().Lifestyle.Singleton();
     block.Export <Downloader>().As <IDownloader>().Lifestyle.Singleton();
     block.ExportFactory(() => new HttpClient {
         Timeout = TimeSpan.FromMinutes(30)
     }).Lifestyle.Singleton();
     block.ExportFactory(() => new GitHubClient(new ProductHeaderValue("WOADeployer"))).As <IGitHubClient>().Lifestyle.Singleton();
     block.ExportFactory(() => AzureDevOpsBuildClient.Create(new Uri("https://dev.azure.com"))).As <IAzureDevOpsBuildClient>().Lifestyle.Singleton();
 }
        public async Task Test()
        {
            var zipExtractor      = new ZipExtractor(new FileSystemOperations());
            var azureDevOpsClient = AzureDevOpsBuildClient.Create(new Uri("https://dev.azure.com"));

            using (var httpClient = new HttpClient())
            {
                IDownloader downloader = new Downloader(httpClient);
                var         task       = new FetchAzureDevOpsArtifact("LumiaWOA;Lumia950XLPkg;1;MSM8994 UEFI (Lumia 950 XL)", azureDevOpsClient, zipExtractor, downloader, null, new TestDeploymentContext(), new TestFileSystemOperations(), new TestOperationContext());
                await task.Execute();
            }
        }
Example #3
0
 public void Configure(IExportRegistrationBlock block)
 {
     block.Export <ZipExtractor>().As <IZipExtractor>();
     block.Export <FileSystemOperations>().As <IFileSystemOperations>().Lifestyle.Singleton();
     block.Export <Downloader>().As <IDownloader>().Lifestyle.Singleton();
     block.ExportFactory(() => new HttpClient {
         Timeout = TimeSpan.FromMinutes(30)
     }).Lifestyle.Singleton();
     block.ExportFactory(() => new GitHubClient(new ProductHeaderValue("WOADeployer"))).As <IGitHubClient>().Lifestyle.Singleton();
     block.ExportFactory(() => AzureDevOpsBuildClient.Create(new Uri("https://dev.azure.com"))).As <IAzureDevOpsBuildClient>().Lifestyle.Singleton();
     block.ExportFactory((IDownloader downloader) => new XmlDeviceRepository(new Uri("https://raw.githubusercontent.com/WOA-Project/Deployment-Feed/master/Deployments.xml"), downloader))
     .As <IDeviceRepository>().Lifestyle.Singleton();
 }
        public static IExportRegistrationBlock Configure(this IExportRegistrationBlock block)
        {
            var taskTypes = from a in Assemblies.AppDomainAssemblies
                            from type in a.ExportedTypes
                            where type.GetTypeInfo().ImplementedInterfaces.Contains(typeof(IDeploymentTask))
                            select type;

            block.ExportAssemblies(Assemblies.AppDomainAssemblies).ByInterface <ISpaceAllocator <IPhone> >().Lifestyle.Singleton();
            block.ExportAssemblies(Assemblies.AppDomainAssemblies).BasedOn <LumiaDiskLayoutPreparer>().ByInterface <IDiskLayoutPreparer>().ExportAttributedTypes().Lifestyle.Singleton();
            block.Export <ZipExtractor>().As <IZipExtractor>();
            block.ExportFactory(Tokenizer.Create).As <Tokenizer <LangToken> >().Lifestyle.Singleton();
            block.Export <ScriptParser>().As <IScriptParser>().Lifestyle.Singleton();
            block.Export <PhoneInfoReader>().As <IPhoneInfoReader>().Lifestyle.Singleton();
            block.Export <WoaDeployer>().As <IWoaDeployer>().Lifestyle.Singleton();
            block.Export <Tooling>().As <ITooling>().Lifestyle.Singleton();
            block.Export <BootCreator>().As <IBootCreator>().Lifestyle.Singleton();
            block.Export <DiskApi>().As <IDiskApi>().Lifestyle.Singleton();
            block.Export <PhonePathBuilder>().As <IPathBuilder>().Lifestyle.Singleton();
            block.ExportInstance(taskTypes).As <IEnumerable <Type> >();
            block.Export <ScriptRunner>().As <IScriptRunner>().Lifestyle.Singleton();
            block.Export <InstanceBuilder>().As <IInstanceBuilder>().Lifestyle.Singleton();
            block.Export <FileSystemOperations>().As <IFileSystemOperations>().Lifestyle.Singleton();
            block.Export <BcdInvokerFactory>().As <IBcdInvokerFactory>().Lifestyle.Singleton();
            block.Export <WindowsDeployer>().As <IWindowsDeployer>().Lifestyle.Singleton();
            block.ExportFactory(() => new HttpClient {
                Timeout = TimeSpan.FromMinutes(30)
            }).Lifestyle.Singleton();
            block.ExportFactory(() => new GitHubClient(new ProductHeaderValue("WOADeployer"))).As <IGitHubClient>().Lifestyle.Singleton();
            block.Export <Downloader>().As <IDownloader>().Lifestyle.Singleton();
            block.Export <ExistingDeploymentCleaner>().As <IExistingDeploymentCleaner>().Lifestyle.Singleton();
            block.ExportFactory((IPhone phone) => new DeploymentContext {
                Device = phone
            }).As <IDeploymentContext>().Lifestyle.Singleton();
            block.Export <OperationContext>().As <IOperationContext>().Lifestyle.Singleton();
            block.ExportFactory(() => AzureDevOpsBuildClient.Create(new Uri("https://dev.azure.com"))).As <IAzureDevOpsBuildClient>().Lifestyle.Singleton();
            block.Export <PhoneModelInfoInfoReader>().As <IPhoneModelInfoReader>().Lifestyle.Singleton();
            block.Export <Phone>().As <IPhone>().Lifestyle.Singleton();
            block.Export <DismImageService>().As <IWindowsImageService>().Lifestyle.Singleton();
            block.Export <LogCollector>().As <ILogCollector>().Lifestyle.Singleton();

            return(block);
        }