public async Task <ProxySettings> FindPluginStateAsync() { using (await IsolatedDatabaseAccess.Open()) { return(_database.PluginState); } }
public async Task <AggregateId> LoadGameProfileIdAsync() { using (await IsolatedDatabaseAccess.Open()) { return(_context.LastEditedProfileId); } }
public async Task <IEnumerable <Game> > LoadAllAsync() { using (await IsolatedDatabaseAccess.Open()) { return(_context.Games.Clone()); } }
public async Task <ConstantSettings> FindAsync() { using (await IsolatedDatabaseAccess.Open()) { return(_database.ConstantSettings.Clone()); } }
public async Task <DateTime?> IsFirstRunAsync() { using (await IsolatedDatabaseAccess.Open()) { return(_database.UsageStatistics.FirstLaunchTime); } }
public async Task <TextureManagementSettings> FindAsync() { using (await IsolatedDatabaseAccess.Open()) { return(_database.TextureManagementSettings.Clone()); } }
public async Task SaveAsync(ApplicationSettings applicationSettings) { using (await IsolatedDatabaseAccess.Open()) { _context.ApplicationSettings = applicationSettings.Clone(); _context.Commit(); } }
public async Task SaveAsync(TextureManagementSettings textureManagementSettings) { using (await IsolatedDatabaseAccess.Open()) { _context.TextureConverterSettings = textureManagementSettings.Clone(); _context.Commit(); } }
public async Task SaveAsync(UsageStatistics usageStatistics) { using (await IsolatedDatabaseAccess.Open()) { _context.UsageStatistics = usageStatistics.Clone(); _context.Commit(); } }
public async Task HandleAsync(DomainEventContext context, FirstLaunchIndicatedEvent @event) { using (await IsolatedDatabaseAccess.Open()) { _database.UsageStatistics.FirstLaunchTime = @event.Time; } await context.EmitAsync(new ActionSucceededNotification()); }
public async Task HandleAsync(DomainEventContext context, ProxySettingsLoadedEvent @event) { using (await IsolatedDatabaseAccess.Open()) { _database.ProxySettings = @event.ProxySettings; } await context.EmitAsync(new ProxySettingsLoadedNotification(@event.ProxySettings)); }
public async Task HandleAsync(DomainEventContext context, LastEditedGameProfileUpdatedEvent @event) { using (await IsolatedDatabaseAccess.Open()) { _database.LastEditedGameProfileId = @event.Id; } await context.EmitAsync(new ActionSucceededNotification()); }
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)); }
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)); }
public async Task HandleAsync(DomainEventContext context, TextureManagementSettingsUpdatedEvent @event) { using (await IsolatedDatabaseAccess.Open()) { _database.TextureManagementSettings = @event.Settings; } await context.EmitAsync(new ActionSucceededNotification()); }
public async Task <GamePackage> FindAsync() { using (await IsolatedDatabaseAccess.Open()) { var id = _database.LastEditedGameProfileId; return(id.HasValue ? await _query.FindByGameProfileIdAsync(id.Value) : null); } }
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(); } }
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()); }
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); } }
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(); } }
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()); } }
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()); } }
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()); } }
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()); } }
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()); }
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()); }
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()); }
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(); } }
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()); } }