public FoundationConfigurationController(IInstallService installService, IStorageService storageService, IContentRepository contentRepository, ReferenceConverter referenceConverter, ISiteDefinitionRepository siteDefinitionRepository, IVisitorGroupRepository visitorGroupRepository, ContentExportProcessor contentExportProcessor, IScheduledJobExecutor scheduledJobExecutor, IScheduledJobRepository scheduledJobRepository) : base(installService, storageService, contentRepository, referenceConverter, siteDefinitionRepository, scheduledJobExecutor, scheduledJobRepository, visitorGroupRepository) { _contentExportProcessor = contentExportProcessor; }
public RefreshUpdatesCommand(UpdatesViewModel viewModel, IPackageSourceSelector packageSource, IInstallService installService, ISearchService searchService, SelfPackageConfiguration selfPackageConfiguration, IComparer <IPackageIdentity> packageVersionComparer) { Ensure.NotNull(viewModel, "viewModel"); Ensure.NotNull(packageSource, "packageSource"); Ensure.NotNull(installService, "installService"); Ensure.NotNull(searchService, "searchService"); Ensure.NotNull(selfPackageConfiguration, "selfPackageConfiguration"); Ensure.NotNull(packageVersionComparer, "packageVersionComparer"); this.viewModel = viewModel; this.packageSource = packageSource; this.installService = installService; this.searchService = searchService; this.selfPackageConfiguration = selfPackageConfiguration; this.packageVersionComparer = packageVersionComparer; }
protected BaseConfigurationController(IInstallService installService, IStorageService storageService, IContentRepository contentRepository, ReferenceConverter referenceConverter, ISiteDefinitionRepository siteDefinitionRepository, IScheduledJobExecutor scheduledJobExecutor, IScheduledJobRepository scheduledJobRepository) { InstallService = installService; StorageService = storageService; ContentRepository = contentRepository; ReferenceConverter = referenceConverter; SiteDefinitionRepository = siteDefinitionRepository; ScheduledJobExecutor = scheduledJobExecutor; ScheduledJobRepository = scheduledJobRepository; }
public MaintenanceService( IRepository repository, ILambdaContext context, IAmazonS3 amazonS3, IInstallService installService, IProductService productService, IAmazonSQS sqsClient, IEncryptionService encryptionService, IDateTimeService dateTimeService) { this.repository = repository; this.context = context; this.amazonS3 = amazonS3; this.installService = installService; this.productService = productService; this.sqsClient = sqsClient; this.encryptionService = encryptionService; this.dateTimeService = dateTimeService; }
public ViewModelService(IDialogService dialogService, IThemeService themeService, INotificationService notificationService, IProgressBarService progressBarService, IConfigurationService configurationService, IInstallService installService, IProductService productService, IMsiService msiService, IInstallerFileBundleProviderFactory installerFileBundleProviderFactory, IUriService uriService, IClipboardService clipboardService, IIOService ioService, string tmpFolderPath) { _dialogService = dialogService ?? throw new ArgumentNullException(nameof(dialogService)); _themeService = themeService ?? throw new ArgumentNullException(nameof(themeService)); _notificationService = notificationService ?? throw new ArgumentNullException(nameof(notificationService)); _progressBarService = progressBarService ?? throw new ArgumentNullException(nameof(progressBarService)); _configurationService = configurationService ?? throw new ArgumentNullException(nameof(configurationService)); _installService = installService ?? throw new ArgumentNullException(nameof(installService)); _productService = productService ?? throw new ArgumentNullException(nameof(productService)); _msiService = msiService ?? throw new ArgumentNullException(nameof(msiService)); _installerFileBundleProviderFactory = installerFileBundleProviderFactory ?? throw new ArgumentNullException(nameof(installerFileBundleProviderFactory)); _uriService = uriService ?? throw new ArgumentNullException(nameof(uriService)); _clipboardService = clipboardService ?? throw new ArgumentNullException(nameof(clipboardService)); _ioService = ioService ?? throw new ArgumentNullException(nameof(ioService)); if (String.IsNullOrEmpty(tmpFolderPath)) { throw new ArgumentNullException(nameof(tmpFolderPath)); } _downloadFolderPath = GetDownloadFolderPath(tmpFolderPath); _logFolderPath = GetLogFolderPath(tmpFolderPath); }
public IInstallService GetService(string ServiceCode) { IInstallService service = null; switch (ServiceCode) { case NewInstallService.SERVICECODE: service = new NewInstallService(); break; case AppendInstallService.SERVICECODE: service = new AppendInstallService(); break; case LicenseInstallService.SERVICECODE: service = new AppendInstallService(); break; default: break; } return(service); }
public Fat32Installer(MainViewModel mainViewModel, IInstallService installService, ICameraProvider cameraProvider, ILogger <Fat32Installer> logger) : base(mainViewModel, installService, cameraProvider, logger) { }
public InstallController(IEngine engine, IInstallService installService) { _engine = engine; _installService = installService; }
public TestConnectionCommand(IInstallService installService) { this.installService = installService; }
public InstallApplicationCommand(IDialogService dialogService, IViewModelService viewModelService, IInstallService installService, INotificationService notificationService, IUriService uriService, string downloadFolderPath) { _dialogService = dialogService ?? throw new ArgumentNullException(nameof(dialogService)); _viewModelService = viewModelService ?? throw new ArgumentNullException(nameof(viewModelService)); _installService = installService ?? throw new ArgumentNullException(nameof(installService)); _notificationService = notificationService ?? throw new ArgumentNullException(nameof(notificationService)); _uriService = uriService ?? throw new ArgumentNullException(nameof(uriService)); _downloadFolderPath = !String.IsNullOrEmpty(downloadFolderPath) ? downloadFolderPath : throw new ArgumentNullException(nameof(downloadFolderPath)); }
public static async Task <InstallationResultDialogModel> Uninstall(IViewModelService viewModelService, IInstallService installService, INotificationService notificationService, IUriService uriService, InstallationViewModel currentInstallationViewModel, IReadOnlyList <InstallerViewModel> installerViewModels, bool enableSilentInstallation, bool disableReboot, bool enableInstallationLogging, bool automaticallyDeleteInstallationLogs, int keepNewestInstallationLogs, bool filterDuplicateInstallers, string downloadFolderPath) { if (viewModelService == null) { throw new ArgumentNullException(nameof(viewModelService)); } if (installService == null) { throw new ArgumentNullException(nameof(installService)); } if (notificationService == null) { throw new ArgumentNullException(nameof(notificationService)); } if (uriService == null) { throw new ArgumentNullException(nameof(uriService)); } if (currentInstallationViewModel == null) { throw new ArgumentNullException(nameof(currentInstallationViewModel)); } if (installerViewModels == null) { throw new ArgumentNullException(nameof(installerViewModels)); } if (String.IsNullOrEmpty(downloadFolderPath)) { throw new ArgumentNullException(nameof(downloadFolderPath)); } foreach (var installer in installerViewModels) { installer.SelectedOperation = InstallerOperation.Uninstall; } return(await Custom( viewModelService, installService, notificationService, uriService, currentInstallationViewModel, installerViewModels, enableSilentInstallation, disableReboot, enableInstallationLogging, automaticallyDeleteInstallationLogs, keepNewestInstallationLogs, filterDuplicateInstallers, downloadFolderPath)); }
private static async Task <InstallationResultViewModel> PerformOperation(IViewModelService viewModelService, IInstallService installService, INotificationService notificationService, InstallerViewModel installerViewModel, InstallationViewModel currentInstallationViewModel, string installerFilePath, bool enableSilentInstallation, bool disableReboot, bool enableInstallationLogging, string?logFolderPath = null) { string?installLogFilePath = null; string?uninstallLogFilePath = null; if (enableInstallationLogging) { if (String.IsNullOrEmpty(logFolderPath)) { Log.Warn("Installation logging is enabled but the logFolderPath is null or empty."); } else if (!Directory.Exists(logFolderPath)) { Log.Warn("logFolderPath is set but the directory doesn't exist."); } else { installLogFilePath = GetLogFilePathForInstaller(logFolderPath !, installerViewModel.Name ?? "unkown", "install"); uninstallLogFilePath = GetLogFilePathForInstaller(logFolderPath !, installerViewModel.Name ?? "unkown", "uninstall"); } } var installArguments = GetArguments( enableSilentInstallation, disableReboot, enableInstallationLogging, installLogFilePath).ToArray(); var uninstallArguments = GetArguments( enableSilentInstallation, disableReboot, enableInstallationLogging, uninstallLogFilePath).ToArray(); var installationResultViewModel = viewModelService.CreateViewModel <InstallationResultViewModel>(installerViewModel); try { switch (installerViewModel.SelectedOperation) { case InstallerOperation.Install: if (installerViewModel.IsInstalled != false) { if (installerViewModel.IsInstalled == null) { Log.Warn($"Installation status of file \"{installerViewModel.FileName}\" is unavailable, trying to uninstall."); } else { Log.Info($"The application \"{installerViewModel.Name}\" with ProductCode \"{installerViewModel.ProductCode}\" is already installed. It will now be uninstalled first."); } if (String.IsNullOrWhiteSpace(installerViewModel.ProductCode)) { var exception = new Exception($"Uninstalling \"{installerViewModel.FileName}\" failed: ProductCode is not set."); Log.Error(exception); if (installerViewModel.IsInstalled == true) { return(CreateInstallationFailedResult(viewModelService, installerViewModel, exception)); } } else { Log.Info($"Uninstalling application of installer \"{installerViewModel.FileName}\" now."); currentInstallationViewModel.CurrentOperation = InstallationOperation.Uninstall; if (enableInstallationLogging && uninstallLogFilePath is string) { installationResultViewModel.InstallationLogFilePaths.Add(uninstallLogFilePath); } try { await installService.PerformAsync(new Operation(installerViewModel.ProductCode, OperationType.Uninstall, uninstallArguments)); Log.Info($"Finished uninstalling."); } catch (Exception exception) { // suppress exception if installation status is unknown if (installerViewModel.IsInstalled == true) { throw; } Log.Warn("Uninstalling failed, but since the installation state is unavailable, the operation will continue", exception); } } } Log.Info($"Installing \"{installerViewModel.FileName}\" now."); currentInstallationViewModel.CurrentOperation = InstallationOperation.Install; if (enableInstallationLogging && installLogFilePath is string) { installationResultViewModel.InstallationLogFilePaths.Add(installLogFilePath); } await installService.PerformAsync(new Operation(installerFilePath, OperationType.Install, installArguments)); Log.Info($"Finished installing."); installationResultViewModel.State = InstallationResultState.Success; break; case InstallerOperation.Uninstall: if (installerViewModel.IsInstalled == null) { Log.Warn($"Installation status of file \"{installerViewModel.FileName}\" is unavailable, trying to uninstall."); } else if (installerViewModel.IsInstalled == false) { Log.Warn($"The application \"{installerViewModel.Name}\" with ProductCode \"{installerViewModel.ProductCode}\" is not installed. Trying to uninstall anyways but it will likely fail."); } else { Log.Info($"The application \"{installerViewModel.Name}\" with ProductCode \"{installerViewModel.ProductCode}\" will now be uninstalled."); } if (String.IsNullOrWhiteSpace(installerViewModel.ProductCode)) { var exception = new Exception($"Uninstalling \"{installerViewModel.FileName}\" failed: ProductCode is not set."); Log.Error(exception); return(CreateInstallationFailedResult(viewModelService, installerViewModel, exception)); } Log.Info($"Uninstalling application of installer \"{installerViewModel.FileName}\" now."); currentInstallationViewModel.CurrentOperation = InstallationOperation.Uninstall; if (enableInstallationLogging && uninstallLogFilePath is string) { installationResultViewModel.InstallationLogFilePaths.Add(uninstallLogFilePath); } await installService.PerformAsync(new Operation(installerViewModel.ProductCode, OperationType.Uninstall, uninstallArguments)); Log.Info($"Finished uninstalling."); installationResultViewModel.State = InstallationResultState.Success; break; default: installationResultViewModel.State = InstallationResultState.Skipped; break; } } #pragma warning disable CA1031 // Do not catch general exception types catch (Exception exception) { Log.Error(exception); var errorMessage = installerViewModel.SelectedOperation switch { InstallerOperation.Install => Strings.InstallationOfXFailed, InstallerOperation.Uninstall => Strings.UninstallationOfXFailed, _ => Strings.OperationOfXFailed, }; notificationService.ShowError(String.Format(errorMessage, installerViewModel.Name)); return(CreateInstallationFailedResult(viewModelService, installerViewModel, exception)); } #pragma warning restore CA1031 // Do not catch general exception types return(installationResultViewModel); }
public static async Task <InstallationResultDialogModel> Custom(IViewModelService viewModelService, IInstallService installService, INotificationService notificationService, IUriService uriService, InstallationViewModel currentInstallationViewModel, IReadOnlyList <InstallerViewModel> installerViewModels, bool enableSilentInstallation, bool disableReboot, bool enableInstallationLogging, bool automaticallyDeleteInstallationLogs, int keepNewestInstallationLogs, bool filterDuplicateInstallers, string downloadFolderPath) { if (viewModelService == null) { throw new ArgumentNullException(nameof(viewModelService)); } if (installService == null) { throw new ArgumentNullException(nameof(installService)); } if (notificationService == null) { throw new ArgumentNullException(nameof(notificationService)); } if (uriService == null) { throw new ArgumentNullException(nameof(uriService)); } if (currentInstallationViewModel == null) { throw new ArgumentNullException(nameof(currentInstallationViewModel)); } if (installerViewModels == null) { throw new ArgumentNullException(nameof(installerViewModels)); } if (String.IsNullOrEmpty(downloadFolderPath)) { throw new ArgumentNullException(nameof(downloadFolderPath)); } var cancellationToken = currentInstallationViewModel.CancellationTokenSource.Token; var installationResultDialogModel = viewModelService.CreateViewModel <InstallationResultDialogModel>(currentInstallationViewModel); var logFolderPath = enableInstallationLogging && currentInstallationViewModel.Name is string installationName?GetOrCreateLogFileFolderPath(installationName) : null; installationResultDialogModel.LogFolderPath = logFolderPath; var sessionDownloadPath = Path.Combine(downloadFolderPath, currentInstallationViewModel.Name); if (!Directory.Exists(sessionDownloadPath)) { Directory.CreateDirectory(sessionDownloadPath); } using var tempFileCollection = new TempFileCollection(sessionDownloadPath); Log.Info($"Starting download of {installerViewModels.Count} files."); var downloadResults = await Download(notificationService, installerViewModels, currentInstallationViewModel, tempFileCollection, 3, cancellationToken); Log.Info($"Download finished."); if (downloadResults.Any(dr => dr.Value.Result == DownloadResultState.Cancelled)) { Log.Info("At least one download was cancelled, installation will be skipped."); foreach (var download in downloadResults) { currentInstallationViewModel.CurrentInstallerIndex++; var installerViewModel = download.Key; var downloadResult = download.Value; var installationResultViewModel = downloadResult.Result switch { DownloadResultState.Failed => CreateDownloadFailedResult(viewModelService, installerViewModel, downloadResult), _ => CreateCancelledResult(viewModelService, installerViewModel) }; installationResultDialogModel.InstallationResults.Add(installationResultViewModel); currentInstallationViewModel.ProcessedInstallerFileCount++; } return(installationResultDialogModel); } currentInstallationViewModel.TotalInstallerFileCount = downloadResults.Count; var installedInstallerViewModels = new List <InstallerViewModel>(); foreach (var download in downloadResults) { currentInstallationViewModel.CurrentInstallerIndex++; var installerViewModel = download.Key; var downloadResult = download.Value; if (downloadResult.Result == DownloadResultState.Failed) { var failedResultViewModel = CreateDownloadFailedResult(viewModelService, installerViewModel, downloadResult); installationResultDialogModel.InstallationResults.Add(failedResultViewModel); currentInstallationViewModel.ProcessedInstallerFileCount++; continue; } if (cancellationToken.IsCancellationRequested) { var cancelledResultViewModel = CreateCancelledResult(viewModelService, installerViewModel); installationResultDialogModel.InstallationResults.Add(cancelledResultViewModel); currentInstallationViewModel.ProcessedInstallerFileCount++; continue; } if (downloadResult.Result != DownloadResultState.CompletedSuccessfully || !(downloadResult is SucceededDownloadResult succeededDownloadResult)) { Exception exception; if (downloadResult.Result != DownloadResultState.CompletedSuccessfully) { exception = new Exception($"Unexpected download result (got \"{downloadResult.Result.ToString()}\", should be \"{nameof(DownloadResultState.CompletedSuccessfully)}\")"); } else { exception = new Exception($"Unexpected download result type (got \"{downloadResult.GetType().Name}\", should be \"{nameof(SucceededDownloadResult)}\")"); } Log.Error(exception); var failedResultViewModel = CreateDownloadFailedResult(viewModelService, installerViewModel, exception); installationResultDialogModel.InstallationResults.Add(failedResultViewModel); currentInstallationViewModel.ProcessedInstallerFileCount++; continue; } if (filterDuplicateInstallers && installedInstallerViewModels.Any(i => i.Name == installerViewModel.Name)) { Log.Info($"Installer \"{installerViewModel.FileName}\" with the same application name \"{installerViewModel.Name}\" already processed, file will be skipped."); var skippedResultViewModel = CreateSkippedResult(viewModelService, installerViewModel); installationResultDialogModel.InstallationResults.Add(skippedResultViewModel); currentInstallationViewModel.ProcessedInstallerFileCount++; continue; } var installationResultViewModel = await PerformOperation( viewModelService, installService, notificationService, installerViewModel, currentInstallationViewModel, succeededDownloadResult.TempFileName, enableSilentInstallation, disableReboot, enableInstallationLogging, logFolderPath); installedInstallerViewModels.Add(installerViewModel); installationResultDialogModel.InstallationResults.Add(installationResultViewModel); currentInstallationViewModel.ProcessedInstallerFileCount++; } currentInstallationViewModel.CurrentOperation = InstallationOperation.None; if (enableInstallationLogging && automaticallyDeleteInstallationLogs) { try { RemoveOldestLogFiles(notificationService, uriService, logFolderPath, keepNewestInstallationLogs); } #pragma warning disable CA1031 // Do not catch general exception types catch (Exception exception) { Log.Warn("Deleting old log files failed", exception); } #pragma warning restore CA1031 // Do not catch general exception types } installationResultDialogModel.IsReadOnly = true; return(installationResultDialogModel); }
public BrowserViewModel(IPackageSourceSelector packageSource, ISearchService search, IInstallService install) { Packages = new ObservableCollection <PackageViewModel>(); Search = new SearchCommand(this, packageSource, search); Paging = new PagingViewModel(Search); Install = new InstallCommand(install); }
public DownloadService(IInstallService installService, HttpServerConfigs serverConfigs) { this.installService = installService; this.serverConfigs = serverConfigs; }
public SetupDatabaseCommand(IInstallService installService) { this.installService = installService; }
public UninstallCommandHandler(IInstallService installService) { _installService = installService; }
public InstallController(IInstallService installService) { this.installService = installService; }
public InstallCommand(IInstallService service) { Ensure.NotNull(service, "service"); this.service = service; }
public MainViewModel(IPackageSourceCollection sources, ISearchService search, IInstallService install, SelfPackageConfiguration selfPackageConfiguration, ISelfUpdateService selfUpdate, IComparer <IPackageIdentity> packageVersionComparer) { SourceSelector = new PackageSourceSelectorViewModel(sources); Browser = new BrowserViewModel(SourceSelector, search, install); Installed = new InstalledViewModel(SourceSelector, install, selfPackageConfiguration); Updates = new UpdatesViewModel(SourceSelector, install, search, selfPackageConfiguration, selfUpdate, packageVersionComparer); Cancel = new CancelCommand( Browser.Search, Browser.Install, Installed.Uninstall, Installed.UninstallAll, Installed.Reinstall, Installed.Refresh, Updates.Update, Updates.UpdateAll, Updates.Refresh ); Cancel.CanExecuteChanged += OnCancelCanExecuteChanged; Installed.Uninstall.Completed += OnInstalledChanged; Updates.Update.Completed += OnInstalledChanged; }
public InstallUpdateCommand(IInstallService installService, IIOService ioService, string downloadFolderPath) { _installService = installService ?? throw new ArgumentNullException(nameof(installService)); _ioService = ioService ?? throw new ArgumentNullException(nameof(ioService)); _downloadFolderPath = downloadFolderPath ?? throw new ArgumentNullException(nameof(downloadFolderPath)); }
public HomeController(IInstallService installService) { _installService = installService; }
public InstallCommandHandler(IPackageRepository packageRepository, IInstallService installService) { _packageRepository = packageRepository; _installService = installService; }
public RefreshInstalledCommand(InstalledViewModel viewModel, IPackageSourceSelector packageSource, IInstallService service) { Ensure.NotNull(viewModel, "viewModel"); Ensure.NotNull(packageSource, "packageSource"); Ensure.NotNull(service, "service"); this.viewModel = viewModel; this.packageSource = packageSource; this.service = service; }