Removed ModernKeePassLib dependency

Code cleanup
WIP on service replacement and VM use
This commit is contained in:
Geoffroy BONNEVILLE
2020-03-27 18:45:13 +01:00
parent e3638c2f5c
commit 45fcf7e8ab
31 changed files with 383 additions and 277 deletions

View File

@@ -0,0 +1,28 @@
using System.Collections.Generic;
using AutoMapper;
using MediatR;
using ModernKeePass.Application.Common.Interfaces;
using ModernKeePass.Application.Cryptography.Models;
namespace ModernKeePass.Application.Cryptography.Queries.GetCiphers
{
public class GetCiphersQuery: IRequest<IEnumerable<CipherVm>>
{
public class GetCiphersQueryHandler: IRequestHandler<GetCiphersQuery, IEnumerable<CipherVm>>
{
private readonly ICryptographyClient _cryptography;
private readonly IMapper _mapper;
public GetCiphersQueryHandler(ICryptographyClient cryptography, IMapper mapper)
{
_cryptography = cryptography;
_mapper = mapper;
}
public IEnumerable<CipherVm> Handle(GetCiphersQuery message)
{
yield return _mapper.Map<CipherVm>(_cryptography.Ciphers);
}
}
}
}

View File

@@ -0,0 +1,25 @@
using System.Collections.Generic;
using System.Linq;
using MediatR;
using ModernKeePass.Application.Common.Interfaces;
namespace ModernKeePass.Application.Cryptography.Queries.GetCompressions
{
public class GetCompressionsQuery : IRequest<IEnumerable<string>>
{
public class GetCompressionsQueryHandler : IRequestHandler<GetCompressionsQuery, IEnumerable<string>>
{
private readonly ICryptographyClient _cryptography;
public GetCompressionsQueryHandler(ICryptographyClient cryptography)
{
_cryptography = cryptography;
}
public IEnumerable<string> Handle(GetCompressionsQuery message)
{
return _cryptography.CompressionAlgorithms.OrderBy(c => c);
}
}
}
}

View File

@@ -0,0 +1,28 @@
using System.Collections.Generic;
using AutoMapper;
using MediatR;
using ModernKeePass.Application.Common.Interfaces;
using ModernKeePass.Application.Cryptography.Models;
namespace ModernKeePass.Application.Cryptography.Queries.GetKeyDerivations
{
public class GetKeyDerivationsQuery : IRequest<IEnumerable<KeyDerivationVm>>
{
public class GetKeyDerivationsQueryHandler : IRequestHandler<GetKeyDerivationsQuery, IEnumerable<KeyDerivationVm>>
{
private readonly ICryptographyClient _cryptography;
private readonly IMapper _mapper;
public GetKeyDerivationsQueryHandler(ICryptographyClient cryptography, IMapper mapper)
{
_cryptography = cryptography;
_mapper = mapper;
}
public IEnumerable<KeyDerivationVm> Handle(GetKeyDerivationsQuery message)
{
yield return _mapper.Map<KeyDerivationVm>(_cryptography.KeyDerivations);
}
}
}
}