public void OnStarted() { if (_injectionService.IsProxyLoaded(_game.FilePath, _plugins.Proxy)) { return; } var gameProfile = _game.Profiles.SingleOrDefault(profile => profile.Id == _game.ProfileId); if (gameProfile == null) { _logger.Log(LogLevel.Error, $"game profile could not be found for: {FilePath}"); return; } var tokenReplacer = new TokenReplacer(new ApplicationFilePathTokenReplacingPolicy(() => _game.FilePath)); var component = _assembler.Assemble(gameProfile, new AssemblingContext(FormType.None, tokenReplacer)); component.Tokenize(); if (!component.IsValid) { _logger.Log(LogLevel.Error, $"game profile for: {FilePath} are not valid; skipping..."); return; } try { foreach (var directoryPath in component.AllProperties .OfType <IGenericProperty <string> >() .Where(property => property.Configuration.IsDirectoryPath) .Select(property => property.Value)) { _logger.Log(LogLevel.Information, $"demanding access to: {directoryPath}..."); _directoryRepository.DemandAccess(directoryPath); } } catch (SecurityException) { _logger.Log(LogLevel.Error, $"insufficient permissions to: {FilePath}"); return; } catch (UnauthorizedAccessException) { _logger.Log(LogLevel.Error, $"insufficient permissions to: {FilePath}"); return; } var settings = new InjectableProxySettings { CommunicationAddress = _communicationAddress, CommunicationPort = _communicationPort, Direct3D11PluginPath = _plugins.Direct3D11, GameFilePath = _game.FilePath, GameName = _game.Name, GameProfile = gameProfile }; Inject(settings).Wait(); }