public GameLaunchResult?Launch(GlobalSettings settings) { if (settings.UseBsuLauncher) { return(BsuLauncher.Launch(this, settings, _dispatcher)); } ArmaLauncher.Launch(); return(null); }
private void CheckRepository(IModelRepository repository) { var settings = _serviceProvider.Get <IModel>().GetSettings(); if (settings.UseBsuLauncher) { return; } var state = _stateService.GetStateFor(repository); if (state != CalculatedRepositoryStateEnum.Ready && state != CalculatedRepositoryStateEnum.ReadyPartial) { return; } if (repository.GetMods().All(mod => mod.GetCurrentSelection() is ModSelectionDisabled)) { return; // don't create an empty preset } var presetName = SanitizePresetName(repository.Name); var dlcs = repository.GetServerInfo().Cdlcs.Select(id => id.ToString()).ToList(); var mods = GetModPaths(repository); var steamMods = GetSteamMods(repository); var wasUpdatedTask = ArmaLauncher.UpdatePreset(presetName, mods, steamMods, dlcs); wasUpdatedTask.ContinueInDispatcher(_dispatcher, wasUpdated => { try { if (!wasUpdated()) { return; } // TODO: check if the launcher was open. can skip the re-start bit otherwise // TODO: don't really need to restart if it already existed / folders were watched. _eventManager.Publish(new NotificationEvent($"Arma Launcher Preset was created. You might have to re-start the launcher.")); } catch (Exception e) { _logger.Error(e); _eventManager.Publish(new ErrorEvent($"Failed to create preset '{repository.Name}'")); } }); }