Cleanup code

This commit is contained in:
Geoffroy BONNEVILLE
2020-04-08 15:27:40 +02:00
parent 4863eb9fae
commit 009382ea03
27 changed files with 142 additions and 138 deletions

View File

@@ -1,5 +1,4 @@
using AutoMapper;
using MediatR;
using MediatR;
using ModernKeePass.Application.Common.Interfaces;
using ModernKeePass.Application.Database.Models;
@@ -10,15 +9,13 @@ namespace ModernKeePass.Application.Database.Queries.GetDatabase
public class GetDatabaseQueryHandler : IRequestHandler<GetDatabaseQuery, DatabaseVm>
{
private readonly IDatabaseProxy _databaseProxy;
private readonly IMapper _mapper;
public GetDatabaseQueryHandler(IDatabaseProxy databaseProxy, IMapper mapper)
public GetDatabaseQueryHandler(IDatabaseProxy databaseProxy)
{
_databaseProxy = databaseProxy;
_mapper = mapper;
}
public DatabaseVm Handle(GetDatabaseQuery request)
public DatabaseVm Handle(GetDatabaseQuery message)
{
var database = new DatabaseVm
{

View File

@@ -23,17 +23,17 @@ namespace ModernKeePass.Application.Database.Queries.OpenDatabase
_file = file;
}
public async Task Handle(OpenDatabaseQuery request)
public async Task Handle(OpenDatabaseQuery message)
{
if (_database.IsOpen) throw new DatabaseOpenException();
var file = await _file.OpenBinaryFile(request.FilePath);
var file = await _file.OpenBinaryFile(message.FilePath);
await _database.Open(file, new Credentials
{
KeyFileContents = !string.IsNullOrEmpty(request.KeyFilePath) ? await _file.OpenBinaryFile(request.KeyFilePath): null,
Password = request.Password
KeyFileContents = !string.IsNullOrEmpty(message.KeyFilePath) ? await _file.OpenBinaryFile(message.KeyFilePath): null,
Password = message.Password
});
_database.FileAccessToken = request.FilePath;
_database.FileAccessToken = message.FilePath;
}
}

View File

@@ -18,7 +18,7 @@ namespace ModernKeePass.Application.Database.Queries.ReOpenDatabase
_file = file;
}
public async Task Handle(ReOpenDatabaseQuery request)
public async Task Handle(ReOpenDatabaseQuery message)
{
if (!_database.IsOpen) throw new DatabaseClosedException();