示例#1
0
        public async Task HandleAsync(DomainCommandContext context, InitializeCommand command)
        {
            var applicationSettings = await _applicationSettingsRepository.LoadAsync();

            var games = await _gameRepository.LoadAllAsync();

            var gameProfileId = await _gameRepository.LoadGameProfileIdAsync();

            var textureManagementSettings = await _textureManagementSettingsRepository.LoadAsync();

            var usageStatistics = await _usageStatisticsRepository.LoadAsync();

            var @event = new InitializeEvent(
                applicationSettings.Map <ApplicationSettings>(),
                games.Map <IEnumerable <Game> >(),
                gameProfileId?.Value,
                textureManagementSettings.Map <TextureManagementSettings>(),
                usageStatistics.Map <SharedModel.UsageStatistics>());

            foreach (var settings in games)
            {
                await _processWatcher.WatchAsync(settings.Id);
            }

            await context.PublishAsync(@event);
        }
示例#2
0
        public async Task HandleAsync(DomainCommandContext context, UpdateGameCommand command)
        {
            var game = await _gameRepository.LoadAsync(command.Id);

            game.ChangeName(command.Name);
            game.ChangeFilePath(command.FilePath);

            await _gameRepository.SaveAsync(game);

            await _processWatcher.WatchAsync(game.Id);

            await context.PublishAsync(new GameUpdatedEvent(game.Id, game.Name, game.FilePath));
        }
示例#3
0
        public async Task HandleAsync(DomainCommandContext context, UpdateGameProfileCommand command)
        {
            var gameProfile = command.GameProfile.Map <GameProfile>();
            var game        = await _gameRepository.LoadByGameProfileId(gameProfile.Id);

            var profile = game.AddGameProfile(
                command.GameProfile.Id,
                command.GameProfile.Name,
                command.GameProfile.ProxyDirectoryPath,
                command.GameProfile.LogsDirectoryPath,
                command.GameProfile.PluginType,
                command.GameProfile.Direct3D11Settings.Map <Direct3D11Settings>());

            await _gameRepository.SaveAsync(game);

            await _processWatcher.WatchAsync(game.Id);

            await context.PublishAsync(new GameProfileUpdatedEvent(profile.Map <Shared.Model.GameSettings.GameProfile>()));
        }
        public async Task HandleAsync(DomainCommandContext context, AddGameProfileCommand command)
        {
            var game = await _gameRepository.LoadAsync(command.GameId);

            if (game == null)
            {
                await context.EmitAsync(new ErrorOccuredNotification());

                return;
            }

            var gameProfileTemplate = game.Profiles.SingleOrDefault(entity => entity.Id == (AggregateId)command.BasedOnGameProfileId);

            if (gameProfileTemplate == null)
            {
                await context.EmitAsync(new ErrorOccuredNotification());

                return;
            }

            var gameProfile = game.AddGameProfile(
                AggregateId.Generate(),
                command.Name,
                gameProfileTemplate.ProxyDirectoryPath,
                gameProfileTemplate.LogsDirectoryPath,
                gameProfileTemplate.PluginType,
                gameProfileTemplate.Direct3D11Settings);

            await _gameRepository.SaveAsync(game);

            await _processWatcher.WatchAsync(game.Id);

            var @event = new GameProfileAddedEvent(
                game.Id,
                game.ProfileId,
                gameProfile.Map <GameProfile>());

            await context.PublishAsync(@event);
        }