예제 #1
0
        public async Task Install(PackageManifest packageManifest, InstallInteractivityLevel interactivityLevel)
        {
            using (var context = _installerContextFactory.Build(packageManifest, interactivityLevel, PackageOperation.Install))
            {
                _logger.Info("Beginning installation of '{0}'", packageManifest);
                _hub.Publish(new InstallationInitializedEvent(packageManifest));

                var installer = _findInstaller.GetBestInstaller(packageManifest.Installers);

                var installerPath = await _fileTransferService.TransferFile(installer.Location, installer.Sha256);

                _logger.Debug("Getting list of installed application");
                var updates = await _novoClient.GetUpdate(context.InstallerRecords, packageManifest.Id);

                var availableUpdates = updates.Where(c => c.Status == UpdateStatus.Available);

                if (availableUpdates.Any())
                {
                    _logger.Info("Updating {0} to {1}. Currently Installed: {2}", packageManifest.Name, packageManifest.Version, updates.First().InstalledVersion);
                }

                var whisperer = _installWhisperers().First(c => c.InstallMethod == packageManifest.InstallMethod);

                context.Whisperer = whisperer;
                whisperer.Initialize(packageManifest, installerPath);


                foreach (var update in updates)
                {
                    _unlocker.UnlockFolder(update.InstallationPath, packageManifest.InstallMethod);
                }

                try
                {
                    context.Process = RunInstaller(interactivityLevel, packageManifest, whisperer);
                }
                catch (InstallerException ex)
                {
                    context.Exception = ex;
                    throw;
                }

                _logger.Info("Installation completed successfully for '{0}'", packageManifest);
                _hub.Publish(new InstallationSuccessfulEvent(packageManifest));
            }
        }
예제 #2
0
        public async Task <bool> ProcessFile([ActivityTrigger] string fileName)
        {
            await _transferService.TransferFile(fileName);

            return(true);
        }