コード例 #1
0
ファイル: FindPluginStateQuery.cs プロジェクト: S17L/iGP11
 public async Task <ProxySettings> FindPluginStateAsync()
 {
     using (await IsolatedDatabaseAccess.Open())
     {
         return(_database.PluginState);
     }
 }
コード例 #2
0
ファイル: GameRepository.cs プロジェクト: S17L/iGP11
 public async Task <AggregateId> LoadGameProfileIdAsync()
 {
     using (await IsolatedDatabaseAccess.Open())
     {
         return(_context.LastEditedProfileId);
     }
 }
コード例 #3
0
ファイル: GameRepository.cs プロジェクト: S17L/iGP11
 public async Task <IEnumerable <Game> > LoadAllAsync()
 {
     using (await IsolatedDatabaseAccess.Open())
     {
         return(_context.Games.Clone());
     }
 }
コード例 #4
0
 public async Task <ConstantSettings> FindAsync()
 {
     using (await IsolatedDatabaseAccess.Open())
     {
         return(_database.ConstantSettings.Clone());
     }
 }
コード例 #5
0
 public async Task <DateTime?> IsFirstRunAsync()
 {
     using (await IsolatedDatabaseAccess.Open())
     {
         return(_database.UsageStatistics.FirstLaunchTime);
     }
 }
コード例 #6
0
 public async Task <TextureManagementSettings> FindAsync()
 {
     using (await IsolatedDatabaseAccess.Open())
     {
         return(_database.TextureManagementSettings.Clone());
     }
 }
コード例 #7
0
 public async Task SaveAsync(ApplicationSettings applicationSettings)
 {
     using (await IsolatedDatabaseAccess.Open())
     {
         _context.ApplicationSettings = applicationSettings.Clone();
         _context.Commit();
     }
 }
コード例 #8
0
 public async Task SaveAsync(TextureManagementSettings textureManagementSettings)
 {
     using (await IsolatedDatabaseAccess.Open())
     {
         _context.TextureConverterSettings = textureManagementSettings.Clone();
         _context.Commit();
     }
 }
コード例 #9
0
 public async Task SaveAsync(UsageStatistics usageStatistics)
 {
     using (await IsolatedDatabaseAccess.Open())
     {
         _context.UsageStatistics = usageStatistics.Clone();
         _context.Commit();
     }
 }
コード例 #10
0
        public async Task HandleAsync(DomainEventContext context, FirstLaunchIndicatedEvent @event)
        {
            using (await IsolatedDatabaseAccess.Open())
            {
                _database.UsageStatistics.FirstLaunchTime = @event.Time;
            }

            await context.EmitAsync(new ActionSucceededNotification());
        }
コード例 #11
0
        public async Task HandleAsync(DomainEventContext context, ProxySettingsLoadedEvent @event)
        {
            using (await IsolatedDatabaseAccess.Open())
            {
                _database.ProxySettings = @event.ProxySettings;
            }

            await context.EmitAsync(new ProxySettingsLoadedNotification(@event.ProxySettings));
        }
コード例 #12
0
        public async Task HandleAsync(DomainEventContext context, LastEditedGameProfileUpdatedEvent @event)
        {
            using (await IsolatedDatabaseAccess.Open())
            {
                _database.LastEditedGameProfileId = @event.Id;
            }

            await context.EmitAsync(new ActionSucceededNotification());
        }
コード例 #13
0
        public async Task HandleAsync(DomainEventContext context, ProxyActivationStatusLoadedEvent @event)
        {
            using (await IsolatedDatabaseAccess.Open())
            {
                _database.ProxyActivationStatuses[@event.ApplicationFilePath] = @event.ActivationStatus;
            }

            await context.EmitAsync(new ProxyActivationStatusLoadedNotification(@event.ActivationStatus));
        }
コード例 #14
0
        public async Task HandleAsync(DomainEventContext context, GameStartedEvent @event)
        {
            using (await IsolatedDatabaseAccess.Open())
            {
                _database.GameLaunchingStatuses[@event.FilePath] = @event.Status;
            }

            await context.EmitAsync(new ApplicationStartedNotification(@event.Status));
        }
コード例 #15
0
        public async Task HandleAsync(DomainEventContext context, TextureManagementSettingsUpdatedEvent @event)
        {
            using (await IsolatedDatabaseAccess.Open())
            {
                _database.TextureManagementSettings = @event.Settings;
            }

            await context.EmitAsync(new ActionSucceededNotification());
        }
コード例 #16
0
 public async Task <GamePackage> FindAsync()
 {
     using (await IsolatedDatabaseAccess.Open())
     {
         var id = _database.LastEditedGameProfileId;
         return(id.HasValue
                    ? await _query.FindByGameProfileIdAsync(id.Value)
                    : null);
     }
 }
コード例 #17
0
ファイル: GameRepository.cs プロジェクト: S17L/iGP11
 public async Task SaveAsync(Game game)
 {
     using (await IsolatedDatabaseAccess.Open())
     {
         _context.Games.Remove(entity => entity.Id == game.Id);
         _context.Games.Add(game.Clone());
         _context.LastEditedProfileId = game.ProfileId;
         _context.Commit();
     }
 }
コード例 #18
0
        public async Task HandleAsync(DomainEventContext context, ApplicationSettingsUpdatedEvent @event)
        {
            using (await IsolatedDatabaseAccess.Open())
            {
                _database.ConstantSettings.ApplicationCommunicationPort = @event.ApplicationCommunicationPort;
                _database.ConstantSettings.ProxyCommunicationPort       = @event.ProxyCommunicationPort;
            }

            await context.EmitAsync(new ActionSucceededNotification());
        }
コード例 #19
0
        public async Task <ActivationStatus> FindActivationStatusAsync(string applicationFilePath)
        {
            using (await IsolatedDatabaseAccess.Open())
            {
                ActivationStatus status;
                status = _database.ProxyActivationStatuses.TryGetValue(applicationFilePath, out status)
                             ? status
                             : ActivationStatus.NotRetrievable;

                return(status);
            }
        }
コード例 #20
0
ファイル: GameRepository.cs プロジェクト: S17L/iGP11
        public async Task ChangeGameProfileAsync(AggregateId profileId)
        {
            using (await IsolatedDatabaseAccess.Open())
            {
                if (_context.Games.All(game => game.Profiles.All(profile => profile.Id != profileId)))
                {
                    throw new AggregateRootNotFoundException($"game profile with id: {profileId} could not be found");
                }

                _context.LastEditedProfileId = profileId;
                _context.Commit();
            }
        }
コード例 #21
0
        public async Task <TextureManagementSettings> LoadAsync()
        {
            using (await IsolatedDatabaseAccess.Open())
            {
                var model = _context.TextureConverterSettings;
                if (model == null)
                {
                    throw new AggregateRootNotFoundException("texture management settings not found");
                }

                return(model.Clone());
            }
        }
コード例 #22
0
ファイル: GameRepository.cs プロジェクト: S17L/iGP11
        public async Task <Game> LoadByGameProfileId(AggregateId profileId)
        {
            using (await IsolatedDatabaseAccess.Open())
            {
                var model = FindByProfileId(profileId);
                if (model == null)
                {
                    throw new AggregateRootNotFoundException($"game with profile id: {profileId} could not be found");
                }

                return(model.Clone());
            }
        }
コード例 #23
0
        public async Task <ApplicationSettings> LoadAsync()
        {
            using (await IsolatedDatabaseAccess.Open())
            {
                var model = _context.ApplicationSettings;
                if (model == null)
                {
                    throw new AggregateRootNotFoundException("application settings not found");
                }

                return(model.Clone());
            }
        }
コード例 #24
0
        public async Task <UsageStatistics> LoadAsync()
        {
            using (await IsolatedDatabaseAccess.Open())
            {
                var model = _context.UsageStatistics;
                if (model == null)
                {
                    throw new AggregateRootNotFoundException("usage statistics not found");
                }

                return(model.Clone());
            }
        }
コード例 #25
0
ファイル: InitializeEventHandler.cs プロジェクト: S17L/iGP11
        public async Task HandleAsync(DomainEventContext context, InitializeEvent @event)
        {
            using (await IsolatedDatabaseAccess.Open())
            {
                _database.ConstantSettings.ApplicationCommunicationPort = @event.ApplicationSettings.ApplicationCommunicationPort;
                _database.ConstantSettings.ProxyCommunicationPort       = @event.ApplicationSettings.ProxyCommunicationPort;
                _database.Games.Clear();
                _database.Games.AddRange(@event.Games);
                _database.LastEditedGameProfileId   = @event.LastEditedGameProfileId;
                _database.TextureManagementSettings = @event.TextureManagementSettings;
                _database.UsageStatistics           = @event.UsageStatistics;
            }

            await context.EmitAsync(new ActionSucceededNotification());
        }
コード例 #26
0
        public async Task HandleAsync(DomainEventContext context, GameUpdatedEvent @event)
        {
            using (await IsolatedDatabaseAccess.Open())
            {
                var game = FindGameById(@event.Id);
                if (game == null)
                {
                    throw new EntityNotFoundException($"game with id: {@event.Id} could not be found");
                }

                game.Name     = @event.Name;
                game.FilePath = @event.FilePath;
            }

            await context.EmitAsync(new ActionSucceededNotification());
        }
コード例 #27
0
        public async Task HandleAsync(DomainEventContext context, GameProfileUpdatedEvent @event)
        {
            using (await IsolatedDatabaseAccess.Open())
            {
                var game = FindGameByProfileId(@event.GameProfile.Id);
                if (game == null)
                {
                    throw new EntityNotFoundException($"game with game profile id: {@event.GameProfile.Id} could not be found");
                }

                game.Profiles.Remove(gameProfile => gameProfile.Id == @event.GameProfile.Id);
                game.Profiles.Add(@event.GameProfile);
            }

            await context.EmitAsync(new ActionSucceededNotification());
        }
コード例 #28
0
ファイル: GameRepository.cs プロジェクト: S17L/iGP11
        public async Task RemoveGameAsync(AggregateId gameId)
        {
            using (await IsolatedDatabaseAccess.Open())
            {
                var game = FindById(gameId);
                if (game == null)
                {
                    throw new AggregateRootNotFoundException($"game with id: {gameId} could not be found");
                }

                _context.Games.Remove(game);
                if (game.Profiles.Any(entity => entity.Id == _context.LastEditedProfileId))
                {
                    _context.LastEditedProfileId = FindFirstProfileId();
                }

                _context.Commit();
            }
        }
コード例 #29
0
        public async Task <GamePackage> FindByGameIdAsync(Guid gameId)
        {
            using (await IsolatedDatabaseAccess.Open())
            {
                var game = FindGameById(gameId);
                if (game == null)
                {
                    throw new EntityNotFoundException($"game with id: {gameId} could not be found");
                }

                var gameProfile = FindGameProfileById(game, game.ProfileId);
                if (gameProfile == null)
                {
                    throw new EntityNotFoundException($"game profile with id: {game.ProfileId} could not be found");
                }

                return(new GamePackage(game, gameProfile).Clone());
            }
        }