mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
Lots of bug corrections
WIP - still lots left
This commit is contained in:
@@ -39,7 +39,6 @@
|
|||||||
<None Include="project.json" />
|
<None Include="project.json" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="ApplicationModule.cs" />
|
|
||||||
<Compile Include="Common\Interfaces\ICryptographyClient.cs" />
|
<Compile Include="Common\Interfaces\ICryptographyClient.cs" />
|
||||||
<Compile Include="Common\Interfaces\IDatabaseProxy.cs" />
|
<Compile Include="Common\Interfaces\IDatabaseProxy.cs" />
|
||||||
<Compile Include="Common\Interfaces\IEntityVm.cs" />
|
<Compile Include="Common\Interfaces\IEntityVm.cs" />
|
||||||
|
@@ -1,32 +0,0 @@
|
|||||||
using System.Reflection;
|
|
||||||
using Autofac;
|
|
||||||
using AutoMapper;
|
|
||||||
using MediatR;
|
|
||||||
using ModernKeePass.Application.Common.Mappings;
|
|
||||||
using Module = Autofac.Module;
|
|
||||||
|
|
||||||
namespace ModernKeePass.Application
|
|
||||||
{
|
|
||||||
public class ApplicationModule: Module
|
|
||||||
{
|
|
||||||
protected override void Load(ContainerBuilder builder)
|
|
||||||
{
|
|
||||||
// Register Automapper profiles
|
|
||||||
builder.RegisterType<MappingProfile>().As<Profile>();
|
|
||||||
|
|
||||||
// Register Mediatr
|
|
||||||
builder
|
|
||||||
.RegisterType<Mediator>()
|
|
||||||
.As<IMediator>()
|
|
||||||
.InstancePerLifetimeScope();
|
|
||||||
|
|
||||||
// request & notification handlers
|
|
||||||
builder.Register<SingleInstanceFactory>(context =>
|
|
||||||
{
|
|
||||||
var c = context.Resolve<IComponentContext>();
|
|
||||||
return t => c.Resolve(t);
|
|
||||||
});
|
|
||||||
builder.RegisterAssemblyTypes(typeof(ApplicationModule).GetTypeInfo().Assembly).AsImplementedInterfaces();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,4 +1,6 @@
|
|||||||
using ModernKeePass.Domain.Enums;
|
using System.Collections.Generic;
|
||||||
|
using ModernKeePass.Application.Group.Models;
|
||||||
|
using ModernKeePass.Domain.Enums;
|
||||||
|
|
||||||
namespace ModernKeePass.Application.Common.Interfaces
|
namespace ModernKeePass.Application.Common.Interfaces
|
||||||
{
|
{
|
||||||
@@ -7,5 +9,7 @@ namespace ModernKeePass.Application.Common.Interfaces
|
|||||||
string Id { get; set; }
|
string Id { get; set; }
|
||||||
string Title { get; set; }
|
string Title { get; set; }
|
||||||
Icon Icon { get; set; }
|
Icon Icon { get; set; }
|
||||||
|
List<GroupVm> Breadcrumb { get; }
|
||||||
|
GroupVm ParentGroup { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,9 +1,12 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using MediatR;
|
using MediatR;
|
||||||
using ModernKeePass.Application.Common.Interfaces;
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
using ModernKeePass.Application.Entry.Models;
|
||||||
using ModernKeePass.Application.Group.Models;
|
using ModernKeePass.Application.Group.Models;
|
||||||
using ModernKeePass.Domain.Dtos;
|
using ModernKeePass.Domain.Dtos;
|
||||||
|
using ModernKeePass.Domain.Entities;
|
||||||
using ModernKeePass.Domain.Exceptions;
|
using ModernKeePass.Domain.Exceptions;
|
||||||
|
|
||||||
namespace ModernKeePass.Application.Database.Queries.OpenDatabase
|
namespace ModernKeePass.Application.Database.Queries.OpenDatabase
|
||||||
@@ -39,7 +42,29 @@ namespace ModernKeePass.Application.Database.Queries.OpenDatabase
|
|||||||
KeyFilePath = request.KeyFilePath,
|
KeyFilePath = request.KeyFilePath,
|
||||||
Password = request.Password
|
Password = request.Password
|
||||||
});
|
});
|
||||||
return _mapper.Map<GroupVm>(rootGroup);
|
return BuildHierarchy(null, rootGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
private GroupVm BuildHierarchy(GroupVm parentGroup, GroupEntity groupEntity)
|
||||||
|
{
|
||||||
|
var groupVm = _mapper.Map<GroupVm>(groupEntity);
|
||||||
|
groupVm.ParentGroup = parentGroup;
|
||||||
|
if (parentGroup != null)
|
||||||
|
{
|
||||||
|
groupVm.Breadcrumb.AddRange(parentGroup.Breadcrumb);
|
||||||
|
groupVm.Breadcrumb.Add(parentGroup);
|
||||||
|
}
|
||||||
|
groupVm.Entries = groupEntity.Entries.Select(e =>
|
||||||
|
{
|
||||||
|
var entry = _mapper.Map<EntryVm>(e);
|
||||||
|
entry.ParentGroup = groupVm;
|
||||||
|
entry.Breadcrumb.AddRange(groupVm.Breadcrumb);
|
||||||
|
entry.Breadcrumb.Add(groupVm);
|
||||||
|
return entry;
|
||||||
|
}).OrderBy(e => e.Title).ToList();
|
||||||
|
groupVm.SubGroups = groupEntity.SubGroups.Select(g => BuildHierarchy(groupVm, g)).ToList();
|
||||||
|
|
||||||
|
return groupVm;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -13,6 +13,7 @@ namespace ModernKeePass.Application.Entry.Models
|
|||||||
public class EntryVm: IEntityVm, IMapFrom<EntryEntity>
|
public class EntryVm: IEntityVm, IMapFrom<EntryEntity>
|
||||||
{
|
{
|
||||||
public GroupVm ParentGroup { get; set; }
|
public GroupVm ParentGroup { get; set; }
|
||||||
|
public List<GroupVm> Breadcrumb { get; } = new List<GroupVm>();
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
public string Username { get; set; }
|
public string Username { get; set; }
|
||||||
@@ -24,14 +25,19 @@ namespace ModernKeePass.Application.Entry.Models
|
|||||||
public Icon Icon { get; set; }
|
public Icon Icon { get; set; }
|
||||||
public Color ForegroundColor { get; set; }
|
public Color ForegroundColor { get; set; }
|
||||||
public Color BackgroundColor { get; set; }
|
public Color BackgroundColor { get; set; }
|
||||||
public bool HasExpirationDate { get; internal set; }
|
public bool HasExpirationDate { get; set; }
|
||||||
public DateTimeOffset ExpirationDate { get; internal set; }
|
public DateTimeOffset ExpirationDate { get; set; }
|
||||||
public DateTimeOffset ModificationDate { get; internal set; }
|
public DateTimeOffset ModificationDate { get; set; }
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return ModificationDate.ToString("g");
|
||||||
|
}
|
||||||
|
|
||||||
public void Mapping(Profile profile)
|
public void Mapping(Profile profile)
|
||||||
{
|
{
|
||||||
profile.CreateMap<EntryEntity, EntryVm>()
|
profile.CreateMap<EntryEntity, EntryVm>()
|
||||||
.ForMember(d => d.ParentGroup, opts => opts.MapFrom(s => s.Parent))
|
//.ForMember(d => d.ParentGroup, opts => opts.MapFrom(s => s.Parent))
|
||||||
.ForMember(d => d.Id, opts => opts.MapFrom(s => s.Id))
|
.ForMember(d => d.Id, opts => opts.MapFrom(s => s.Id))
|
||||||
.ForMember(d => d.Title, opts => opts.MapFrom(s => s.Name))
|
.ForMember(d => d.Title, opts => opts.MapFrom(s => s.Name))
|
||||||
.ForMember(d => d.Username, opts => opts.MapFrom(s => s.UserName))
|
.ForMember(d => d.Username, opts => opts.MapFrom(s => s.UserName))
|
||||||
|
@@ -16,6 +16,7 @@ namespace ModernKeePass.Application.Group.Models
|
|||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
public Icon Icon { get; set; }
|
public Icon Icon { get; set; }
|
||||||
|
public List<GroupVm> Breadcrumb { get; } = new List<GroupVm>();
|
||||||
public List<GroupVm> SubGroups { get; set; }
|
public List<GroupVm> SubGroups { get; set; }
|
||||||
public List<EntryVm> Entries { get; set; }
|
public List<EntryVm> Entries { get; set; }
|
||||||
public bool IsSelected { get; set; }
|
public bool IsSelected { get; set; }
|
||||||
@@ -28,12 +29,12 @@ namespace ModernKeePass.Application.Group.Models
|
|||||||
public void Mapping(Profile profile)
|
public void Mapping(Profile profile)
|
||||||
{
|
{
|
||||||
profile.CreateMap<GroupEntity, GroupVm>()
|
profile.CreateMap<GroupEntity, GroupVm>()
|
||||||
.ForMember(d => d.ParentGroup, opts => opts.MapFrom(s => s.Parent))
|
//.ForMember(d => d.ParentGroup, opts => opts.MapFrom(s => s.Parent))
|
||||||
.ForMember(d => d.Id, opts => opts.MapFrom(s => s.Id))
|
.ForMember(d => d.Id, opts => opts.MapFrom(s => s.Id))
|
||||||
.ForMember(d => d.Title, opts => opts.MapFrom(s => s.Name))
|
.ForMember(d => d.Title, opts => opts.MapFrom(s => s.Name))
|
||||||
.ForMember(d => d.Icon, opts => opts.MapFrom(s => s.Icon))
|
.ForMember(d => d.Icon, opts => opts.MapFrom(s => s.Icon));
|
||||||
.ForMember(d => d.Entries, opts => opts.MapFrom(s => s.Entries.OrderBy(e => e.Name)))
|
//.ForMember(d => d.Entries, opts => opts.MapFrom(s => s.Entries.OrderBy(e => e.Name)))
|
||||||
.ForMember(d => d.SubGroups, opts => opts.MapFrom(s => s.SubGroups));
|
//.ForMember(d => d.SubGroups, opts => opts.MapFrom(s => s.SubGroups));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,10 +1,7 @@
|
|||||||
{
|
{
|
||||||
"supports": {},
|
"supports": {},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Autofac": "4.9.4",
|
"AutoMapper": "5.2.0",
|
||||||
"Autofac.Extensions.DependencyInjection": "4.4.0",
|
|
||||||
"AutoMapper": "6.0.2",
|
|
||||||
"AutoMapper.Extensions.Microsoft.DependencyInjection": "2.0.1",
|
|
||||||
"FluentValidation": "8.6.2",
|
"FluentValidation": "8.6.2",
|
||||||
"MediatR": "3.0.1",
|
"MediatR": "3.0.1",
|
||||||
"MediatR.Extensions.Microsoft.DependencyInjection": "2.0.0",
|
"MediatR.Extensions.Microsoft.DependencyInjection": "2.0.0",
|
||||||
|
@@ -7,6 +7,7 @@ namespace ModernKeePass.Domain.Entities
|
|||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public GroupEntity Parent { get; set; }
|
public GroupEntity Parent { get; set; }
|
||||||
|
public string ParentId { get; set; }
|
||||||
public DateTimeOffset LastModificationDate { get; set; }
|
public DateTimeOffset LastModificationDate { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -42,7 +42,6 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Common\MachineDateTime.cs" />
|
<Compile Include="Common\MachineDateTime.cs" />
|
||||||
<Compile Include="DependencyInjection.cs" />
|
<Compile Include="DependencyInjection.cs" />
|
||||||
<Compile Include="InfrastructureModule.cs" />
|
|
||||||
<Compile Include="File\CsvImportFormat.cs" />
|
<Compile Include="File\CsvImportFormat.cs" />
|
||||||
<Compile Include="KeePass\EntryFieldMapper.cs" />
|
<Compile Include="KeePass\EntryFieldMapper.cs" />
|
||||||
<Compile Include="KeePass\EntryMappingProfile.cs" />
|
<Compile Include="KeePass\EntryMappingProfile.cs" />
|
||||||
|
@@ -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 InfrastructureModule: 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>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -19,7 +19,7 @@ namespace ModernKeePass.Infrastructure.KeePass
|
|||||||
{
|
{
|
||||||
Uri url;
|
Uri url;
|
||||||
CreateMap<PwEntry, EntryEntity>()
|
CreateMap<PwEntry, EntryEntity>()
|
||||||
//.ForMember(dest => dest.Parent, opt => opt.MapFrom(src => src.ParentGroup))
|
.ForMember(dest => dest.ParentId, opt => opt.MapFrom(src => src.ParentGroup.Uuid.ToHexString()))
|
||||||
.ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.Uuid.ToHexString()))
|
.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.Name, opt => opt.MapFrom(src => GetEntryValue(src, PwDefs.TitleField)))
|
||||||
.ForMember(dest => dest.UserName, opt => opt.MapFrom(src => GetEntryValue(src, PwDefs.UserNameField)))
|
.ForMember(dest => dest.UserName, opt => opt.MapFrom(src => GetEntryValue(src, PwDefs.UserNameField)))
|
||||||
@@ -38,7 +38,6 @@ namespace ModernKeePass.Infrastructure.KeePass
|
|||||||
.ForMember(dest => dest.AdditionalFields, opt => opt.MapFrom(src =>
|
.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))))
|
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)));
|
.ForMember(dest => dest.LastModificationDate, opt => opt.MapFrom(src => new DateTimeOffset(src.LastModificationTime)));
|
||||||
//.MaxDepth(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FromModelToDto()
|
private void FromModelToDto()
|
||||||
|
@@ -15,14 +15,13 @@ namespace ModernKeePass.Infrastructure.KeePass
|
|||||||
private void FromDtoToModel()
|
private void FromDtoToModel()
|
||||||
{
|
{
|
||||||
CreateMap<PwGroup, GroupEntity>()
|
CreateMap<PwGroup, GroupEntity>()
|
||||||
//.ForMember(d => d.Parent, opts => opts.MapFrom(s => s.ParentGroup))
|
.ForMember(d => d.ParentId, opts => opts.MapFrom(s => s.ParentGroup.Uuid.ToHexString()))
|
||||||
.ForMember(d => d.Id, opts => opts.MapFrom(s => s.Uuid.ToHexString()))
|
.ForMember(d => d.Id, opts => opts.MapFrom(s => s.Uuid.ToHexString()))
|
||||||
.ForMember(d => d.Name, opts => opts.MapFrom(s => s.Name))
|
.ForMember(d => d.Name, opts => opts.MapFrom(s => s.Name))
|
||||||
.ForMember(d => d.Icon, opts => opts.MapFrom(s => IconMapper.MapPwIconToIcon(s.IconId)))
|
.ForMember(d => d.Icon, opts => opts.MapFrom(s => IconMapper.MapPwIconToIcon(s.IconId)))
|
||||||
.ForMember(d => d.LastModificationDate, opts => opts.MapFrom(s => s.LastModificationTime))
|
.ForMember(d => d.LastModificationDate, opts => opts.MapFrom(s => s.LastModificationTime));
|
||||||
.ForMember(d => d.Entries, opts => opts.MapFrom(s => s.Entries))
|
//.ForMember(d => d.Entries, opts => opts.MapFrom(s => s.Entries))
|
||||||
.ForMember(d => d.SubGroups, opts => opts.MapFrom(s => s.Groups));
|
//.ForMember(d => d.SubGroups, opts => opts.MapFrom(s => s.Groups));
|
||||||
//.MaxDepth(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FromModelToDto()
|
private void FromModelToDto()
|
||||||
|
@@ -95,7 +95,7 @@ namespace ModernKeePass.Infrastructure.KeePass
|
|||||||
_credentials = credentials;
|
_credentials = credentials;
|
||||||
_fileAccessToken = fileInfo.Path;
|
_fileAccessToken = fileInfo.Path;
|
||||||
|
|
||||||
RootGroup = _mapper.Map<GroupEntity>(_pwDatabase.RootGroup);
|
RootGroup = BuildHierarchy(null, _pwDatabase.RootGroup);
|
||||||
return RootGroup;
|
return RootGroup;
|
||||||
}
|
}
|
||||||
catch (InvalidCompositeKeyException ex)
|
catch (InvalidCompositeKeyException ex)
|
||||||
@@ -125,7 +125,7 @@ namespace ModernKeePass.Infrastructure.KeePass
|
|||||||
|
|
||||||
_fileAccessToken = fileInfo.Path;
|
_fileAccessToken = fileInfo.Path;
|
||||||
|
|
||||||
RootGroup = _mapper.Map<GroupEntity>(_pwDatabase.RootGroup);
|
RootGroup = BuildHierarchy(null, _pwDatabase.RootGroup);
|
||||||
return RootGroup;
|
return RootGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,6 +337,28 @@ namespace ModernKeePass.Infrastructure.KeePass
|
|||||||
var fileContents = await _fileService.OpenBinaryFile(fileInfo.Path);
|
var fileContents = await _fileService.OpenBinaryFile(fileInfo.Path);
|
||||||
return IOConnectionInfo.FromByteArray(fileContents);
|
return IOConnectionInfo.FromByteArray(fileContents);
|
||||||
}
|
}
|
||||||
|
private GroupEntity BuildHierarchy(GroupEntity parentGroup, PwGroup pwGroup)
|
||||||
|
{
|
||||||
|
var group = _mapper.Map<GroupEntity>(pwGroup);
|
||||||
|
group.Parent = parentGroup;
|
||||||
|
group.Entries = pwGroup.Entries.Select(e =>
|
||||||
|
{
|
||||||
|
var entry = _mapper.Map<EntryEntity>(e);
|
||||||
|
entry.Parent = group;
|
||||||
|
return entry;
|
||||||
|
}).ToList();
|
||||||
|
group.SubGroups = pwGroup.Groups.Select(g => BuildHierarchy(group, g)).ToList();
|
||||||
|
|
||||||
|
/*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)
|
private PwUuid BuildIdFromString(string id)
|
||||||
{
|
{
|
||||||
|
@@ -1,8 +1,7 @@
|
|||||||
{
|
{
|
||||||
"supports": {},
|
"supports": {},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"AutoMapper": "6.0.2",
|
"AutoMapper": "5.2.0",
|
||||||
"AutoMapper.Extensions.Microsoft.DependencyInjection": "2.0.1",
|
|
||||||
"Microsoft.NETCore.Portable.Compatibility": "1.0.1",
|
"Microsoft.NETCore.Portable.Compatibility": "1.0.1",
|
||||||
"ModernKeePassLib": "2.44.2",
|
"ModernKeePassLib": "2.44.2",
|
||||||
"NETStandard.Library": "2.0.3"
|
"NETStandard.Library": "2.0.3"
|
||||||
|
@@ -3,7 +3,6 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using ModernKeePass.Application.Common.Interfaces;
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
using ModernKeePass.Application.Services;
|
|
||||||
using ModernKeePass.Domain.Dtos;
|
using ModernKeePass.Domain.Dtos;
|
||||||
using ModernKeePass.Domain.Entities;
|
using ModernKeePass.Domain.Entities;
|
||||||
using ModernKeePass.Domain.Interfaces;
|
using ModernKeePass.Domain.Interfaces;
|
||||||
@@ -27,7 +26,7 @@ namespace ModernKeePass.KeePassDatabaseTests
|
|||||||
[SetUp]
|
[SetUp]
|
||||||
public void SetUp()
|
public void SetUp()
|
||||||
{
|
{
|
||||||
var settingsService = Substitute.For<ISettingsService>();
|
var dateTime = Substitute.For<IDateTime>();
|
||||||
var fileProxy = Substitute.For<IFileProxy>();
|
var fileProxy = Substitute.For<IFileProxy>();
|
||||||
fileProxy.OpenBinaryFile(Arg.Any<string>()).Returns(async parameters =>
|
fileProxy.OpenBinaryFile(Arg.Any<string>()).Returns(async parameters =>
|
||||||
{
|
{
|
||||||
@@ -42,9 +41,8 @@ namespace ModernKeePass.KeePassDatabaseTests
|
|||||||
var contents = (byte[]) parameters[1];
|
var contents = (byte[]) parameters[1];
|
||||||
await stream.WriteAsync(contents, 0, contents.Length);
|
await stream.WriteAsync(contents, 0, contents.Length);
|
||||||
});
|
});
|
||||||
var fileService = new FileService(fileProxy);
|
|
||||||
var mapper = new Mapper(new MapperConfiguration(cfg => { cfg.AddProfile(typeof(EntryMappingProfile)); }));
|
var mapper = new Mapper(new MapperConfiguration(cfg => { cfg.AddProfile(typeof(EntryMappingProfile)); }));
|
||||||
_database = new KeePassDatabaseClient(settingsService, fileService, mapper);
|
_database = new KeePassDatabaseClient(fileProxy, mapper, dateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TearDown]
|
[TearDown]
|
||||||
@@ -57,12 +55,12 @@ namespace ModernKeePass.KeePassDatabaseTests
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task TestOpen()
|
public async Task TestOpen()
|
||||||
{
|
{
|
||||||
var FileInfo = new FileInfo
|
var fileInfo = new FileInfo
|
||||||
{
|
{
|
||||||
Path = Path.Combine(Directory.GetCurrentDirectory(), "Data", "TestDatabase.kdbx")
|
Path = Path.Combine(Directory.GetCurrentDirectory(), "Data", "TestDatabase.kdbx")
|
||||||
};
|
};
|
||||||
|
|
||||||
var rootGroup = await _database.Open(FileInfo, _credentials);
|
var rootGroup = await _database.Open(fileInfo, _credentials);
|
||||||
Assert.That(rootGroup.Name, Is.EqualTo("TestDatabase"));
|
Assert.That(rootGroup.Name, Is.EqualTo("TestDatabase"));
|
||||||
Assert.That(rootGroup.Entries.Count(), Is.EqualTo(2));
|
Assert.That(rootGroup.Entries.Count(), Is.EqualTo(2));
|
||||||
}
|
}
|
||||||
@@ -95,7 +93,7 @@ namespace ModernKeePass.KeePassDatabaseTests
|
|||||||
};
|
};
|
||||||
|
|
||||||
await _database.Open(originalFileInfo, _credentials);
|
await _database.Open(originalFileInfo, _credentials);
|
||||||
await _database.SaveDatabase(_fileInfo);
|
await _database.SaveDatabase(_fileInfo.Path);
|
||||||
_database.CloseDatabase();
|
_database.CloseDatabase();
|
||||||
|
|
||||||
Assert.DoesNotThrowAsync(async () => { await _database.Open(_fileInfo, _credentials); });
|
Assert.DoesNotThrowAsync(async () => { await _database.Open(_fileInfo, _credentials); });
|
||||||
@@ -115,8 +113,8 @@ namespace ModernKeePass.KeePassDatabaseTests
|
|||||||
var newGroup = new GroupEntity {Name = "New Group Test"};
|
var newGroup = new GroupEntity {Name = "New Group Test"};
|
||||||
|
|
||||||
var rootGroup = await _database.Open(originalFileInfo, _credentials);
|
var rootGroup = await _database.Open(originalFileInfo, _credentials);
|
||||||
await _database.AddEntity(rootGroup, newGroup);
|
await _database.AddGroup(rootGroup.Id, newGroup.Id);
|
||||||
await _database.SaveDatabase(_fileInfo);
|
await _database.SaveDatabase(_fileInfo.Path);
|
||||||
_database.CloseDatabase();
|
_database.CloseDatabase();
|
||||||
rootGroup = await _database.Open(_fileInfo, _credentials);
|
rootGroup = await _database.Open(_fileInfo, _credentials);
|
||||||
|
|
||||||
@@ -142,8 +140,8 @@ namespace ModernKeePass.KeePassDatabaseTests
|
|||||||
};
|
};
|
||||||
|
|
||||||
var rootGroup = await _database.Open(originalFileInfo, _credentials);
|
var rootGroup = await _database.Open(originalFileInfo, _credentials);
|
||||||
await _database.AddEntity(rootGroup, newEntry);
|
await _database.AddEntry(rootGroup.Id, newEntry.Id);
|
||||||
await _database.SaveDatabase(_fileInfo);
|
await _database.SaveDatabase(_fileInfo.Path);
|
||||||
_database.CloseDatabase();
|
_database.CloseDatabase();
|
||||||
rootGroup = await _database.Open(_fileInfo, _credentials);
|
rootGroup = await _database.Open(_fileInfo, _credentials);
|
||||||
|
|
||||||
|
@@ -16,9 +16,9 @@ using ModernKeePass.Application.Group.Commands.RemoveEntry;
|
|||||||
using ModernKeePass.Application.Security.Commands.GeneratePassword;
|
using ModernKeePass.Application.Security.Commands.GeneratePassword;
|
||||||
using ModernKeePass.Application.Security.Queries.EstimatePasswordComplexity;
|
using ModernKeePass.Application.Security.Queries.EstimatePasswordComplexity;
|
||||||
using ModernKeePass.Common;
|
using ModernKeePass.Common;
|
||||||
|
using ModernKeePass.Domain.Enums;
|
||||||
using ModernKeePass.Domain.Interfaces;
|
using ModernKeePass.Domain.Interfaces;
|
||||||
using ModernKeePass.Interfaces;
|
using ModernKeePass.Interfaces;
|
||||||
using ModernKeePass.Services;
|
|
||||||
|
|
||||||
namespace ModernKeePass.ViewModels
|
namespace ModernKeePass.ViewModels
|
||||||
{
|
{
|
||||||
@@ -38,21 +38,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
public string CustomChars { get; set; } = string.Empty;
|
public string CustomChars { get; set; } = string.Empty;
|
||||||
public string Id => _entry.Id;
|
public string Id => _entry.Id;
|
||||||
|
|
||||||
public IEnumerable<Application.Group.Models.GroupVm> BreadCrumb
|
public IEnumerable<Application.Group.Models.GroupVm> BreadCrumb => _entry.Breadcrumb;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
var groups = new Stack<Application.Group.Models.GroupVm>();
|
|
||||||
var group = _entry.ParentGroup;
|
|
||||||
while (group.ParentGroup != null)
|
|
||||||
{
|
|
||||||
group = group.ParentGroup;
|
|
||||||
groups.Push(group);
|
|
||||||
}
|
|
||||||
|
|
||||||
return groups;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines if the Entry is current or from history
|
/// Determines if the Entry is current or from history
|
||||||
@@ -72,14 +58,21 @@ namespace ModernKeePass.ViewModels
|
|||||||
public string Title
|
public string Title
|
||||||
{
|
{
|
||||||
get { return _entry.Title; }
|
get { return _entry.Title; }
|
||||||
set { _mediator.Send(new SetFieldValueCommand { EntryId = Id, FieldName = nameof(Title), FieldValue = value}); }
|
set
|
||||||
|
{
|
||||||
|
_mediator.Send(new SetFieldValueCommand { EntryId = Id, FieldName = nameof(Title), FieldValue = value}).Wait();
|
||||||
|
_entry.Title = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public string UserName
|
public string UserName
|
||||||
{
|
{
|
||||||
get { return _entry.Username; }
|
get { return _entry.Username; }
|
||||||
set { _mediator.Send(new SetFieldValueCommand { EntryId = Id, FieldName = nameof(UserName), FieldValue = value }); }
|
set
|
||||||
|
{
|
||||||
|
_mediator.Send(new SetFieldValueCommand { EntryId = Id, FieldName = nameof(UserName), FieldValue = value }).Wait();
|
||||||
|
_entry.Username = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Password
|
public string Password
|
||||||
@@ -87,7 +80,8 @@ namespace ModernKeePass.ViewModels
|
|||||||
get { return _entry.Password; }
|
get { return _entry.Password; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_mediator.Send(new SetFieldValueCommand { EntryId = Id, FieldName = nameof(Password), FieldValue = value });
|
_mediator.Send(new SetFieldValueCommand { EntryId = Id, FieldName = nameof(Password), FieldValue = value }).Wait();
|
||||||
|
_entry.Password = value;
|
||||||
OnPropertyChanged();
|
OnPropertyChanged();
|
||||||
OnPropertyChanged(nameof(PasswordComplexityIndicator));
|
OnPropertyChanged(nameof(PasswordComplexityIndicator));
|
||||||
}
|
}
|
||||||
@@ -95,14 +89,22 @@ namespace ModernKeePass.ViewModels
|
|||||||
|
|
||||||
public string Url
|
public string Url
|
||||||
{
|
{
|
||||||
get { return _entry.Url.ToString();}
|
get { return _entry.Url?.ToString(); }
|
||||||
set { _mediator.Send(new SetFieldValueCommand { EntryId = Id, FieldName = nameof(Url), FieldValue = value }); }
|
set
|
||||||
|
{
|
||||||
|
_mediator.Send(new SetFieldValueCommand { EntryId = Id, FieldName = nameof(Url), FieldValue = value }).Wait();
|
||||||
|
_entry.Url = new Uri(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Notes
|
public string Notes
|
||||||
{
|
{
|
||||||
get { return _entry.Notes; }
|
get { return _entry.Notes; }
|
||||||
set { _mediator.Send(new SetFieldValueCommand { EntryId = Id, FieldName = nameof(Notes), FieldValue = value }); }
|
set
|
||||||
|
{
|
||||||
|
_mediator.Send(new SetFieldValueCommand { EntryId = Id, FieldName = nameof(Notes), FieldValue = value }).Wait();
|
||||||
|
_entry.Notes = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Symbol Icon
|
public Symbol Icon
|
||||||
@@ -112,7 +114,11 @@ namespace ModernKeePass.ViewModels
|
|||||||
if (HasExpired) return Symbol.ReportHacked;
|
if (HasExpired) return Symbol.ReportHacked;
|
||||||
return (Symbol) _entry.Icon;
|
return (Symbol) _entry.Icon;
|
||||||
}
|
}
|
||||||
set { _mediator.Send(new SetFieldValueCommand { EntryId = Id, FieldName = nameof(Icon), FieldValue = value }); }
|
set
|
||||||
|
{
|
||||||
|
_mediator.Send(new SetFieldValueCommand { EntryId = Id, FieldName = nameof(Icon), FieldValue = value }).Wait();
|
||||||
|
_entry.Icon = (Icon)value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public DateTimeOffset ExpiryDate
|
public DateTimeOffset ExpiryDate
|
||||||
@@ -121,7 +127,8 @@ namespace ModernKeePass.ViewModels
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (!HasExpirationDate) return;
|
if (!HasExpirationDate) return;
|
||||||
_mediator.Send(new SetFieldValueCommand { EntryId = Id, FieldName = "ExpirationDate", FieldValue = value.Date });
|
_mediator.Send(new SetFieldValueCommand { EntryId = Id, FieldName = "ExpirationDate", FieldValue = value.Date }).Wait();
|
||||||
|
_entry.ExpirationDate = value.Date;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,10 +138,49 @@ namespace ModernKeePass.ViewModels
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (!HasExpirationDate) return;
|
if (!HasExpirationDate) return;
|
||||||
_mediator.Send(new SetFieldValueCommand { EntryId = Id, FieldName = "ExpirationDate", FieldValue = ExpiryDate.Date.Add(value) });
|
_mediator.Send(new SetFieldValueCommand { EntryId = Id, FieldName = "ExpirationDate", FieldValue = ExpiryDate.Date.Add(value) }).Wait();
|
||||||
|
_entry.ExpirationDate = _entry.ExpirationDate.Date.Add(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool HasExpirationDate
|
||||||
|
{
|
||||||
|
get { return _entry.HasExpirationDate; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_mediator.Send(new SetFieldValueCommand { EntryId = Id, FieldName = nameof(HasExpirationDate), FieldValue = value }).Wait();
|
||||||
|
_entry.HasExpirationDate = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Color? BackgroundColor
|
||||||
|
{
|
||||||
|
get { return _entry?.BackgroundColor; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value != null)
|
||||||
|
{
|
||||||
|
_mediator.Send(new SetFieldValueCommand { EntryId = Id, FieldName = nameof(BackgroundColor), FieldValue = value }).Wait();
|
||||||
|
_entry.BackgroundColor = (Color)value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Color? ForegroundColor
|
||||||
|
{
|
||||||
|
get { return _entry?.ForegroundColor; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value != null)
|
||||||
|
{
|
||||||
|
_mediator.Send(new SetFieldValueCommand { EntryId = Id, FieldName = nameof(ForegroundColor), FieldValue = value }).Wait();
|
||||||
|
_entry.ForegroundColor = (Color)value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public IEnumerable<Application.Entry.Models.EntryVm> History => _entry.History;
|
||||||
|
|
||||||
public bool IsEditMode
|
public bool IsEditMode
|
||||||
{
|
{
|
||||||
get { return IsSelected && _isEditMode; }
|
get { return IsSelected && _isEditMode; }
|
||||||
@@ -164,36 +210,6 @@ namespace ModernKeePass.ViewModels
|
|||||||
OnPropertyChanged();
|
OnPropertyChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public bool HasExpirationDate
|
|
||||||
{
|
|
||||||
get { return _entry.HasExpirationDate; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_mediator.Send(new SetFieldValueCommand {EntryId = Id, FieldName = nameof(HasExpirationDate), FieldValue = value});
|
|
||||||
OnPropertyChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<Application.Entry.Models.EntryVm> History => _entry.History;
|
|
||||||
|
|
||||||
|
|
||||||
public Color? BackgroundColor
|
|
||||||
{
|
|
||||||
get { return _entry?.BackgroundColor; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value != null) _entry.BackgroundColor = (Color) value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color? ForegroundColor
|
|
||||||
{
|
|
||||||
get { return _entry?.ForegroundColor; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value != null) _entry.ForegroundColor = (Color)value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool CanRestore => _entry.ParentGroup == _database.RecycleBin;
|
public bool CanRestore => _entry.ParentGroup == _database.RecycleBin;
|
||||||
|
|
||||||
@@ -203,7 +219,6 @@ namespace ModernKeePass.ViewModels
|
|||||||
|
|
||||||
private readonly Application.Entry.Models.EntryVm _entry;
|
private readonly Application.Entry.Models.EntryVm _entry;
|
||||||
private readonly IMediator _mediator;
|
private readonly IMediator _mediator;
|
||||||
private readonly IResourceService _resource;
|
|
||||||
private readonly DatabaseVm _database;
|
private readonly DatabaseVm _database;
|
||||||
private bool _isEditMode;
|
private bool _isEditMode;
|
||||||
private bool _isRevealPassword;
|
private bool _isRevealPassword;
|
||||||
@@ -212,13 +227,12 @@ namespace ModernKeePass.ViewModels
|
|||||||
|
|
||||||
public EntryVm() { }
|
public EntryVm() { }
|
||||||
|
|
||||||
internal EntryVm(Application.Entry.Models.EntryVm entry, bool isNewEntry = false) : this(entry, App.Mediator, new ResourcesService(), isNewEntry) { }
|
internal EntryVm(Application.Entry.Models.EntryVm entry, bool isNewEntry = false) : this(entry, App.Mediator, isNewEntry) { }
|
||||||
|
|
||||||
public EntryVm(Application.Entry.Models.EntryVm entry, IMediator mediator, IResourceService resource, bool isNewEntry = false)
|
public EntryVm(Application.Entry.Models.EntryVm entry, IMediator mediator, bool isNewEntry = false)
|
||||||
{
|
{
|
||||||
_entry = entry;
|
_entry = entry;
|
||||||
_mediator = mediator;
|
_mediator = mediator;
|
||||||
_resource = resource;
|
|
||||||
_database = _mediator.Send(new GetDatabaseQuery()).GetAwaiter().GetResult();
|
_database = _mediator.Send(new GetDatabaseQuery()).GetAwaiter().GetResult();
|
||||||
_isEditMode = isNewEntry;
|
_isEditMode = isNewEntry;
|
||||||
if (isNewEntry) GeneratePassword().GetAwaiter().GetResult();
|
if (isNewEntry) GeneratePassword().GetAwaiter().GetResult();
|
||||||
@@ -246,7 +260,6 @@ namespace ModernKeePass.ViewModels
|
|||||||
OnPropertyChanged(nameof(IsRevealPasswordEnabled));
|
OnPropertyChanged(nameof(IsRevealPasswordEnabled));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public async Task MarkForDelete(string recycleBinTitle)
|
public async Task MarkForDelete(string recycleBinTitle)
|
||||||
{
|
{
|
||||||
if (_database.IsRecycleBinEnabled && _database.RecycleBin == null)
|
if (_database.IsRecycleBinEnabled && _database.RecycleBin == null)
|
||||||
@@ -274,12 +287,5 @@ namespace ModernKeePass.ViewModels
|
|||||||
{
|
{
|
||||||
return _entry;
|
return _entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return IsSelected ?
|
|
||||||
_resource.GetResourceValue("EntryCurrent") :
|
|
||||||
_entry.ModificationDate.ToString("g");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -103,21 +103,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
set { SetProperty(ref _isMenuClosed, value); }
|
set { SetProperty(ref _isMenuClosed, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Application.Group.Models.GroupVm> BreadCrumb
|
public IEnumerable<Application.Group.Models.GroupVm> BreadCrumb => _group.Breadcrumb;
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
var groups = new Stack<Application.Group.Models.GroupVm>();
|
|
||||||
var group = _group;
|
|
||||||
while (group.ParentGroup != null)
|
|
||||||
{
|
|
||||||
group = group.ParentGroup;
|
|
||||||
groups.Push(group);
|
|
||||||
}
|
|
||||||
|
|
||||||
return groups;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ICommand SaveCommand { get; }
|
public ICommand SaveCommand { get; }
|
||||||
public ICommand SortEntriesCommand { get; }
|
public ICommand SortEntriesCommand { get; }
|
||||||
@@ -210,11 +196,6 @@ namespace ModernKeePass.ViewModels
|
|||||||
await _mediator.Send(new DeleteGroupCommand { Group = _group });
|
await _mediator.Send(new DeleteGroupCommand { Group = _group });
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return Title;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task SortEntriesAsync()
|
private async Task SortEntriesAsync()
|
||||||
{
|
{
|
||||||
await _mediator.Send(new SortEntriesCommand {Group = _group});
|
await _mediator.Send(new SortEntriesCommand {Group = _group});
|
||||||
|
@@ -30,7 +30,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
get { return _database.IsRecycleBinEnabled; }
|
get { return _database.IsRecycleBinEnabled; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_mediator.Send(new SetHasRecycleBinCommand {HasRecycleBin = value}).GetAwaiter().GetResult();
|
_mediator.Send(new SetHasRecycleBinCommand {HasRecycleBin = value}).Wait();
|
||||||
OnPropertyChanged(nameof(HasRecycleBin));
|
OnPropertyChanged(nameof(HasRecycleBin));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,7 +40,7 @@ namespace ModernKeePass.ViewModels
|
|||||||
get { return _database.RecycleBin == null; }
|
get { return _database.RecycleBin == null; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value) _mediator.Send(new SetRecycleBinCommand { RecycleBin = null }).GetAwaiter().GetResult();
|
if (value) _mediator.Send(new SetRecycleBinCommand { RecycleBin = null }).Wait();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,19 +53,19 @@ namespace ModernKeePass.ViewModels
|
|||||||
public CipherVm SelectedCipher
|
public CipherVm SelectedCipher
|
||||||
{
|
{
|
||||||
get { return Ciphers.FirstOrDefault(c => c.Id == _database.CipherId); }
|
get { return Ciphers.FirstOrDefault(c => c.Id == _database.CipherId); }
|
||||||
set { _mediator.Send(new SetCipherCommand {CipherId = value.Id}).GetAwaiter().GetResult(); }
|
set { _mediator.Send(new SetCipherCommand {CipherId = value.Id}).Wait(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public string SelectedCompression
|
public string SelectedCompression
|
||||||
{
|
{
|
||||||
get { return Compressions.FirstOrDefault(c => c == _database.Compression); }
|
get { return Compressions.FirstOrDefault(c => c == _database.Compression); }
|
||||||
set { _mediator.Send(new SetCompressionCommand {Compression = value}).GetAwaiter().GetResult(); }
|
set { _mediator.Send(new SetCompressionCommand {Compression = value}).Wait(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public KeyDerivationVm SelectedKeyDerivation
|
public KeyDerivationVm SelectedKeyDerivation
|
||||||
{
|
{
|
||||||
get { return KeyDerivations.FirstOrDefault(c => c.Id == _database.KeyDerivationId); }
|
get { return KeyDerivations.FirstOrDefault(c => c.Id == _database.KeyDerivationId); }
|
||||||
set { _mediator.Send(new SetKeyDerivationCommand {KeyDerivationId = value.Id}).GetAwaiter().GetResult(); }
|
set { _mediator.Send(new SetKeyDerivationCommand {KeyDerivationId = value.Id}).Wait(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public int CipherIndex
|
/*public int CipherIndex
|
||||||
|
@@ -55,7 +55,7 @@ namespace ModernKeePass.Views
|
|||||||
{
|
{
|
||||||
var vm = e.Parameter as Application.Group.Models.GroupVm;
|
var vm = e.Parameter as Application.Group.Models.GroupVm;
|
||||||
if (vm != null)
|
if (vm != null)
|
||||||
DataContext = vm;
|
DataContext = new GroupVm(vm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,13 +103,13 @@ namespace ModernKeePass.Views
|
|||||||
e.DestinationItem.Item = e.SourceItem.Item;
|
e.DestinationItem.Item = e.SourceItem.Item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void CreateEntry_ButtonClick(object sender, RoutedEventArgs e)
|
private async void CreateEntry_ButtonClick(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
Frame.Navigate(typeof(EntryDetailPage), Model.AddNewEntry());
|
Frame.Navigate(typeof(EntryDetailPage), await Model.AddNewEntry());
|
||||||
}
|
}
|
||||||
private void CreateGroup_ButtonClick(object sender, RoutedEventArgs e)
|
private async void CreateGroup_ButtonClick(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
Frame.Navigate(typeof(GroupDetailPage), Model.AddNewGroup());
|
Frame.Navigate(typeof(GroupDetailPage), await Model.AddNewGroup());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GridView_DragItemsStarting(object sender, DragItemsStartingEventArgs e)
|
private void GridView_DragItemsStarting(object sender, DragItemsStartingEventArgs e)
|
||||||
|
@@ -28,9 +28,9 @@ namespace ModernKeePass.Views
|
|||||||
_mainFrame = e.Parameter as Frame;
|
_mainFrame = e.Parameter as Frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveButton_OnClick(object sender, RoutedEventArgs e)
|
private async void SaveButton_OnClick(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
Model.Save();
|
await Model.Save();
|
||||||
_mainFrame.Navigate(typeof(MainPage));
|
_mainFrame.Navigate(typeof(MainPage));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ namespace ModernKeePass.Views
|
|||||||
|
|
||||||
var file = await savePicker.PickSaveFileAsync();
|
var file = await savePicker.PickSaveFileAsync();
|
||||||
if (file == null) return;
|
if (file == null) return;
|
||||||
Model.Save(file);
|
await Model.Save(file);
|
||||||
|
|
||||||
_mainFrame.Navigate(typeof(MainPage));
|
_mainFrame.Navigate(typeof(MainPage));
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
</ItemsControl.ItemsPanel>
|
</ItemsControl.ItemsPanel>
|
||||||
<ItemsControl.Resources>
|
<ItemsControl.Resources>
|
||||||
<DataTemplate x:Name="FirstItemTemplate">
|
<DataTemplate x:Name="FirstItemTemplate">
|
||||||
<HyperlinkButton Foreground="{StaticResource MainColor}" Content="{Binding Name}" Style="{StaticResource MainColorHyperlinkButton}" FontWeight="Light" FontSize="12" Padding="0">
|
<HyperlinkButton Foreground="{StaticResource MainColor}" Content="{Binding Title}" Style="{StaticResource MainColorHyperlinkButton}" FontWeight="Light" FontSize="12" Padding="0">
|
||||||
<interactivity:Interaction.Behaviors>
|
<interactivity:Interaction.Behaviors>
|
||||||
<core:EventTriggerBehavior EventName="Click">
|
<core:EventTriggerBehavior EventName="Click">
|
||||||
<core:NavigateToPageAction Parameter="{Binding}" TargetPage="ModernKeePass.Views.GroupDetailPage" />
|
<core:NavigateToPageAction Parameter="{Binding}" TargetPage="ModernKeePass.Views.GroupDetailPage" />
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
<Viewbox MaxHeight="10" Margin="0,2,0,0">
|
<Viewbox MaxHeight="10" Margin="0,2,0,0">
|
||||||
<SymbolIcon Symbol="Forward" />
|
<SymbolIcon Symbol="Forward" />
|
||||||
</Viewbox>
|
</Viewbox>
|
||||||
<HyperlinkButton Foreground="{StaticResource MainColor}" Content="{Binding Name}" Style="{StaticResource MainColorHyperlinkButton}" FontWeight="Light" FontSize="12" Padding="0">
|
<HyperlinkButton Foreground="{StaticResource MainColor}" Content="{Binding Title}" Style="{StaticResource MainColorHyperlinkButton}" FontWeight="Light" FontSize="12" Padding="0">
|
||||||
<interactivity:Interaction.Behaviors>
|
<interactivity:Interaction.Behaviors>
|
||||||
<core:EventTriggerBehavior EventName="Click">
|
<core:EventTriggerBehavior EventName="Click">
|
||||||
<core:NavigateToPageAction Parameter="{Binding}" TargetPage="ModernKeePass.Views.GroupDetailPage" />
|
<core:NavigateToPageAction Parameter="{Binding}" TargetPage="ModernKeePass.Views.GroupDetailPage" />
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Windows.UI.Xaml;
|
using Windows.UI.Xaml;
|
||||||
using ModernKeePass.Interfaces;
|
using ModernKeePass.Application.Common.Interfaces;
|
||||||
|
|
||||||
// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236
|
// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236
|
||||||
|
|
||||||
@@ -13,17 +13,17 @@ namespace ModernKeePass.Views.UserControls
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<IVmEntity> ItemsSource
|
public IEnumerable<IEntityVm> ItemsSource
|
||||||
{
|
{
|
||||||
get { return (IEnumerable<IVmEntity>)GetValue(ItemsSourceProperty); }
|
get { return (IEnumerable<IEntityVm>)GetValue(ItemsSourceProperty); }
|
||||||
set { SetValue(ItemsSourceProperty, value); }
|
set { SetValue(ItemsSourceProperty, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static readonly DependencyProperty ItemsSourceProperty =
|
public static readonly DependencyProperty ItemsSourceProperty =
|
||||||
DependencyProperty.Register(
|
DependencyProperty.Register(
|
||||||
"ItemsSource",
|
"ItemsSource",
|
||||||
typeof(IEnumerable<IVmEntity>),
|
typeof(IEnumerable<IEntityVm>),
|
||||||
typeof(BreadCrumbUserControl),
|
typeof(BreadCrumbUserControl),
|
||||||
new PropertyMetadata(new Stack<IVmEntity>(), (o, args) => { }));
|
new PropertyMetadata(new Stack<IEntityVm>(), (o, args) => { }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -388,15 +388,12 @@
|
|||||||
</Page>
|
</Page>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Autofac">
|
<Reference Include="AutoMapper, Version=5.2.0.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\..\..\..\.nuget\packages\Autofac\4.9.4\lib\netstandard1.1\Autofac.dll</HintPath>
|
<HintPath>..\packages\AutoMapper.5.2.0\lib\netstandard1.1\AutoMapper.dll</HintPath>
|
||||||
</Reference>
|
|
||||||
<Reference Include="AutoMapper, Version=6.0.2.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
|
|
||||||
<HintPath>..\packages\AutoMapper.6.0.2\lib\netstandard1.1\AutoMapper.dll</HintPath>
|
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="AutoMapper.Extensions.Microsoft.DependencyInjection, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="AutoMapper.Extensions.Microsoft.DependencyInjection, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\AutoMapper.Extensions.Microsoft.DependencyInjection.2.0.1\lib\netstandard1.1\AutoMapper.Extensions.Microsoft.DependencyInjection.dll</HintPath>
|
<HintPath>..\packages\AutoMapper.Extensions.Microsoft.DependencyInjection.1.2.0\lib\netstandard1.1\AutoMapper.Extensions.Microsoft.DependencyInjection.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="BouncyCastle.Crypto, Version=1.8.5.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
|
<Reference Include="BouncyCastle.Crypto, Version=1.8.5.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="AutoMapper" version="6.0.2" targetFramework="win81" />
|
<package id="AutoMapper" version="5.2.0" targetFramework="win81" />
|
||||||
<package id="AutoMapper.Extensions.Microsoft.DependencyInjection" version="2.0.1" targetFramework="win81" />
|
<package id="AutoMapper.Extensions.Microsoft.DependencyInjection" version="1.2.0" targetFramework="win81" />
|
||||||
<package id="FluentValidation" version="8.6.2" targetFramework="win81" />
|
<package id="FluentValidation" version="8.6.2" targetFramework="win81" />
|
||||||
<package id="HockeySDK.Core" version="4.1.6" targetFramework="win81" />
|
<package id="HockeySDK.Core" version="4.1.6" targetFramework="win81" />
|
||||||
<package id="HockeySDK.WINRT" version="4.1.6" targetFramework="win81" />
|
<package id="HockeySDK.WINRT" version="4.1.6" targetFramework="win81" />
|
||||||
|
Reference in New Issue
Block a user