/* Implementation */ private void SetCurrentApplication() { Application = ViewModel.Application; if (Application != null) { Application.Config.PropertyChanged += LocationPropertyChanged; Deployer = new AsiLoaderDeployer(Application); } }
/// <summary> /// Tests possible error cases. /// </summary> private static Task DoSanityTests() { // Needs to be ran after SetupViewModelsAsync var apps = IoC.GetConstant <ApplicationConfigService>().Items; var mods = IoC.GetConstant <ModConfigService>().Items.ToArray(); // Enforce compatibility non-async, since this is unlikely to do anything. foreach (var app in apps) { EnforceModCompatibility(app, mods); } // Checking bootstrappers could add I/O overhead on cold boot, delegate to threadpool. void UpdateBootstrappers() { var updatedBootstrappers = new List <string>(); foreach (var app in apps) { try { var deployer = new AsiLoaderDeployer(app); var bootstrapperInstallPath = deployer.GetBootstrapperInstallPath(out _); if (!File.Exists(bootstrapperInstallPath)) { continue; } var updater = new BootstrapperUpdateChecker(bootstrapperInstallPath); try { if (!updater.NeedsUpdate()) { continue; } } catch (Exception) { /* ignored */ } var bootstrapperSourcePath = deployer.GetBootstrapperDllPath(); try { File.Copy(bootstrapperSourcePath, bootstrapperInstallPath, true); updatedBootstrappers.Add(app.Config.AppName); } catch (Exception) { /* ignored */ } } catch (Exception) { /* ignored */ } } if (updatedBootstrappers.Count <= 0) { return; } ActionWrappers.ExecuteWithApplicationDispatcher(() => { var title = Resources.BootstrapperUpdateTitle.Get(); var description = string.Format(Resources.BootstrapperUpdateDescription.Get(), String.Join('\n', updatedBootstrappers)); Actions.DisplayMessagebox.Invoke(title, description); }); } return(Task.Run(UpdateBootstrappers)); }
/// <inheritdoc /> public DeployAsiLoaderCommand(PathTuple <ApplicationConfig> applicationTuple) { _deployer = new AsiLoaderDeployer(applicationTuple); }