mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
Cleanup
This commit is contained in:
@@ -1,12 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using ModernKeePass.Domain.Entities;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Application.Common.Interfaces
|
|
||||||
{
|
|
||||||
public interface ICryptographyClient
|
|
||||||
{
|
|
||||||
IEnumerable<BaseEntity> Ciphers { get; }
|
|
||||||
IEnumerable<BaseEntity> KeyDerivations { get; }
|
|
||||||
IEnumerable<string> CompressionAlgorithms { get; }
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,28 +0,0 @@
|
|||||||
using System.Threading.Tasks;
|
|
||||||
using ModernKeePass.Domain.Dtos;
|
|
||||||
using ModernKeePass.Domain.Entities;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Application.Common.Interfaces
|
|
||||||
{
|
|
||||||
public interface IDatabaseProxy
|
|
||||||
{
|
|
||||||
bool IsOpen { get; }
|
|
||||||
GroupEntity RecycleBin { get; set; }
|
|
||||||
BaseEntity Cipher { get; set; }
|
|
||||||
BaseEntity KeyDerivation { get; set; }
|
|
||||||
string Compression { get; set; }
|
|
||||||
|
|
||||||
Task<DatabaseEntity> Open(FileInfo fileInfo, Credentials credentials);
|
|
||||||
Task<DatabaseEntity> Create(FileInfo fileInfo, Credentials credentials);
|
|
||||||
Task SaveDatabase();
|
|
||||||
Task SaveDatabase(FileInfo FileInfo);
|
|
||||||
Task UpdateCredentials(Credentials credentials);
|
|
||||||
void CloseDatabase();
|
|
||||||
Task AddEntry(GroupEntity parentGroup, EntryEntity entity);
|
|
||||||
Task AddGroup(GroupEntity parentGroup, GroupEntity entity);
|
|
||||||
Task UpdateEntry(EntryEntity entity);
|
|
||||||
Task UpdateGroup(GroupEntity entity);
|
|
||||||
Task DeleteEntry(EntryEntity entity);
|
|
||||||
Task DeleteGroup(GroupEntity entity);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,13 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Application.Common.Interfaces
|
|
||||||
{
|
|
||||||
public interface IFileProxy
|
|
||||||
{
|
|
||||||
Task<byte[]> OpenBinaryFile(string path);
|
|
||||||
Task<IList<string>> OpenTextFile(string path);
|
|
||||||
Task WriteBinaryContentsToFile(string path, byte[] contents);
|
|
||||||
void ReleaseFile(string path);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,7 +0,0 @@
|
|||||||
namespace ModernKeePass.Application.Common.Interfaces
|
|
||||||
{
|
|
||||||
public interface IHasSelectableObject
|
|
||||||
{
|
|
||||||
ISelectableModel SelectedItem { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,10 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Application.Common.Interfaces
|
|
||||||
{
|
|
||||||
public interface IImportFormat
|
|
||||||
{
|
|
||||||
Task<List<Dictionary<string, string>>> Import(string path);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,7 +0,0 @@
|
|||||||
namespace ModernKeePass.Application.Common.Interfaces
|
|
||||||
{
|
|
||||||
public interface IIsEnabled
|
|
||||||
{
|
|
||||||
bool IsEnabled { get; }
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,11 +0,0 @@
|
|||||||
using ModernKeePass.Domain.Dtos;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Application.Common.Interfaces
|
|
||||||
{
|
|
||||||
public interface IPasswordProxy
|
|
||||||
{
|
|
||||||
string GeneratePassword(PasswordGenerationOptions options);
|
|
||||||
uint EstimatePasswordComplexity(string password);
|
|
||||||
byte[] GenerateKeyFile(byte[] additionalEntropy);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,9 +0,0 @@
|
|||||||
using System.Reflection;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Application.Common.Interfaces
|
|
||||||
{
|
|
||||||
public interface IProxyInvocationHandler
|
|
||||||
{
|
|
||||||
object Invoke(object proxy, MethodInfo method, object[] parameters);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,15 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using ModernKeePass.Domain.Dtos;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Application.Common.Interfaces
|
|
||||||
{
|
|
||||||
public interface IRecentProxy
|
|
||||||
{
|
|
||||||
int EntryCount { get; }
|
|
||||||
Task<FileInfo> Get(string token);
|
|
||||||
Task<IEnumerable<FileInfo>> GetAll();
|
|
||||||
Task Add(FileInfo recentItem);
|
|
||||||
void ClearAll();
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,7 +0,0 @@
|
|||||||
namespace ModernKeePass.Application.Common.Interfaces
|
|
||||||
{
|
|
||||||
public interface IResourceProxy
|
|
||||||
{
|
|
||||||
string GetResourceValue(string key);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,7 +0,0 @@
|
|||||||
namespace ModernKeePass.Application.Common.Interfaces
|
|
||||||
{
|
|
||||||
public interface ISelectableModel
|
|
||||||
{
|
|
||||||
bool IsSelected { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,8 +0,0 @@
|
|||||||
namespace ModernKeePass.Application.Common.Interfaces
|
|
||||||
{
|
|
||||||
public interface ISettingsProxy
|
|
||||||
{
|
|
||||||
T GetSetting<T>(string property, T defaultValue = default);
|
|
||||||
void PutSetting<T>(string property, T value);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,10 +0,0 @@
|
|||||||
using AutoMapper;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Application.Common.Mappings
|
|
||||||
{
|
|
||||||
|
|
||||||
public interface IMapFrom<T>
|
|
||||||
{
|
|
||||||
void Mapping(Profile profile);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,30 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using AutoMapper;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Application.Common.Mappings
|
|
||||||
{
|
|
||||||
public class MappingProfile : Profile
|
|
||||||
{
|
|
||||||
public MappingProfile()
|
|
||||||
{
|
|
||||||
ApplyMappingsFromAssembly(Assembly.GetExecutingAssembly());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ApplyMappingsFromAssembly(Assembly assembly)
|
|
||||||
{
|
|
||||||
var types = assembly.GetExportedTypes()
|
|
||||||
.Where(t => t.GetInterfaces().Any(i =>
|
|
||||||
i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IMapFrom<>)))
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
foreach (var type in types)
|
|
||||||
{
|
|
||||||
var instance = Activator.CreateInstance(type);
|
|
||||||
var methodInfo = type.GetMethod("Mapping");
|
|
||||||
methodInfo?.Invoke(instance, new object[] { this });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,17 +0,0 @@
|
|||||||
using AutoMapper;
|
|
||||||
using ModernKeePass.Application.Database.Models;
|
|
||||||
using ModernKeePass.Application.Entry.Models;
|
|
||||||
using ModernKeePass.Application.Group.Models;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Application.Common.Mappings
|
|
||||||
{
|
|
||||||
public class MappingProfiles: Profile
|
|
||||||
{
|
|
||||||
public void ApplyMappings()
|
|
||||||
{
|
|
||||||
new DatabaseVm().Mapping(this);
|
|
||||||
new EntryVm().Mapping(this);
|
|
||||||
new GroupVm().Mapping(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,31 +0,0 @@
|
|||||||
using MediatR;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using ModernKeePass.Application.Common.Interfaces;
|
|
||||||
using ModernKeePass.Application.Database.Queries.IsDatabaseOpen;
|
|
||||||
using ModernKeePass.Domain.Exceptions;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Application.Database.Commands.CloseDatabase
|
|
||||||
{
|
|
||||||
public class CloseDatabaseCommand: IRequest
|
|
||||||
{
|
|
||||||
public class CloseDatabaseCommandHandler : IRequestHandler<CloseDatabaseCommand>
|
|
||||||
{
|
|
||||||
private readonly IDatabaseProxy _database;
|
|
||||||
private readonly IMediator _mediator;
|
|
||||||
|
|
||||||
public CloseDatabaseCommandHandler(IDatabaseProxy database, IMediator mediator)
|
|
||||||
{
|
|
||||||
_database = database;
|
|
||||||
_mediator = mediator;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task Handle(CloseDatabaseCommand message, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
var isDatabaseOpen = await _mediator.Send(new IsDatabaseOpenQuery(), cancellationToken);
|
|
||||||
if (isDatabaseOpen) _database.CloseDatabase();
|
|
||||||
else throw new DatabaseClosedException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,48 +0,0 @@
|
|||||||
using MediatR;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using AutoMapper;
|
|
||||||
using ModernKeePass.Application.Common.Interfaces;
|
|
||||||
using ModernKeePass.Application.Database.Models;
|
|
||||||
using ModernKeePass.Application.Database.Queries.IsDatabaseOpen;
|
|
||||||
using ModernKeePass.Application.Group.Models;
|
|
||||||
using ModernKeePass.Domain.Dtos;
|
|
||||||
using ModernKeePass.Domain.Exceptions;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Application.Database.Commands.CreateDatabase
|
|
||||||
{
|
|
||||||
public class CreateDatabaseCommand : IRequest<DatabaseVm>
|
|
||||||
{
|
|
||||||
public FileInfo FileInfo { get; set; }
|
|
||||||
public Credentials Credentials { get; set; }
|
|
||||||
|
|
||||||
public class CreateDatabaseCommandHandler : IRequestHandler<CreateDatabaseCommand, DatabaseVm>
|
|
||||||
{
|
|
||||||
private readonly IDatabaseProxy _database;
|
|
||||||
private readonly IMediator _mediator;
|
|
||||||
private readonly IMapper _mapper;
|
|
||||||
|
|
||||||
public CreateDatabaseCommandHandler(IDatabaseProxy database, IMediator mediator, IMapper mapper)
|
|
||||||
{
|
|
||||||
_database = database;
|
|
||||||
_mediator = mediator;
|
|
||||||
_mapper = mapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<DatabaseVm> Handle(CreateDatabaseCommand message, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
var isDatabaseOpen = await _mediator.Send(new IsDatabaseOpenQuery(), cancellationToken);
|
|
||||||
if (isDatabaseOpen) throw new DatabaseOpenException();
|
|
||||||
|
|
||||||
var database = await _database.Create(message.FileInfo, message.Credentials);
|
|
||||||
var databaseVm = new DatabaseVm
|
|
||||||
{
|
|
||||||
IsOpen = true,
|
|
||||||
Name = database.Name,
|
|
||||||
RootGroup = _mapper.Map<GroupVm>(database.RootGroupEntity)
|
|
||||||
};
|
|
||||||
return databaseVm;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,31 +0,0 @@
|
|||||||
using MediatR;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using ModernKeePass.Application.Common.Interfaces;
|
|
||||||
using ModernKeePass.Application.Database.Queries.IsDatabaseOpen;
|
|
||||||
using ModernKeePass.Domain.Exceptions;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Application.Database.Commands.SaveDatabase
|
|
||||||
{
|
|
||||||
public class SaveDatabaseCommand : IRequest
|
|
||||||
{
|
|
||||||
public class SaveDatabaseCommandHandler : IRequestHandler<SaveDatabaseCommand>
|
|
||||||
{
|
|
||||||
private readonly IDatabaseProxy _database;
|
|
||||||
private readonly IMediator _mediator;
|
|
||||||
|
|
||||||
public SaveDatabaseCommandHandler(IDatabaseProxy database, IMediator mediator)
|
|
||||||
{
|
|
||||||
_database = database;
|
|
||||||
_mediator = mediator;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task Handle(SaveDatabaseCommand message, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
var isDatabaseOpen = await _mediator.Send(new IsDatabaseOpenQuery(), cancellationToken);
|
|
||||||
if (isDatabaseOpen) await _database.SaveDatabase();
|
|
||||||
else throw new DatabaseClosedException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,21 +0,0 @@
|
|||||||
using AutoMapper;
|
|
||||||
using ModernKeePass.Application.Common.Mappings;
|
|
||||||
using ModernKeePass.Application.Group.Models;
|
|
||||||
using ModernKeePass.Domain.Entities;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Application.Database.Models
|
|
||||||
{
|
|
||||||
public class DatabaseVm: IMapFrom<DatabaseEntity>
|
|
||||||
{
|
|
||||||
public bool IsOpen { get; set; }
|
|
||||||
public string Name { get; set; }
|
|
||||||
public GroupVm RootGroup { get; set; }
|
|
||||||
|
|
||||||
public void Mapping(Profile profile)
|
|
||||||
{
|
|
||||||
profile.CreateMap<DatabaseEntity, DatabaseVm>()
|
|
||||||
.ForMember(d => d.Name, opts => opts.MapFrom(s => s.Name))
|
|
||||||
.ForMember(d => d.RootGroup, opts => opts.MapFrom(s => s.RootGroupEntity));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,7 +0,0 @@
|
|||||||
namespace ModernKeePass.Application.Database.Models
|
|
||||||
{
|
|
||||||
public class MainVm
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,24 +0,0 @@
|
|||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using MediatR;
|
|
||||||
using ModernKeePass.Application.Common.Interfaces;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Application.Database.Queries.IsDatabaseOpen
|
|
||||||
{
|
|
||||||
public class IsDatabaseOpenQuery: IRequest<bool>
|
|
||||||
{
|
|
||||||
public class IsDatabaseOpenQueryHandler: IRequestHandler<IsDatabaseOpenQuery, bool>
|
|
||||||
{
|
|
||||||
private readonly IDatabaseProxy _databaseProxy;
|
|
||||||
|
|
||||||
public IsDatabaseOpenQueryHandler(IDatabaseProxy databaseProxy)
|
|
||||||
{
|
|
||||||
_databaseProxy = databaseProxy;
|
|
||||||
}
|
|
||||||
public Task<bool> Handle(IsDatabaseOpenQuery request, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
return Task.FromResult(_databaseProxy.IsOpen);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,48 +0,0 @@
|
|||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using AutoMapper;
|
|
||||||
using MediatR;
|
|
||||||
using ModernKeePass.Application.Common.Interfaces;
|
|
||||||
using ModernKeePass.Application.Database.Models;
|
|
||||||
using ModernKeePass.Application.Database.Queries.IsDatabaseOpen;
|
|
||||||
using ModernKeePass.Application.Group.Models;
|
|
||||||
using ModernKeePass.Domain.Dtos;
|
|
||||||
using ModernKeePass.Domain.Exceptions;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Application.Database.Queries.OpenDatabase
|
|
||||||
{
|
|
||||||
public class OpenDatabaseQuery: IRequest<DatabaseVm>
|
|
||||||
{
|
|
||||||
public FileInfo FileInfo { get; set; }
|
|
||||||
public Credentials Credentials { get; set; }
|
|
||||||
|
|
||||||
public class OpenDatabaseQueryHandler : IRequestHandler<OpenDatabaseQuery, DatabaseVm>
|
|
||||||
{
|
|
||||||
private readonly IMapper _mapper;
|
|
||||||
private readonly IMediator _mediator;
|
|
||||||
private readonly IDatabaseProxy _databaseProxy;
|
|
||||||
|
|
||||||
public OpenDatabaseQueryHandler(IMapper mapper, IMediator mediator, IDatabaseProxy databaseProxy)
|
|
||||||
{
|
|
||||||
_mapper = mapper;
|
|
||||||
_mediator = mediator;
|
|
||||||
_databaseProxy = databaseProxy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<DatabaseVm> Handle(OpenDatabaseQuery request, CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
var isDatabaseOpen = await _mediator.Send(new IsDatabaseOpenQuery(), cancellationToken);
|
|
||||||
if (isDatabaseOpen) throw new DatabaseOpenException();
|
|
||||||
|
|
||||||
var database = await _databaseProxy.Open(request.FileInfo, request.Credentials);
|
|
||||||
var databaseVm = new DatabaseVm
|
|
||||||
{
|
|
||||||
IsOpen = true,
|
|
||||||
Name = database.Name,
|
|
||||||
RootGroup = _mapper.Map<GroupVm>(database.RootGroupEntity)
|
|
||||||
};
|
|
||||||
return databaseVm;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,12 +0,0 @@
|
|||||||
using FluentValidation;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Application.Database.Queries.OpenDatabase
|
|
||||||
{
|
|
||||||
public class OpenDatabaseQueryValidator : AbstractValidator<OpenDatabaseQuery>
|
|
||||||
{
|
|
||||||
public OpenDatabaseQueryValidator()
|
|
||||||
{
|
|
||||||
RuleFor(v => v.Credentials != null && v.FileInfo != null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,13 +0,0 @@
|
|||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Application
|
|
||||||
{
|
|
||||||
public static class DependencyInjection
|
|
||||||
{
|
|
||||||
public static IServiceCollection AddApplication(this IServiceCollection services)
|
|
||||||
{
|
|
||||||
|
|
||||||
return services;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,27 +0,0 @@
|
|||||||
using System.Drawing;
|
|
||||||
using AutoMapper;
|
|
||||||
using ModernKeePass.Application.Common.Mappings;
|
|
||||||
using ModernKeePass.Domain.Entities;
|
|
||||||
using ModernKeePass.Domain.Enums;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Application.Entry.Models
|
|
||||||
{
|
|
||||||
public class EntryVm: IMapFrom<EntryEntity>
|
|
||||||
{
|
|
||||||
public string Id { get; set; }
|
|
||||||
public string Title { get; set; }
|
|
||||||
public Icon Icon { get; set; }
|
|
||||||
public Color ForegroundColor { get; set; }
|
|
||||||
public Color BackgroundColor { get; set; }
|
|
||||||
|
|
||||||
public void Mapping(Profile profile)
|
|
||||||
{
|
|
||||||
profile.CreateMap<EntryEntity, EntryVm>()
|
|
||||||
.ForMember(d => d.Id, opts => opts.MapFrom(s => s.Id))
|
|
||||||
.ForMember(d => d.Title, opts => opts.MapFrom(s => s.Name))
|
|
||||||
.ForMember(d => d.Icon, opts => opts.MapFrom(s => s.Icon))
|
|
||||||
.ForMember(d => d.ForegroundColor, opts => opts.MapFrom(s => s.ForegroundColor))
|
|
||||||
.ForMember(d => d.BackgroundColor, opts => opts.MapFrom(s => s.BackgroundColor));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,33 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Drawing;
|
|
||||||
using AutoMapper;
|
|
||||||
using ModernKeePass.Application.Common.Mappings;
|
|
||||||
using ModernKeePass.Application.Entry.Models;
|
|
||||||
using ModernKeePass.Domain.Entities;
|
|
||||||
using ModernKeePass.Domain.Enums;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Application.Group.Models
|
|
||||||
{
|
|
||||||
public class GroupVm: IMapFrom<GroupEntity>
|
|
||||||
{
|
|
||||||
public string Id { get; set; }
|
|
||||||
public string Title { get; set; }
|
|
||||||
public Icon Icon { get; set; }
|
|
||||||
public Color ForegroundColor { get; set; }
|
|
||||||
public Color BackgroundColor { get; set; }
|
|
||||||
public List<GroupVm> SubGroups { get; set; } = new List<GroupVm>();
|
|
||||||
public List<EntryVm> Entries { get; set; } = new List<EntryVm>();
|
|
||||||
|
|
||||||
public void Mapping(Profile profile)
|
|
||||||
{
|
|
||||||
profile.CreateMap<GroupEntity, GroupVm>()
|
|
||||||
.ForMember(d => d.Id, opts => opts.MapFrom(s => s.Id))
|
|
||||||
.ForMember(d => d.Title, opts => opts.MapFrom(s => s.Name))
|
|
||||||
.ForMember(d => d.Icon, opts => opts.MapFrom(s => s.Icon))
|
|
||||||
.ForMember(d => d.ForegroundColor, opts => opts.MapFrom(s => s.ForegroundColor))
|
|
||||||
.ForMember(d => d.BackgroundColor, opts => opts.MapFrom(s => s.BackgroundColor))
|
|
||||||
.ForMember(d => d.Entries, opts => opts.MapFrom(s => s.Entries))
|
|
||||||
.ForMember(d => d.SubGroups, opts => opts.MapFrom(s => s.SubGroups));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,59 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>netstandard1.2</TargetFramework>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Remove="Common\Mappings\MappingProfile.cs" />
|
|
||||||
<Compile Remove="Services\CryptographyService.cs" />
|
|
||||||
<Compile Remove="Services\DatabaseService.cs" />
|
|
||||||
<Compile Remove="Services\FileService.cs" />
|
|
||||||
<Compile Remove="Services\ImportService.cs" />
|
|
||||||
<Compile Remove="Services\RecentService.cs" />
|
|
||||||
<Compile Remove="Services\ResourceService.cs" />
|
|
||||||
<Compile Remove="Services\SecurityService.cs" />
|
|
||||||
<Compile Remove="Services\SettingsService.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Content Include="Common\Mappings\MappingProfile.cs" />
|
|
||||||
<Content Include="Services\CryptographyService.cs" />
|
|
||||||
<Content Include="Services\DatabaseService.cs" />
|
|
||||||
<Content Include="Services\FileService.cs" />
|
|
||||||
<Content Include="Services\ImportService.cs" />
|
|
||||||
<Content Include="Services\RecentService.cs" />
|
|
||||||
<Content Include="Services\ResourceService.cs" />
|
|
||||||
<Content Include="Services\SecurityService.cs" />
|
|
||||||
<Content Include="Services\SettingsService.cs" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="Entry\Commands\UpdateEntry\" />
|
|
||||||
<Folder Include="Entry\Queries\" />
|
|
||||||
<Folder Include="Group\Commands\CreateEntry\" />
|
|
||||||
<Folder Include="Group\Commands\CreateGroup\" />
|
|
||||||
<Folder Include="Group\Commands\DeleteEntry\" />
|
|
||||||
<Folder Include="Group\Commands\DeleteGroup\" />
|
|
||||||
<Folder Include="Group\Commands\UpdateGroup\" />
|
|
||||||
<Folder Include="Group\Queries\" />
|
|
||||||
<Folder Include="Import\" />
|
|
||||||
<Folder Include="Resources\Commands\" />
|
|
||||||
<Folder Include="Resources\Queries\" />
|
|
||||||
<Folder Include="Settings\" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Autofac" Version="4.9.4" />
|
|
||||||
<PackageReference Include="AutoMapper" Version="6.2.2" />
|
|
||||||
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="2.0.1" />
|
|
||||||
<PackageReference Include="FluentValidation" Version="8.6.2" />
|
|
||||||
<PackageReference Include="MediatR" Version="4.0.1" />
|
|
||||||
<PackageReference Include="Splat" Version="3.0.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\ModernKeePass.Domain\ModernKeePass.Domain.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
@@ -1,22 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using ModernKeePass.Application.Common.Interfaces;
|
|
||||||
using ModernKeePass.Domain.Entities;
|
|
||||||
using ModernKeePass.Domain.Interfaces;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Application.Services
|
|
||||||
{
|
|
||||||
public class CryptographyService : ICryptographyService
|
|
||||||
{
|
|
||||||
private readonly ICryptographyClient _cryptographyClient;
|
|
||||||
public IEnumerable<Entity> Ciphers => _cryptographyClient.Ciphers;
|
|
||||||
|
|
||||||
public IEnumerable<Entity> KeyDerivations => _cryptographyClient.KeyDerivations;
|
|
||||||
|
|
||||||
public IEnumerable<string> CompressionAlgorithms => _cryptographyClient.CompressionAlgorithms;
|
|
||||||
|
|
||||||
public CryptographyService(ICryptographyClient cryptographyClient)
|
|
||||||
{
|
|
||||||
_cryptographyClient = cryptographyClient;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,103 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using ModernKeePass.Application.Common.Interfaces;
|
|
||||||
using ModernKeePass.Domain.Dtos;
|
|
||||||
using ModernKeePass.Domain.Entities;
|
|
||||||
using ModernKeePass.Domain.Interfaces;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Application.Services
|
|
||||||
{
|
|
||||||
public class DatabaseService: IDatabaseService
|
|
||||||
{
|
|
||||||
private readonly IDatabaseProxy _databaseProxy;
|
|
||||||
|
|
||||||
public string Name { get; private set; }
|
|
||||||
public bool IsOpen { get; private set; }
|
|
||||||
public Domain.Entities.GroupEntity RootGroupEntity { get; private set; }
|
|
||||||
public Domain.Entities.GroupEntity RecycleBin
|
|
||||||
{
|
|
||||||
get => _databaseProxy.RecycleBin;
|
|
||||||
set => _databaseProxy.RecycleBin = value;
|
|
||||||
}
|
|
||||||
public Entity Cipher
|
|
||||||
{
|
|
||||||
get => _databaseProxy.Cipher;
|
|
||||||
set => _databaseProxy.Cipher = value;
|
|
||||||
}
|
|
||||||
public Entity KeyDerivation
|
|
||||||
{
|
|
||||||
get => _databaseProxy.KeyDerivation;
|
|
||||||
set => _databaseProxy.KeyDerivation = value;
|
|
||||||
}
|
|
||||||
public string Compression
|
|
||||||
{
|
|
||||||
get => _databaseProxy.Compression;
|
|
||||||
set => _databaseProxy.Compression = value;
|
|
||||||
}
|
|
||||||
public bool IsRecycleBinEnabled => RecycleBin != null;
|
|
||||||
|
|
||||||
public DatabaseService(IDatabaseProxy databaseProxy)
|
|
||||||
{
|
|
||||||
_databaseProxy = databaseProxy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task Open(FileInfo fileInfo, Credentials credentials)
|
|
||||||
{
|
|
||||||
RootGroupEntity = await _databaseProxy.Open(fileInfo, credentials);
|
|
||||||
Name = RootGroupEntity?.Name;
|
|
||||||
IsOpen = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task Create(FileInfo fileInfo, Credentials credentials)
|
|
||||||
{
|
|
||||||
RootGroupEntity = await _databaseProxy.Create(fileInfo, credentials);
|
|
||||||
Name = RootGroupEntity?.Name;
|
|
||||||
IsOpen = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task Save()
|
|
||||||
{
|
|
||||||
await _databaseProxy.SaveDatabase();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task SaveAs(FileInfo fileInfo)
|
|
||||||
{
|
|
||||||
await _databaseProxy.SaveDatabase(fileInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task CreateRecycleBin(Domain.Entities.GroupEntity recycleBinGroupEntity)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task UpdateCredentials(Credentials credentials)
|
|
||||||
{
|
|
||||||
await _databaseProxy.UpdateCredentials(credentials);
|
|
||||||
await Save();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Close()
|
|
||||||
{
|
|
||||||
_databaseProxy.CloseDatabase();
|
|
||||||
IsOpen = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task AddEntity(GroupEntity parentEntity, Entity entity)
|
|
||||||
{
|
|
||||||
await _databaseProxy.AddEntity(parentEntity, entity);
|
|
||||||
//await Save();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task UpdateEntity(Entity entity)
|
|
||||||
{
|
|
||||||
await _databaseProxy.UpdateEntity(entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task DeleteEntity(Entity entity)
|
|
||||||
{
|
|
||||||
if (IsRecycleBinEnabled) await AddEntity(RecycleBin, entity);
|
|
||||||
await _databaseProxy.DeleteEntity(entity);
|
|
||||||
//await Save();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,37 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using ModernKeePass.Application.Common.Interfaces;
|
|
||||||
using ModernKeePass.Domain.Interfaces;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Application.Services
|
|
||||||
{
|
|
||||||
public class FileService: IFileService
|
|
||||||
{
|
|
||||||
private readonly IFileProxy _fileProxy;
|
|
||||||
|
|
||||||
public FileService(IFileProxy fileProxy)
|
|
||||||
{
|
|
||||||
_fileProxy = fileProxy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task<byte[]> OpenBinaryFile(string path)
|
|
||||||
{
|
|
||||||
return _fileProxy.OpenBinaryFile(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task WriteBinaryContentsToFile(string path, byte[] contents)
|
|
||||||
{
|
|
||||||
return _fileProxy.WriteBinaryContentsToFile(path, contents);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task<IList<string>> OpenTextFile(string path)
|
|
||||||
{
|
|
||||||
return _fileProxy.OpenTextFile(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ReleaseFile(string path)
|
|
||||||
{
|
|
||||||
_fileProxy.ReleaseFile(path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,35 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using ModernKeePass.Application.Common.Interfaces;
|
|
||||||
using ModernKeePass.Domain.Entities;
|
|
||||||
using ModernKeePass.Domain.Enums;
|
|
||||||
using ModernKeePass.Domain.Interfaces;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Application.Services
|
|
||||||
{
|
|
||||||
public class ImportService: IImportService
|
|
||||||
{
|
|
||||||
private readonly Func<ImportFormat, IImportFormat> _importFormatProviders;
|
|
||||||
|
|
||||||
public ImportService(Func<ImportFormat, IImportFormat> importFormatProviders)
|
|
||||||
{
|
|
||||||
_importFormatProviders = importFormatProviders;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task Import(ImportFormat format, string filePath, Group group)
|
|
||||||
{
|
|
||||||
var importProvider = _importFormatProviders(format);
|
|
||||||
var data = await importProvider.Import(filePath);
|
|
||||||
|
|
||||||
/*foreach (var entity in data)
|
|
||||||
{
|
|
||||||
var entry = group.AddNewEntry();
|
|
||||||
entry.Name = entity["0"];
|
|
||||||
entry.UserName = entity["1"];
|
|
||||||
entry.Password = entity["2"];
|
|
||||||
if (entity.Count > 3) entry.Url = entity["3"];
|
|
||||||
if (entity.Count > 4) entry.Notes = entity["4"];
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,40 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using ModernKeePass.Application.Common.Interfaces;
|
|
||||||
using ModernKeePass.Domain.Dtos;
|
|
||||||
using ModernKeePass.Domain.Interfaces;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Application.Services
|
|
||||||
{
|
|
||||||
public class RecentService: IRecentService
|
|
||||||
{
|
|
||||||
private readonly IRecentProxy _recentProxy;
|
|
||||||
|
|
||||||
public RecentService(IRecentProxy recentProxy)
|
|
||||||
{
|
|
||||||
_recentProxy = recentProxy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool HasEntries => _recentProxy.EntryCount > 0;
|
|
||||||
|
|
||||||
public async Task<FileInfo> Get(string token)
|
|
||||||
{
|
|
||||||
return await _recentProxy.Get(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<IEnumerable<FileInfo>> GetAll()
|
|
||||||
{
|
|
||||||
return await _recentProxy.GetAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task Add(FileInfo recentItem)
|
|
||||||
{
|
|
||||||
await _recentProxy.Add(recentItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ClearAll()
|
|
||||||
{
|
|
||||||
_recentProxy.ClearAll();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,20 +0,0 @@
|
|||||||
using ModernKeePass.Application.Common.Interfaces;
|
|
||||||
using ModernKeePass.Domain.Interfaces;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Application.Services
|
|
||||||
{
|
|
||||||
public class ResourceService: IResourceService
|
|
||||||
{
|
|
||||||
private readonly IResourceProxy _resourceProxy;
|
|
||||||
|
|
||||||
public ResourceService(IResourceProxy resourceProxy)
|
|
||||||
{
|
|
||||||
_resourceProxy = resourceProxy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GetResourceValue(string key)
|
|
||||||
{
|
|
||||||
return _resourceProxy.GetResourceValue(key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,35 +0,0 @@
|
|||||||
using System.Threading.Tasks;
|
|
||||||
using ModernKeePass.Application.Common.Interfaces;
|
|
||||||
using ModernKeePass.Domain.Dtos;
|
|
||||||
using ModernKeePass.Domain.Interfaces;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Application.Services
|
|
||||||
{
|
|
||||||
public class SecurityService: ISecurityService
|
|
||||||
{
|
|
||||||
private readonly IPasswordProxy _passwordProxy;
|
|
||||||
private readonly IFileService _fileService;
|
|
||||||
|
|
||||||
public SecurityService(IPasswordProxy passwordProxy, IFileService fileService)
|
|
||||||
{
|
|
||||||
_passwordProxy = passwordProxy;
|
|
||||||
_fileService = fileService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GeneratePassword(PasswordGenerationOptions options)
|
|
||||||
{
|
|
||||||
return _passwordProxy.GeneratePassword(options);
|
|
||||||
}
|
|
||||||
|
|
||||||
public uint EstimatePasswordComplexity(string password)
|
|
||||||
{
|
|
||||||
return _passwordProxy.EstimatePasswordComplexity(password);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task GenerateKeyFile(string filePath)
|
|
||||||
{
|
|
||||||
var fileContents = _passwordProxy.GenerateKeyFile(null);
|
|
||||||
await _fileService.WriteBinaryContentsToFile(filePath, fileContents);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,25 +0,0 @@
|
|||||||
using ModernKeePass.Application.Common.Interfaces;
|
|
||||||
using ModernKeePass.Domain.Interfaces;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Application.Services
|
|
||||||
{
|
|
||||||
public class SettingsService: ISettingsService
|
|
||||||
{
|
|
||||||
private readonly ISettingsProxy _settingsProxy;
|
|
||||||
|
|
||||||
public SettingsService(ISettingsProxy settingsProxy)
|
|
||||||
{
|
|
||||||
_settingsProxy = settingsProxy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public T GetSetting<T>(string property, T defaultValue = default)
|
|
||||||
{
|
|
||||||
return _settingsProxy.GetSetting<T>(property, defaultValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void PutSetting<T>(string property, T value)
|
|
||||||
{
|
|
||||||
_settingsProxy.PutSetting<T>(property, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,28 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Domain.AOP
|
|
||||||
{
|
|
||||||
public class NotifyPropertyChangedBase : INotifyPropertyChanged
|
|
||||||
{
|
|
||||||
public event PropertyChangedEventHandler PropertyChanged;
|
|
||||||
|
|
||||||
protected void OnPropertyChanged(string propertyName = "")
|
|
||||||
{
|
|
||||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected bool SetProperty<T>(ref T property, T value, [CallerMemberName] string propertyName = "")
|
|
||||||
{
|
|
||||||
if (EqualityComparer<T>.Default.Equals(property, value))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
property = value;
|
|
||||||
OnPropertyChanged(propertyName);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,9 +0,0 @@
|
|||||||
namespace ModernKeePass.Domain.Dtos
|
|
||||||
{
|
|
||||||
public class Credentials
|
|
||||||
{
|
|
||||||
public string Password { get; set; }
|
|
||||||
public string KeyFilePath { get; set; }
|
|
||||||
// TODO: add Windows Hello
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,8 +0,0 @@
|
|||||||
namespace ModernKeePass.Domain.Dtos
|
|
||||||
{
|
|
||||||
public class FileInfo
|
|
||||||
{
|
|
||||||
public string Name { get; set; }
|
|
||||||
public string Path { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,16 +0,0 @@
|
|||||||
namespace ModernKeePass.Domain.Dtos
|
|
||||||
{
|
|
||||||
public class PasswordGenerationOptions
|
|
||||||
{
|
|
||||||
public int PasswordLength { get; set; }
|
|
||||||
public bool UpperCasePatternSelected { get; set; }
|
|
||||||
public bool LowerCasePatternSelected { get; set; }
|
|
||||||
public bool DigitsPatternSelected { get; set; }
|
|
||||||
public bool SpecialPatternSelected { get; set; }
|
|
||||||
public bool MinusPatternSelected { get; set; }
|
|
||||||
public bool UnderscorePatternSelected { get; set; }
|
|
||||||
public bool SpacePatternSelected { get; set; }
|
|
||||||
public bool BracketsPatternSelected { get; set; }
|
|
||||||
public string CustomChars { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,14 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Drawing;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Domain.Entities
|
|
||||||
{
|
|
||||||
public class BaseEntity
|
|
||||||
{
|
|
||||||
public string Id { get; set; }
|
|
||||||
public string Name { get; set; }
|
|
||||||
public Color ForegroundColor { get; set; }
|
|
||||||
public Color BackgroundColor { get; set; }
|
|
||||||
public DateTimeOffset LastModificationDate { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,9 +0,0 @@
|
|||||||
namespace ModernKeePass.Domain.Entities
|
|
||||||
{
|
|
||||||
public class DatabaseEntity
|
|
||||||
{
|
|
||||||
public string Name { get; set; }
|
|
||||||
|
|
||||||
public GroupEntity RootGroupEntity { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,22 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Drawing;
|
|
||||||
using ModernKeePass.Domain.Enums;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Domain.Entities
|
|
||||||
{
|
|
||||||
public class EntryEntity: BaseEntity
|
|
||||||
{
|
|
||||||
public string UserName { get; set; }
|
|
||||||
public string Password { get; set; }
|
|
||||||
public Uri Url { get; set; }
|
|
||||||
public string Notes { get; set; }
|
|
||||||
public DateTimeOffset ExpirationDate { get; set; }
|
|
||||||
public Color ForegroundColor { get; set; }
|
|
||||||
public Color BackgroundColor { get; set; }
|
|
||||||
public Dictionary<string, string> AdditionalFields { get; set; } = new Dictionary<string, string>();
|
|
||||||
public IEnumerable<EntryEntity> History { get; set; }
|
|
||||||
public Icon Icon { get; set; }
|
|
||||||
public bool HasExpirationDate { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,12 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using ModernKeePass.Domain.Enums;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Domain.Entities
|
|
||||||
{
|
|
||||||
public class GroupEntity : BaseEntity
|
|
||||||
{
|
|
||||||
public List<GroupEntity> SubGroups { get; set; } = new List<GroupEntity>();
|
|
||||||
public List<EntryEntity> Entries { get; set; } = new List<EntryEntity>();
|
|
||||||
public Icon Icon { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,10 +0,0 @@
|
|||||||
namespace ModernKeePass.Domain.Enums
|
|
||||||
{
|
|
||||||
public enum CredentialStatusTypes
|
|
||||||
{
|
|
||||||
Normal = 0,
|
|
||||||
Error = 1,
|
|
||||||
Warning = 3,
|
|
||||||
Success = 5
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,54 +0,0 @@
|
|||||||
namespace ModernKeePass.Domain.Enums
|
|
||||||
{
|
|
||||||
public enum Icon
|
|
||||||
{
|
|
||||||
Delete,
|
|
||||||
Edit,
|
|
||||||
Save,
|
|
||||||
Cancel,
|
|
||||||
Accept,
|
|
||||||
Home,
|
|
||||||
Camera,
|
|
||||||
Setting,
|
|
||||||
Mail,
|
|
||||||
Find,
|
|
||||||
Help,
|
|
||||||
Clock,
|
|
||||||
Crop,
|
|
||||||
World,
|
|
||||||
Flag,
|
|
||||||
PreviewLink,
|
|
||||||
Document,
|
|
||||||
ProtectedDocument,
|
|
||||||
ContactInfo,
|
|
||||||
ViewAll,
|
|
||||||
Rotate,
|
|
||||||
List,
|
|
||||||
Shop,
|
|
||||||
BrowsePhotos,
|
|
||||||
Caption,
|
|
||||||
Repair,
|
|
||||||
Page,
|
|
||||||
Paste,
|
|
||||||
Important,
|
|
||||||
SlideShow,
|
|
||||||
MapDrive,
|
|
||||||
ContactPresence,
|
|
||||||
Contact,
|
|
||||||
Folder,
|
|
||||||
View,
|
|
||||||
Permissions,
|
|
||||||
Map,
|
|
||||||
CellPhone,
|
|
||||||
OutlineStar,
|
|
||||||
Calculator,
|
|
||||||
Library,
|
|
||||||
SyncFolder,
|
|
||||||
GoToStart,
|
|
||||||
ZeroBars,
|
|
||||||
FourBars,
|
|
||||||
Scan,
|
|
||||||
ReportHacked,
|
|
||||||
Stop
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,7 +0,0 @@
|
|||||||
namespace ModernKeePass.Domain.Enums
|
|
||||||
{
|
|
||||||
public enum ImportFormat
|
|
||||||
{
|
|
||||||
CSV
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,7 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Domain.Exceptions
|
|
||||||
{
|
|
||||||
public class DatabaseClosedException: Exception
|
|
||||||
{ }
|
|
||||||
}
|
|
@@ -1,7 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Domain.Exceptions
|
|
||||||
{
|
|
||||||
public class DatabaseOpenException: Exception
|
|
||||||
{ }
|
|
||||||
}
|
|
@@ -1,11 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Domain.Exceptions
|
|
||||||
{
|
|
||||||
public class NavigationException: Exception
|
|
||||||
{
|
|
||||||
public NavigationException(Type pageType) : base($"Failed to load Page {pageType.FullName}")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,14 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Domain.Exceptions
|
|
||||||
{
|
|
||||||
public class SaveException : Exception
|
|
||||||
{
|
|
||||||
public new Exception InnerException { get; }
|
|
||||||
|
|
||||||
public SaveException(Exception exception)
|
|
||||||
{
|
|
||||||
InnerException = exception;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,11 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>netstandard1.2</TargetFramework>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Splat" Version="3.0.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
@@ -1,25 +0,0 @@
|
|||||||
using Autofac;
|
|
||||||
using AutoMapper;
|
|
||||||
using ModernKeePass.Application.Common.Interfaces;
|
|
||||||
using ModernKeePass.Infrastructure.KeePass;
|
|
||||||
using ModernKeePass.Infrastructure.UWP;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Infrastructure
|
|
||||||
{
|
|
||||||
public class DependencyInjection: Module
|
|
||||||
{
|
|
||||||
protected override void Load(ContainerBuilder builder)
|
|
||||||
{
|
|
||||||
builder.RegisterType<KeePassDatabaseClient>().As<IDatabaseProxy>().SingleInstance();
|
|
||||||
builder.RegisterType<KeePassPasswordClient>().As<IPasswordProxy>().SingleInstance();
|
|
||||||
builder.RegisterType<KeePassCryptographyClient>().As<ICryptographyClient>();
|
|
||||||
builder.RegisterType<UwpSettingsClient>().As<ISettingsProxy>();
|
|
||||||
builder.RegisterType<UwpResourceClient>().As<IResourceProxy>();
|
|
||||||
builder.RegisterType<UwpRecentFilesClient>().As<IRecentProxy>();
|
|
||||||
builder.RegisterType<StorageFileClient>().As<IFileProxy>();
|
|
||||||
|
|
||||||
// Register Automapper profiles
|
|
||||||
builder.RegisterType<EntryMappingProfile>().As<Profile>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,39 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using ModernKeePass.Application.Common.Interfaces;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Infrastructure.File
|
|
||||||
{
|
|
||||||
public class CsvImportFormat: IImportFormat
|
|
||||||
{
|
|
||||||
private readonly IFileProxy _fileService;
|
|
||||||
private const bool HasHeaderRow = true;
|
|
||||||
private const char Delimiter = ';';
|
|
||||||
private const char LineDelimiter = '\n';
|
|
||||||
|
|
||||||
public CsvImportFormat(IFileProxy fileService)
|
|
||||||
{
|
|
||||||
_fileService = fileService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<List<Dictionary<string, string>>> Import(string path)
|
|
||||||
{
|
|
||||||
var parsedResult = new List<Dictionary<string, string>>();
|
|
||||||
var content = await _fileService.OpenTextFile(path);
|
|
||||||
foreach (var line in content)
|
|
||||||
{
|
|
||||||
var fields = line.Split(Delimiter);
|
|
||||||
var recordItem = new Dictionary<string, string>();
|
|
||||||
var i = 0;
|
|
||||||
foreach (var field in fields)
|
|
||||||
{
|
|
||||||
recordItem.Add(i.ToString(), field);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
parsedResult.Add(recordItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
return parsedResult;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,76 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using AutoMapper;
|
|
||||||
using ModernKeePass.Domain.Entities;
|
|
||||||
using ModernKeePassLib;
|
|
||||||
using ModernKeePassLib.Security;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Infrastructure.KeePass
|
|
||||||
{
|
|
||||||
public class EntryMappingProfile: Profile
|
|
||||||
{
|
|
||||||
public EntryMappingProfile()
|
|
||||||
{
|
|
||||||
FromModelToDto();
|
|
||||||
FromDtoToModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FromDtoToModel()
|
|
||||||
{
|
|
||||||
CreateMap<PwEntry, EntryEntity>()
|
|
||||||
.ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.Uuid.ToHexString()))
|
|
||||||
.ForMember(dest => dest.Name, opt => opt.MapFrom(src => GetEntryValue(src, PwDefs.TitleField)))
|
|
||||||
.ForMember(dest => dest.UserName, opt => opt.MapFrom(src => GetEntryValue(src, PwDefs.UserNameField)))
|
|
||||||
.ForMember(dest => dest.Password, opt => opt.MapFrom(src => GetEntryValue(src, PwDefs.PasswordField)))
|
|
||||||
.ForMember(dest => dest.Url, opt =>
|
|
||||||
{
|
|
||||||
opt.PreCondition(src => Uri.TryCreate(GetEntryValue(src, PwDefs.UrlField), UriKind.Absolute, out _));
|
|
||||||
opt.MapFrom(src => new Uri(GetEntryValue(src, PwDefs.UrlField)));
|
|
||||||
})
|
|
||||||
.ForMember(dest => dest.Notes, opt => opt.MapFrom(src => GetEntryValue(src, PwDefs.NotesField)))
|
|
||||||
.ForMember(dest => dest.ForegroundColor, opt => opt.MapFrom(src => src.ForegroundColor))
|
|
||||||
.ForMember(dest => dest.BackgroundColor, opt => opt.MapFrom(src => src.BackgroundColor))
|
|
||||||
.ForMember(dest => dest.ExpirationDate, opt => opt.MapFrom(src => new DateTimeOffset(src.ExpiryTime)))
|
|
||||||
.ForMember(dest => dest.HasExpirationDate, opt => opt.MapFrom(src => src.Expires))
|
|
||||||
.ForMember(dest => dest.Icon, opt => opt.MapFrom(src => IconMapper.MapPwIconToIcon(src.IconId)))
|
|
||||||
.ForMember(dest => dest.AdditionalFields, opt => opt.MapFrom(src =>
|
|
||||||
src.Strings.Where(s => !PwDefs.GetStandardFields().Contains(s.Key)).ToDictionary(s => s.Key, s => GetEntryValue(src, s.Key))))
|
|
||||||
.ForMember(dest => dest.LastModificationDate, opt => opt.MapFrom(src => new DateTimeOffset(src.LastModificationTime)));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void FromModelToDto()
|
|
||||||
{
|
|
||||||
CreateMap<EntryEntity, PwEntry>().ConvertUsing<EntryToPwEntryDictionaryConverter>();
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetEntryValue(PwEntry entry, string key) => entry.Strings.GetSafe(key).ReadString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public class EntryToPwEntryDictionaryConverter : ITypeConverter<EntryEntity, PwEntry>
|
|
||||||
{
|
|
||||||
public PwEntry Convert(EntryEntity source, PwEntry destination, ResolutionContext context)
|
|
||||||
{
|
|
||||||
//destination.Uuid = new PwUuid(System.Convert.FromBase64String(source.Id));
|
|
||||||
destination.ExpiryTime = source.ExpirationDate.DateTime;
|
|
||||||
destination.Expires = source.HasExpirationDate;
|
|
||||||
destination.LastModificationTime = source.LastModificationDate.DateTime;
|
|
||||||
destination.BackgroundColor = source.BackgroundColor;
|
|
||||||
destination.ForegroundColor = source.ForegroundColor;
|
|
||||||
destination.IconId = IconMapper.MapIconToPwIcon(source.Icon);
|
|
||||||
SetEntryValue(destination, PwDefs.TitleField, source.Name);
|
|
||||||
SetEntryValue(destination, PwDefs.UserNameField, source.UserName);
|
|
||||||
SetEntryValue(destination, PwDefs.PasswordField, source.Password);
|
|
||||||
SetEntryValue(destination, PwDefs.UrlField, source.Url?.ToString());
|
|
||||||
SetEntryValue(destination, PwDefs.NotesField, source.Notes);
|
|
||||||
foreach (var additionalField in source.AdditionalFields)
|
|
||||||
{
|
|
||||||
SetEntryValue(destination, additionalField.Key, additionalField.Value);
|
|
||||||
}
|
|
||||||
return destination;
|
|
||||||
}
|
|
||||||
private void SetEntryValue(PwEntry entry, string key, string newValue)
|
|
||||||
{
|
|
||||||
if (newValue != null) entry.Strings.Set(key, new ProtectedString(true, newValue));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,126 +0,0 @@
|
|||||||
using ModernKeePass.Domain.Enums;
|
|
||||||
using ModernKeePassLib;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Infrastructure.KeePass
|
|
||||||
{
|
|
||||||
public static class IconMapper
|
|
||||||
{
|
|
||||||
public static Icon MapPwIconToIcon(PwIcon value)
|
|
||||||
{
|
|
||||||
switch (value)
|
|
||||||
{
|
|
||||||
case PwIcon.Key: return Icon.Permissions;
|
|
||||||
case PwIcon.WorldSocket:
|
|
||||||
case PwIcon.World: return Icon.World;
|
|
||||||
case PwIcon.Warning: return Icon.Important;
|
|
||||||
case PwIcon.WorldComputer:
|
|
||||||
case PwIcon.Drive:
|
|
||||||
case PwIcon.DriveWindows:
|
|
||||||
case PwIcon.NetworkServer: return Icon.MapDrive;
|
|
||||||
case PwIcon.MarkedDirectory: return Icon.Map;
|
|
||||||
case PwIcon.UserCommunication: return Icon.ContactInfo;
|
|
||||||
case PwIcon.Parts: return Icon.ViewAll;
|
|
||||||
case PwIcon.Notepad: return Icon.Document;
|
|
||||||
case PwIcon.Identity: return Icon.Contact;
|
|
||||||
case PwIcon.PaperReady: return Icon.SyncFolder;
|
|
||||||
case PwIcon.Digicam: return Icon.Camera;
|
|
||||||
case PwIcon.IRCommunication: return Icon.View;
|
|
||||||
case PwIcon.Energy: return Icon.ZeroBars;
|
|
||||||
case PwIcon.Scanner: return Icon.Scan;
|
|
||||||
case PwIcon.CDRom: return Icon.Rotate;
|
|
||||||
case PwIcon.Monitor: return Icon.Caption;
|
|
||||||
case PwIcon.EMailBox:
|
|
||||||
case PwIcon.EMail: return Icon.Mail;
|
|
||||||
case PwIcon.Configuration: return Icon.Setting;
|
|
||||||
case PwIcon.ClipboardReady: return Icon.Paste;
|
|
||||||
case PwIcon.PaperNew: return Icon.Page;
|
|
||||||
case PwIcon.Screen: return Icon.GoToStart;
|
|
||||||
case PwIcon.EnergyCareful: return Icon.FourBars;
|
|
||||||
case PwIcon.Disk: return Icon.Save;
|
|
||||||
case PwIcon.Console: return Icon.SlideShow;
|
|
||||||
case PwIcon.Printer: return Icon.Scan;
|
|
||||||
case PwIcon.ProgramIcons: return Icon.GoToStart;
|
|
||||||
case PwIcon.Settings:
|
|
||||||
case PwIcon.Tool: return Icon.Repair;
|
|
||||||
case PwIcon.Archive: return Icon.Crop;
|
|
||||||
case PwIcon.Count: return Icon.Calculator;
|
|
||||||
case PwIcon.Clock: return Icon.Clock;
|
|
||||||
case PwIcon.EMailSearch: return Icon.Find;
|
|
||||||
case PwIcon.PaperFlag: return Icon.Flag;
|
|
||||||
case PwIcon.TrashBin: return Icon.Delete;
|
|
||||||
case PwIcon.Expired: return Icon.ReportHacked;
|
|
||||||
case PwIcon.Info: return Icon.Help;
|
|
||||||
case PwIcon.Folder:
|
|
||||||
case PwIcon.FolderOpen:
|
|
||||||
case PwIcon.FolderPackage: return Icon.Folder;
|
|
||||||
case PwIcon.PaperLocked: return Icon.ProtectedDocument;
|
|
||||||
case PwIcon.Checked: return Icon.Accept;
|
|
||||||
case PwIcon.Pen: return Icon.Edit;
|
|
||||||
case PwIcon.Thumbnail: return Icon.BrowsePhotos;
|
|
||||||
case PwIcon.Book: return Icon.Library;
|
|
||||||
case PwIcon.List: return Icon.List;
|
|
||||||
case PwIcon.UserKey: return Icon.ContactPresence;
|
|
||||||
case PwIcon.Home: return Icon.Home;
|
|
||||||
case PwIcon.Star: return Icon.OutlineStar;
|
|
||||||
case PwIcon.Money: return Icon.Shop;
|
|
||||||
case PwIcon.Certificate: return Icon.PreviewLink;
|
|
||||||
case PwIcon.BlackBerry: return Icon.CellPhone;
|
|
||||||
default: return Icon.Stop;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static PwIcon MapIconToPwIcon(Icon value)
|
|
||||||
{
|
|
||||||
switch (value)
|
|
||||||
{
|
|
||||||
case Icon.Delete: return PwIcon.TrashBin;
|
|
||||||
case Icon.Edit: return PwIcon.Pen;
|
|
||||||
case Icon.Save: return PwIcon.Disk;
|
|
||||||
case Icon.Cancel: return PwIcon.Expired;
|
|
||||||
case Icon.Accept: return PwIcon.Checked;
|
|
||||||
case Icon.Home: return PwIcon.Home;
|
|
||||||
case Icon.Camera: return PwIcon.Digicam;
|
|
||||||
case Icon.Setting: return PwIcon.Configuration;
|
|
||||||
case Icon.Mail: return PwIcon.EMail;
|
|
||||||
case Icon.Find: return PwIcon.EMailSearch;
|
|
||||||
case Icon.Help: return PwIcon.Info;
|
|
||||||
case Icon.Clock: return PwIcon.Clock;
|
|
||||||
case Icon.Crop: return PwIcon.Archive;
|
|
||||||
case Icon.World: return PwIcon.World;
|
|
||||||
case Icon.Flag: return PwIcon.PaperFlag;
|
|
||||||
case Icon.PreviewLink: return PwIcon.Certificate;
|
|
||||||
case Icon.Document: return PwIcon.Notepad;
|
|
||||||
case Icon.ProtectedDocument: return PwIcon.PaperLocked;
|
|
||||||
case Icon.ContactInfo: return PwIcon.UserCommunication;
|
|
||||||
case Icon.ViewAll: return PwIcon.Parts;
|
|
||||||
case Icon.Rotate: return PwIcon.CDRom;
|
|
||||||
case Icon.List: return PwIcon.List;
|
|
||||||
case Icon.Shop: return PwIcon.Money;
|
|
||||||
case Icon.BrowsePhotos: return PwIcon.Thumbnail;
|
|
||||||
case Icon.Caption: return PwIcon.Monitor;
|
|
||||||
case Icon.Repair: return PwIcon.Tool;
|
|
||||||
case Icon.Page: return PwIcon.PaperNew;
|
|
||||||
case Icon.Paste: return PwIcon.ClipboardReady;
|
|
||||||
case Icon.Important: return PwIcon.Warning;
|
|
||||||
case Icon.SlideShow: return PwIcon.Console;
|
|
||||||
case Icon.MapDrive: return PwIcon.NetworkServer;
|
|
||||||
case Icon.ContactPresence: return PwIcon.UserKey;
|
|
||||||
case Icon.Contact: return PwIcon.Identity;
|
|
||||||
case Icon.Folder: return PwIcon.Folder;
|
|
||||||
case Icon.View: return PwIcon.IRCommunication;
|
|
||||||
case Icon.Permissions: return PwIcon.Key;
|
|
||||||
case Icon.Map: return PwIcon.MarkedDirectory;
|
|
||||||
case Icon.CellPhone: return PwIcon.BlackBerry;
|
|
||||||
case Icon.OutlineStar: return PwIcon.Star;
|
|
||||||
case Icon.Calculator: return PwIcon.Count;
|
|
||||||
case Icon.Library: return PwIcon.Book;
|
|
||||||
case Icon.SyncFolder: return PwIcon.PaperReady;
|
|
||||||
case Icon.GoToStart: return PwIcon.Screen;
|
|
||||||
case Icon.ZeroBars: return PwIcon.Energy;
|
|
||||||
case Icon.FourBars: return PwIcon.EnergyCareful;
|
|
||||||
case Icon.Scan: return PwIcon.Scanner;
|
|
||||||
default: return PwIcon.Key;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,38 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using ModernKeePass.Application.Common.Interfaces;
|
|
||||||
using ModernKeePass.Domain.Entities;
|
|
||||||
using ModernKeePassLib;
|
|
||||||
using ModernKeePassLib.Cryptography.Cipher;
|
|
||||||
using ModernKeePassLib.Cryptography.KeyDerivation;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Infrastructure.KeePass
|
|
||||||
{
|
|
||||||
public class KeePassCryptographyClient: ICryptographyClient
|
|
||||||
{
|
|
||||||
public IEnumerable<BaseEntity> Ciphers
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
for (var inx = 0; inx < CipherPool.GlobalPool.EngineCount; inx++)
|
|
||||||
{
|
|
||||||
var cipher = CipherPool.GlobalPool[inx];
|
|
||||||
yield return new BaseEntity
|
|
||||||
{
|
|
||||||
Id = cipher.CipherUuid.ToHexString(),
|
|
||||||
Name = cipher.DisplayName
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<BaseEntity> KeyDerivations => KdfPool.Engines.Select(e => new BaseEntity
|
|
||||||
{
|
|
||||||
Id = e.Uuid.ToHexString(),
|
|
||||||
Name = e.Name
|
|
||||||
});
|
|
||||||
|
|
||||||
public IEnumerable<string> CompressionAlgorithms => Enum.GetNames(typeof(PwCompressionAlgorithm)).Take((int) PwCompressionAlgorithm.Count);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,266 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using AutoMapper;
|
|
||||||
using ModernKeePass.Application.Common.Interfaces;
|
|
||||||
using ModernKeePass.Domain.Dtos;
|
|
||||||
using ModernKeePass.Domain.Entities;
|
|
||||||
using ModernKeePass.Domain.Exceptions;
|
|
||||||
using ModernKeePassLib;
|
|
||||||
using ModernKeePassLib.Cryptography.Cipher;
|
|
||||||
using ModernKeePassLib.Cryptography.KeyDerivation;
|
|
||||||
using ModernKeePassLib.Interfaces;
|
|
||||||
using ModernKeePassLib.Keys;
|
|
||||||
using ModernKeePassLib.Serialization;
|
|
||||||
using ModernKeePassLib.Utility;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Infrastructure.KeePass
|
|
||||||
{
|
|
||||||
public class KeePassDatabaseClient: IDatabaseProxy
|
|
||||||
{
|
|
||||||
private readonly ISettingsProxy _settings;
|
|
||||||
private readonly IFileProxy _fileService;
|
|
||||||
private readonly IMapper _mapper;
|
|
||||||
private readonly PwDatabase _pwDatabase = new PwDatabase();
|
|
||||||
private string _fileAccessToken;
|
|
||||||
private CompositeKey _compositeKey;
|
|
||||||
|
|
||||||
public bool IsOpen => (_pwDatabase?.IsOpen).GetValueOrDefault();
|
|
||||||
|
|
||||||
public GroupEntity RecycleBin { get; set; }
|
|
||||||
|
|
||||||
public BaseEntity Cipher
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
var cipher = CipherPool.GlobalPool.GetCipher(_pwDatabase.DataCipherUuid);
|
|
||||||
return new BaseEntity
|
|
||||||
{
|
|
||||||
Id = cipher.CipherUuid.ToHexString(),
|
|
||||||
Name = cipher.DisplayName
|
|
||||||
};
|
|
||||||
}
|
|
||||||
set => _pwDatabase.DataCipherUuid = BuildIdFromString(value.Id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public BaseEntity KeyDerivation
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
var keyDerivation = KdfPool.Engines.First(e => e.Uuid.Equals(_pwDatabase.KdfParameters.KdfUuid));
|
|
||||||
return new BaseEntity
|
|
||||||
{
|
|
||||||
Id = keyDerivation.Uuid.ToHexString(),
|
|
||||||
Name = keyDerivation.Name
|
|
||||||
};
|
|
||||||
}
|
|
||||||
set => _pwDatabase.KdfParameters = KdfPool.Engines
|
|
||||||
.FirstOrDefault(e => e.Uuid.Equals(BuildIdFromString(value.Name)))?.GetDefaultParameters();
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Compression
|
|
||||||
{
|
|
||||||
get => _pwDatabase.Compression.ToString("G");
|
|
||||||
set => _pwDatabase.Compression = (PwCompressionAlgorithm)Enum.Parse(typeof(PwCompressionAlgorithm), value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public KeePassDatabaseClient(ISettingsProxy settings, IFileProxy fileService, IMapper mapper)
|
|
||||||
{
|
|
||||||
_settings = settings;
|
|
||||||
_fileService = fileService;
|
|
||||||
_mapper = mapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<DatabaseEntity> Open(FileInfo fileInfo, Credentials credentials)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_compositeKey = await CreateCompositeKey(credentials);
|
|
||||||
var ioConnection = await BuildConnectionInfo(fileInfo);
|
|
||||||
|
|
||||||
_pwDatabase.Open(ioConnection, _compositeKey, new NullStatusLogger());
|
|
||||||
|
|
||||||
_fileAccessToken = fileInfo.Path;
|
|
||||||
|
|
||||||
return new DatabaseEntity
|
|
||||||
{
|
|
||||||
RootGroupEntity = BuildHierarchy(_pwDatabase.RootGroup)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
catch (InvalidCompositeKeyException ex)
|
|
||||||
{
|
|
||||||
throw new ArgumentException(ex.Message, ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<DatabaseEntity> Create(FileInfo fileInfo, Credentials credentials)
|
|
||||||
{
|
|
||||||
_compositeKey = await CreateCompositeKey(credentials);
|
|
||||||
var ioConnection = await BuildConnectionInfo(fileInfo);
|
|
||||||
|
|
||||||
_pwDatabase.New(ioConnection, _compositeKey);
|
|
||||||
|
|
||||||
var fileFormat = _settings.GetSetting<string>("DefaultFileFormat");
|
|
||||||
switch (fileFormat)
|
|
||||||
{
|
|
||||||
case "4":
|
|
||||||
_pwDatabase.KdfParameters = KdfPool.Get("Argon2").GetDefaultParameters();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
_fileAccessToken = fileInfo.Path;
|
|
||||||
|
|
||||||
// TODO: create sample data depending on settings
|
|
||||||
return new DatabaseEntity
|
|
||||||
{
|
|
||||||
RootGroupEntity = BuildHierarchy(_pwDatabase.RootGroup)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task SaveDatabase()
|
|
||||||
{
|
|
||||||
if (!_pwDatabase.IsOpen) return;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_pwDatabase.Save(new NullStatusLogger());
|
|
||||||
await _fileService.WriteBinaryContentsToFile(_fileAccessToken, _pwDatabase.IOConnectionInfo.Bytes);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
throw new SaveException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task SaveDatabase(FileInfo fileInfo)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var newFileContents = await _fileService.OpenBinaryFile(fileInfo.Path);
|
|
||||||
_pwDatabase.SaveAs(IOConnectionInfo.FromByteArray(newFileContents), true, new NullStatusLogger());
|
|
||||||
await _fileService.WriteBinaryContentsToFile(fileInfo.Path, _pwDatabase.IOConnectionInfo.Bytes);
|
|
||||||
|
|
||||||
_fileService.ReleaseFile(_fileAccessToken);
|
|
||||||
_fileAccessToken = fileInfo.Path;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
throw new SaveException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void CloseDatabase()
|
|
||||||
{
|
|
||||||
_pwDatabase?.Close();
|
|
||||||
_fileService.ReleaseFile(_fileAccessToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task AddEntry(GroupEntity parentGroupEntity, EntryEntity entry)
|
|
||||||
{
|
|
||||||
await Task.Run(() =>
|
|
||||||
{
|
|
||||||
var parentPwGroup = _pwDatabase.RootGroup.FindGroup(BuildIdFromString(parentGroupEntity.Id), true);
|
|
||||||
|
|
||||||
var pwEntry = new PwEntry(true, true);
|
|
||||||
_mapper.Map(entry, pwEntry);
|
|
||||||
parentPwGroup.AddEntry(pwEntry, true);
|
|
||||||
entry.Id = pwEntry.Uuid.ToHexString();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
public async Task AddGroup(GroupEntity parentGroupEntity, GroupEntity group)
|
|
||||||
{
|
|
||||||
await Task.Run(() =>
|
|
||||||
{
|
|
||||||
var parentPwGroup = _pwDatabase.RootGroup.FindGroup(BuildIdFromString(parentGroupEntity.Id), true);
|
|
||||||
|
|
||||||
var pwGroup = new PwGroup(true, true)
|
|
||||||
{
|
|
||||||
Name = group.Name
|
|
||||||
};
|
|
||||||
parentPwGroup.AddGroup(pwGroup, true);
|
|
||||||
group.Id = pwGroup.Uuid.ToHexString();
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task UpdateEntry(EntryEntity entry)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task UpdateGroup(GroupEntity group)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task DeleteEntry(EntryEntity entry)
|
|
||||||
{
|
|
||||||
await Task.Run(() =>
|
|
||||||
{
|
|
||||||
var pwEntry = _pwDatabase.RootGroup.FindEntry(BuildIdFromString(entry.Id), true);
|
|
||||||
var id = pwEntry.Uuid;
|
|
||||||
pwEntry.ParentGroup.Entries.Remove(pwEntry);
|
|
||||||
|
|
||||||
if (_pwDatabase.RecycleBinEnabled)
|
|
||||||
{
|
|
||||||
_pwDatabase.DeletedObjects.Add(new PwDeletedObject(id, DateTime.UtcNow));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
public async Task DeleteGroup(GroupEntity group)
|
|
||||||
{
|
|
||||||
await Task.Run(() =>
|
|
||||||
{
|
|
||||||
var pwGroup = _pwDatabase.RootGroup.FindGroup(BuildIdFromString(group.Id), true);
|
|
||||||
var id = pwGroup.Uuid;
|
|
||||||
pwGroup.ParentGroup.Groups.Remove(pwGroup);
|
|
||||||
|
|
||||||
if (_pwDatabase.RecycleBinEnabled)
|
|
||||||
{
|
|
||||||
_pwDatabase.DeletedObjects.Add(new PwDeletedObject(id, DateTime.UtcNow));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task UpdateCredentials(Credentials credentials)
|
|
||||||
{
|
|
||||||
_pwDatabase.MasterKey = await CreateCompositeKey(credentials);
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task<CompositeKey> CreateCompositeKey(Credentials credentials)
|
|
||||||
{
|
|
||||||
var compositeKey = new CompositeKey();
|
|
||||||
if (!string.IsNullOrEmpty(credentials.Password)) compositeKey.AddUserKey(new KcpPassword(credentials.Password));
|
|
||||||
if (!string.IsNullOrEmpty(credentials.KeyFilePath))
|
|
||||||
{
|
|
||||||
var kcpFileContents = await _fileService.OpenBinaryFile(credentials.KeyFilePath);
|
|
||||||
compositeKey.AddUserKey(new KcpKeyFile(IOConnectionInfo.FromByteArray(kcpFileContents)));
|
|
||||||
}
|
|
||||||
return compositeKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task<IOConnectionInfo> BuildConnectionInfo(FileInfo fileInfo)
|
|
||||||
{
|
|
||||||
var fileContents = await _fileService.OpenBinaryFile(fileInfo.Path);
|
|
||||||
return IOConnectionInfo.FromByteArray(fileContents);
|
|
||||||
}
|
|
||||||
|
|
||||||
private GroupEntity BuildHierarchy(PwGroup pwGroup)
|
|
||||||
{
|
|
||||||
// TODO: build entity hierarchy in an iterative way or implement lazy loading
|
|
||||||
var group = new GroupEntity
|
|
||||||
{
|
|
||||||
Id = pwGroup.Uuid.ToHexString(),
|
|
||||||
Name = pwGroup.Name,
|
|
||||||
Icon = IconMapper.MapPwIconToIcon(pwGroup.IconId),
|
|
||||||
Entries = pwGroup.Entries.Select(e => _mapper.Map<EntryEntity>(e)).ToList(),
|
|
||||||
SubGroups = pwGroup.Groups.Select(BuildHierarchy).ToList()
|
|
||||||
};
|
|
||||||
return group;
|
|
||||||
}
|
|
||||||
|
|
||||||
private PwUuid BuildIdFromString(string id)
|
|
||||||
{
|
|
||||||
return new PwUuid(MemUtil.HexStringToByteArray(id));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,46 +0,0 @@
|
|||||||
using ModernKeePass.Application.Common.Interfaces;
|
|
||||||
using ModernKeePass.Domain.Dtos;
|
|
||||||
using ModernKeePassLib.Cryptography;
|
|
||||||
using ModernKeePassLib.Cryptography.PasswordGenerator;
|
|
||||||
using ModernKeePassLib.Keys;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Infrastructure.KeePass
|
|
||||||
{
|
|
||||||
public class KeePassPasswordClient: IPasswordProxy
|
|
||||||
{
|
|
||||||
public string GeneratePassword(PasswordGenerationOptions options)
|
|
||||||
{
|
|
||||||
var pwProfile = new PwProfile
|
|
||||||
{
|
|
||||||
GeneratorType = PasswordGeneratorType.CharSet,
|
|
||||||
Length = (uint)options.PasswordLength,
|
|
||||||
CharSet = new PwCharSet()
|
|
||||||
};
|
|
||||||
|
|
||||||
if (options.UpperCasePatternSelected) pwProfile.CharSet.Add(PwCharSet.UpperCase);
|
|
||||||
if (options.LowerCasePatternSelected) pwProfile.CharSet.Add(PwCharSet.LowerCase);
|
|
||||||
if (options.DigitsPatternSelected) pwProfile.CharSet.Add(PwCharSet.Digits);
|
|
||||||
if (options.SpecialPatternSelected) pwProfile.CharSet.Add(PwCharSet.Special);
|
|
||||||
if (options.MinusPatternSelected) pwProfile.CharSet.Add('-');
|
|
||||||
if (options.UnderscorePatternSelected) pwProfile.CharSet.Add('_');
|
|
||||||
if (options.SpacePatternSelected) pwProfile.CharSet.Add(' ');
|
|
||||||
if (options.BracketsPatternSelected) pwProfile.CharSet.Add(PwCharSet.Brackets);
|
|
||||||
|
|
||||||
pwProfile.CharSet.Add(options.CustomChars);
|
|
||||||
|
|
||||||
PwGenerator.Generate(out var password, pwProfile, null, new CustomPwGeneratorPool());
|
|
||||||
|
|
||||||
return password.ReadString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public uint EstimatePasswordComplexity(string password)
|
|
||||||
{
|
|
||||||
return QualityEstimation.EstimatePasswordBits(password?.ToCharArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte[] GenerateKeyFile(byte[] additionalEntropy)
|
|
||||||
{
|
|
||||||
return KcpKeyFile.Create(additionalEntropy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
@@ -1,24 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>netstandard1.2</TargetFramework>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="AutoMapper" Version="6.2.2" />
|
|
||||||
<PackageReference Include="ModernKeePassLib" Version="2.44.1" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\ModernKeePass.Application\ModernKeePass.Application.csproj" />
|
|
||||||
<ProjectReference Include="..\ModernKeePass.Domain\ModernKeePass.Domain.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Reference Include="Windows">
|
|
||||||
<HintPath>Libs\Windows.winmd</HintPath>
|
|
||||||
<IsWinMDFile>true</IsWinMDFile>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
@@ -1,38 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Runtime.InteropServices.WindowsRuntime;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Windows.Storage;
|
|
||||||
using Windows.Storage.AccessCache;
|
|
||||||
using ModernKeePass.Application.Common.Interfaces;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Infrastructure.UWP
|
|
||||||
{
|
|
||||||
public class StorageFileClient: IFileProxy
|
|
||||||
{
|
|
||||||
public async Task<byte[]> OpenBinaryFile(string path)
|
|
||||||
{
|
|
||||||
var file = await StorageApplicationPermissions.FutureAccessList.GetFileAsync(path);
|
|
||||||
var result = await FileIO.ReadBufferAsync(file);
|
|
||||||
return result.ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<IList<string>> OpenTextFile(string path)
|
|
||||||
{
|
|
||||||
var file = await StorageApplicationPermissions.FutureAccessList.GetFileAsync(path);
|
|
||||||
var result = await FileIO.ReadLinesAsync(file);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ReleaseFile(string path)
|
|
||||||
{
|
|
||||||
StorageApplicationPermissions.FutureAccessList.Remove(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task WriteBinaryContentsToFile(string path, byte[] contents)
|
|
||||||
{
|
|
||||||
var file = await StorageApplicationPermissions.FutureAccessList.GetFileAsync(path);
|
|
||||||
await FileIO.WriteBytesAsync(file, contents);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,63 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Windows.Storage.AccessCache;
|
|
||||||
using ModernKeePass.Application.Common.Interfaces;
|
|
||||||
using ModernKeePass.Domain.Dtos;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Infrastructure.UWP
|
|
||||||
{
|
|
||||||
public class UwpRecentFilesClient: IRecentProxy
|
|
||||||
{
|
|
||||||
private readonly StorageItemMostRecentlyUsedList _mru = StorageApplicationPermissions.MostRecentlyUsedList;
|
|
||||||
|
|
||||||
public int EntryCount => _mru.Entries.Count;
|
|
||||||
|
|
||||||
public async Task<FileInfo> Get(string token)
|
|
||||||
{
|
|
||||||
var recentEntry = _mru.Entries.FirstOrDefault(e => e.Token == token);
|
|
||||||
var file = await _mru.GetFileAsync(token);
|
|
||||||
StorageApplicationPermissions.FutureAccessList.AddOrReplace(recentEntry.Metadata, file);
|
|
||||||
return new FileInfo
|
|
||||||
{
|
|
||||||
Name = file.DisplayName,
|
|
||||||
Path = recentEntry.Metadata
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<IEnumerable<FileInfo>> GetAll()
|
|
||||||
{
|
|
||||||
var result = new List<FileInfo>();
|
|
||||||
foreach (var entry in _mru.Entries)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var recentItem = await Get(entry.Token);
|
|
||||||
result.Add(recentItem);
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
_mru.Remove(entry.Token);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task Add(FileInfo recentItem)
|
|
||||||
{
|
|
||||||
var file = await StorageApplicationPermissions.FutureAccessList.GetFileAsync(recentItem.Path);
|
|
||||||
_mru.Add(file, recentItem.Path);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ClearAll()
|
|
||||||
{
|
|
||||||
for (var i = _mru.Entries.Count; i > 0; i--)
|
|
||||||
{
|
|
||||||
var entry = _mru.Entries[i];
|
|
||||||
StorageApplicationPermissions.FutureAccessList.Remove(entry.Metadata);
|
|
||||||
_mru.Remove(entry.Token);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,17 +0,0 @@
|
|||||||
using Windows.ApplicationModel.Resources;
|
|
||||||
using ModernKeePass.Application.Common.Interfaces;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Infrastructure.UWP
|
|
||||||
{
|
|
||||||
public class UwpResourceClient: IResourceProxy
|
|
||||||
{
|
|
||||||
private const string ResourceFileName = "CodeBehind";
|
|
||||||
private readonly ResourceLoader _resourceLoader = ResourceLoader.GetForCurrentView();
|
|
||||||
|
|
||||||
public string GetResourceValue(string key)
|
|
||||||
{
|
|
||||||
var resource = _resourceLoader.GetString($"/{ResourceFileName}/{key}");
|
|
||||||
return resource;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,31 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Windows.Foundation.Collections;
|
|
||||||
using Windows.Storage;
|
|
||||||
using ModernKeePass.Application.Common.Interfaces;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Infrastructure.UWP
|
|
||||||
{
|
|
||||||
public class UwpSettingsClient : ISettingsProxy
|
|
||||||
{
|
|
||||||
private readonly IPropertySet _values = ApplicationData.Current.LocalSettings.Values;
|
|
||||||
|
|
||||||
public T GetSetting<T>(string property, T defaultValue = default)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return (T)Convert.ChangeType(_values[property], typeof(T));
|
|
||||||
}
|
|
||||||
catch (InvalidCastException)
|
|
||||||
{
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void PutSetting<T>(string property, T value)
|
|
||||||
{
|
|
||||||
if (_values.ContainsKey(property))
|
|
||||||
_values[property] = value;
|
|
||||||
else _values.Add(property, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -537,6 +537,20 @@
|
|||||||
<Content Include="Assets\Wide310x150Logo.scale-180.png" />
|
<Content Include="Assets\Wide310x150Logo.scale-180.png" />
|
||||||
<Content Include="Assets\Wide310x150Logo.scale-80.png" />
|
<Content Include="Assets\Wide310x150Logo.scale-80.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\ModernKeePass.Application\ModernKeePass.Application.csproj">
|
||||||
|
<Project>{42353562-5e43-459c-8e3e-2f21e575261d}</Project>
|
||||||
|
<Name>ModernKeePass.Application</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\ModernKeePass.Domain\ModernKeePass.Domain.csproj">
|
||||||
|
<Project>{9a0759f1-9069-4841-99e3-3bec44e17356}</Project>
|
||||||
|
<Name>ModernKeePass.Domain</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\ModernKeePass.Infrastructure\ModernKeePass.Infrastructure.csproj">
|
||||||
|
<Project>{09577e4c-4899-45b9-bf80-1803d617ccae}</Project>
|
||||||
|
<Name>ModernKeePass.Infrastructure</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '12.0' ">
|
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '12.0' ">
|
||||||
<VisualStudioVersion>12.0</VisualStudioVersion>
|
<VisualStudioVersion>12.0</VisualStudioVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
Reference in New Issue
Block a user