Removed ModernKeePassLib dependency

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

View File

@@ -54,14 +54,16 @@
<Compile Include="Common\Interfaces\ISettingsProxy.cs" />
<Compile Include="Common\Mappings\IMapFrom.cs" />
<Compile Include="Common\Mappings\MappingProfile.cs" />
<Compile Include="Cryptography\Commands\SetCipher\SetCipherCommand.cs" />
<Compile Include="Cryptography\Commands\SetCompression\SetCompressionCommand.cs" />
<Compile Include="Cryptography\Commands\SetKeyDerivation\SetKeyDerivationCommand.cs" />
<Compile Include="Cryptography\Models\CipherVm.cs" />
<Compile Include="Cryptography\Models\KeyDerivationVm.cs" />
<Compile Include="Cryptography\Queries\GetCiphers\GetCiphersQuery.cs" />
<Compile Include="Cryptography\Queries\GetCompressions\GetCompressionsQuery.cs" />
<Compile Include="Cryptography\Queries\GetKeyDerivations\GetKeyDerivationsQuery.cs" />
<Compile Include="Parameters\Commands\SetCipher\SetCipherCommand.cs" />
<Compile Include="Parameters\Commands\SetCompression\SetCompressionCommand.cs" />
<Compile Include="Parameters\Commands\SetHasRecycleBin\SetHasRecycleBinCommand.cs" />
<Compile Include="Parameters\Commands\SetKeyDerivation\SetKeyDerivationCommand.cs" />
<Compile Include="Parameters\Commands\SetRecycleBin\SetRecycleBinCommand.cs" />
<Compile Include="Parameters\Models\CipherVm.cs" />
<Compile Include="Parameters\Models\KeyDerivationVm.cs" />
<Compile Include="Parameters\Queries\GetCiphers\GetCiphersQuery.cs" />
<Compile Include="Parameters\Queries\GetCompressions\GetCompressionsQuery.cs" />
<Compile Include="Parameters\Queries\GetKeyDerivations\GetKeyDerivationsQuery.cs" />
<Compile Include="Database\Commands\CloseDatabase\CloseDatabaseCommand.cs" />
<Compile Include="Database\Commands\CreateDatabase\CreateDatabaseCommand.cs" />
<Compile Include="Database\Commands\CreateDatabase\CreateDatabaseQueryValidator.cs" />

View File

@@ -14,13 +14,13 @@ namespace ModernKeePass.Application.Common.Interfaces
string CipherId { get; set; }
string KeyDerivationId { get; set; }
string Compression { get; set; }
bool IsRecycleBinEnabled { get; }
bool IsRecycleBinEnabled { get; set; }
Task<GroupEntity> Open(FileInfo fileInfo, Credentials credentials);
Task<GroupEntity> ReOpen();
Task<GroupEntity> Create(FileInfo fileInfo, Credentials credentials);
Task SaveDatabase();
Task SaveDatabase(FileInfo FileInfo);
Task SaveDatabase(string filePath);
Task UpdateCredentials(Credentials credentials);
void CloseDatabase();

View File

@@ -1,14 +1,13 @@
using MediatR;
using System.Threading.Tasks;
using ModernKeePass.Application.Common.Interfaces;
using ModernKeePass.Domain.Dtos;
using ModernKeePass.Domain.Exceptions;
namespace ModernKeePass.Application.Database.Commands.SaveDatabase
{
public class SaveDatabaseCommand : IRequest
{
public FileInfo FileInfo { get; set; }
public string FilePath { get; set; }
public class SaveDatabaseCommandHandler : IAsyncRequestHandler<SaveDatabaseCommand>
{
@@ -23,8 +22,8 @@ namespace ModernKeePass.Application.Database.Commands.SaveDatabase
{
if (!_database.IsOpen) throw new DatabaseClosedException();
if (message.FileInfo != null) await _database.SaveDatabase(message.FileInfo);
else await _database.SaveDatabase();
if (string.IsNullOrEmpty(message.FilePath)) await _database.SaveDatabase();
else await _database.SaveDatabase(message.FilePath);
}
}
}

View File

@@ -8,7 +8,8 @@ namespace ModernKeePass.Application.Database.Commands.UpdateCredentials
{
public class UpdateCredentialsCommand: IRequest
{
public Credentials Credentials { get; set; }
public string Password { get; set; }
public string KeyFilePath { get; set; }
public class UpdateCredentialsCommandHandler : IAsyncRequestHandler<UpdateCredentialsCommand>
{
@@ -21,7 +22,14 @@ namespace ModernKeePass.Application.Database.Commands.UpdateCredentials
public async Task Handle(UpdateCredentialsCommand message)
{
if (_database.IsOpen) await _database.UpdateCredentials(message.Credentials);
if (_database.IsOpen)
{
await _database.UpdateCredentials(new Credentials
{
KeyFilePath = message.KeyFilePath,
Password = message.Password
});
}
else throw new DatabaseClosedException();
}
}

View File

@@ -2,7 +2,7 @@
using ModernKeePass.Application.Common.Interfaces;
using ModernKeePass.Domain.Exceptions;
namespace ModernKeePass.Application.Cryptography.Commands.SetCipher
namespace ModernKeePass.Application.Parameters.Commands.SetCipher
{
public class SetCipherCommand : IRequest
{

View File

@@ -2,7 +2,7 @@
using ModernKeePass.Application.Common.Interfaces;
using ModernKeePass.Domain.Exceptions;
namespace ModernKeePass.Application.Cryptography.Commands.SetCompression
namespace ModernKeePass.Application.Parameters.Commands.SetCompression
{
public class SetCompressionCommand : IRequest
{

View File

@@ -0,0 +1,27 @@
using MediatR;
using ModernKeePass.Application.Common.Interfaces;
using ModernKeePass.Domain.Exceptions;
namespace ModernKeePass.Application.Parameters.Commands.SetHasRecycleBin
{
public class SetHasRecycleBinCommand : IRequest
{
public bool HasRecycleBin { get; set; }
public class SetHasRecycleBinCommandHandler : IRequestHandler<SetHasRecycleBinCommand>
{
private readonly IDatabaseProxy _database;
public SetHasRecycleBinCommandHandler(IDatabaseProxy database)
{
_database = database;
}
public void Handle(SetHasRecycleBinCommand message)
{
if (_database.IsOpen) _database.IsRecycleBinEnabled = message.HasRecycleBin;
else throw new DatabaseClosedException();
}
}
}
}

View File

@@ -2,7 +2,7 @@
using ModernKeePass.Application.Common.Interfaces;
using ModernKeePass.Domain.Exceptions;
namespace ModernKeePass.Application.Cryptography.Commands.SetKeyDerivation
namespace ModernKeePass.Application.Parameters.Commands.SetKeyDerivation
{
public class SetKeyDerivationCommand : IRequest
{

View File

@@ -0,0 +1,27 @@
using MediatR;
using ModernKeePass.Application.Common.Interfaces;
using ModernKeePass.Domain.Exceptions;
namespace ModernKeePass.Application.Parameters.Commands.SetRecycleBin
{
public class SetRecycleBinCommand : IRequest
{
public string RecycleBinId { get; set; }
public class SetRecycleBinCommandHandler : IRequestHandler<SetRecycleBinCommand>
{
private readonly IDatabaseProxy _database;
public SetRecycleBinCommandHandler(IDatabaseProxy database)
{
_database = database;
}
public void Handle(SetRecycleBinCommand message)
{
if (_database.IsOpen) _database.RecycleBinId = message.RecycleBinId;
else throw new DatabaseClosedException();
}
}
}
}

View File

@@ -32,6 +32,12 @@ namespace ModernKeePass.Infrastructure.KeePass
public GroupEntity RootGroup { get; private set; }
// Settings
public bool IsRecycleBinEnabled
{
get { return _pwDatabase.RecycleBinEnabled; }
set { _pwDatabase.RecycleBinEnabled = value; }
}
public string RecycleBinId
{
get
@@ -68,9 +74,7 @@ namespace ModernKeePass.Infrastructure.KeePass
get { return _pwDatabase.Compression.ToString("G"); }
set { _pwDatabase.Compression = (PwCompressionAlgorithm) Enum.Parse(typeof(PwCompressionAlgorithm), value); }
}
public bool IsRecycleBinEnabled => _pwDatabase.RecycleBinEnabled;
public KeePassDatabaseClient(ISettingsProxy settings, IFileProxy fileService, IMapper mapper)
{
_settings = settings;
@@ -120,7 +124,6 @@ namespace ModernKeePass.Infrastructure.KeePass
_fileAccessToken = fileInfo.Path;
// TODO: create sample data depending on settings
return _mapper.Map<GroupEntity>(_pwDatabase.RootGroup);
}
@@ -138,16 +141,16 @@ namespace ModernKeePass.Infrastructure.KeePass
}
}
public async Task SaveDatabase(FileInfo fileInfo)
public async Task SaveDatabase(string filePath)
{
try
{
var newFileContents = await _fileService.OpenBinaryFile(fileInfo.Path);
var newFileContents = await _fileService.OpenBinaryFile(filePath);
_pwDatabase.SaveAs(IOConnectionInfo.FromByteArray(newFileContents), true, new NullStatusLogger());
await _fileService.WriteBinaryContentsToFile(fileInfo.Path, _pwDatabase.IOConnectionInfo.Bytes);
await _fileService.WriteBinaryContentsToFile(filePath, _pwDatabase.IOConnectionInfo.Bytes);
_fileService.ReleaseFile(_fileAccessToken);
_fileAccessToken = fileInfo.Path;
_fileAccessToken = filePath;
}
catch (Exception e)
{

View File

@@ -174,7 +174,7 @@ namespace ModernKeePass
{
var database = await Mediator.Send(new ReOpenDatabaseQuery());
#if DEBUG
ToastNotificationHelper.ShowGenericToast(database.Name, "Database reopened (changes were saved)");
ToastNotificationHelper.ShowGenericToast(database.Title, "Database reopened (changes were saved)");
#endif
}
catch (Exception)

View File

@@ -1,7 +1,7 @@
using System;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;
using ModernKeePassLib;
using ModernKeePass.Domain.Enums;
namespace ModernKeePass.Converters
{
@@ -9,66 +9,59 @@ namespace ModernKeePass.Converters
{
public object Convert(object value, Type targetType, object parameter, string language)
{
var icon = (PwIcon) value;
var icon = (Icon) value;
switch (icon)
{
case PwIcon.Key: return Symbol.Permissions;
case PwIcon.WorldSocket:
case PwIcon.World: return Symbol.World;
case PwIcon.Warning: return Symbol.Important;
case PwIcon.WorldComputer:
case PwIcon.Drive:
case PwIcon.DriveWindows:
case PwIcon.NetworkServer: return Symbol.MapDrive;
case PwIcon.MarkedDirectory: return Symbol.Map;
case PwIcon.UserCommunication: return Symbol.ContactInfo;
case PwIcon.Parts: return Symbol.ViewAll;
case PwIcon.Notepad: return Symbol.Document;
case PwIcon.Identity: return Symbol.Contact2;
case PwIcon.PaperReady: return Symbol.SyncFolder;
case PwIcon.Digicam: return Symbol.Camera;
case PwIcon.IRCommunication: return Symbol.View;
case PwIcon.Energy: return Symbol.ZeroBars;
case PwIcon.Scanner: return Symbol.Scan;
case PwIcon.CDRom: return Symbol.Rotate;
case PwIcon.Monitor: return Symbol.Caption;
case PwIcon.EMailBox:
case PwIcon.EMail: return Symbol.Mail;
case PwIcon.Configuration: return Symbol.Setting;
case PwIcon.ClipboardReady: return Symbol.Paste;
case PwIcon.PaperNew: return Symbol.Page2;
case PwIcon.Screen: return Symbol.GoToStart;
case PwIcon.EnergyCareful: return Symbol.FourBars;
case PwIcon.Disk: return Symbol.Save;
case PwIcon.Console: return Symbol.SlideShow;
case PwIcon.Printer: return Symbol.Scan;
case PwIcon.ProgramIcons: return Symbol.GoToStart;
case PwIcon.Settings:
case PwIcon.Tool: return Symbol.Repair;
case PwIcon.Archive: return Symbol.Crop;
case PwIcon.Count: return Symbol.Calculator;
case PwIcon.Clock: return Symbol.Clock;
case PwIcon.EMailSearch: return Symbol.Find;
case PwIcon.PaperFlag: return Symbol.Flag;
case PwIcon.TrashBin: return Symbol.Delete;
case PwIcon.Expired: return Symbol.ReportHacked;
case PwIcon.Info: return Symbol.Help;
case PwIcon.Folder:
case PwIcon.FolderOpen:
case PwIcon.FolderPackage: return Symbol.Folder;
case PwIcon.PaperLocked: return Symbol.ProtectedDocument;
case PwIcon.Checked: return Symbol.Accept;
case PwIcon.Pen: return Symbol.Edit;
case PwIcon.Thumbnail: return Symbol.BrowsePhotos;
case PwIcon.Book: return Symbol.Library;
case PwIcon.List: return Symbol.List;
case PwIcon.UserKey: return Symbol.ContactPresence;
case PwIcon.Home: return Symbol.Home;
case PwIcon.Star: return Symbol.OutlineStar;
case PwIcon.Money: return Symbol.Shop;
case PwIcon.Certificate: return Symbol.PreviewLink;
case PwIcon.BlackBerry: return Symbol.CellPhone;
default: return Symbol.Stop;
case Icon.Delete: return Symbol.Delete;
case Icon.Edit: return Symbol.Edit;
case Icon.Save: return Symbol.Save;
case Icon.Cancel: return Symbol.Cancel;
case Icon.Accept: return Symbol.Accept;
case Icon.Home: return Symbol.Home;
case Icon.Camera: return Symbol.Camera;
case Icon.Setting: return Symbol.Setting;
case Icon.Mail: return Symbol.Mail;
case Icon.Find: return Symbol.Find;
case Icon.Help: return Symbol.Help;
case Icon.Clock: return Symbol.Clock;
case Icon.Crop: return Symbol.Crop;
case Icon.World: return Symbol.World;
case Icon.Flag: return Symbol.Flag;
case Icon.PreviewLink: return Symbol.PreviewLink;
case Icon.Document: return Symbol.Document;
case Icon.ProtectedDocument: return Symbol.ProtectedDocument;
case Icon.ContactInfo: return Symbol.ContactInfo;
case Icon.ViewAll: return Symbol.ViewAll;
case Icon.Rotate: return Symbol.Rotate;
case Icon.List: return Symbol.List;
case Icon.Shop: return Symbol.Shop;
case Icon.BrowsePhotos: return Symbol.BrowsePhotos;
case Icon.Caption: return Symbol.Caption;
case Icon.Repair: return Symbol.Repair;
case Icon.Page: return Symbol.Page;
case Icon.Paste: return Symbol.Paste;
case Icon.Important: return Symbol.Important;
case Icon.SlideShow: return Symbol.SlideShow;
case Icon.MapDrive: return Symbol.MapDrive;
case Icon.ContactPresence: return Symbol.ContactPresence;
case Icon.Contact: return Symbol.Contact;
case Icon.Folder: return Symbol.Folder;
case Icon.View: return Symbol.View;
case Icon.Permissions: return Symbol.Permissions;
case Icon.Map: return Symbol.Map;
case Icon.CellPhone: return Symbol.CellPhone;
case Icon.OutlineStar: return Symbol.OutlineStar;
case Icon.Calculator: return Symbol.Calculator;
case Icon.Library: return Symbol.Library;
case Icon.SyncFolder: return Symbol.SyncFolder;
case Icon.GoToStart: return Symbol.GoToStart;
case Icon.ZeroBars: return Symbol.ZeroBars;
case Icon.FourBars: return Symbol.FourBars;
case Icon.Scan: return Symbol.Scan;
case Icon.ReportHacked: return Symbol.ReportHacked;
case Icon.Stop: return Symbol.Stop;
default:
throw new ArgumentOutOfRangeException();
}
}
@@ -78,52 +71,54 @@ namespace ModernKeePass.Converters
var defaultIcon = parameter != null ? int.Parse(parameter as string) : -1;
switch (symbol)
{
case Symbol.Delete: return (int)PwIcon.TrashBin;
case Symbol.Edit: return (int) PwIcon.Pen;
case Symbol.Save: return (int) PwIcon.Disk;
case Symbol.Cancel: return (int) PwIcon.Expired;
case Symbol.Accept: return (int) PwIcon.Checked;
case Symbol.Home: return (int) PwIcon.Home;
case Symbol.Camera: return (int) PwIcon.Digicam;
case Symbol.Setting: return (int) PwIcon.Configuration;
case Symbol.Mail: return (int) PwIcon.EMail;
case Symbol.Find: return (int) PwIcon.EMailSearch;
case Symbol.Help: return (int) PwIcon.Info;
case Symbol.Clock: return (int) PwIcon.Clock;
case Symbol.Crop: return (int) PwIcon.Archive;
case Symbol.World: return (int) PwIcon.World;
case Symbol.Flag: return (int) PwIcon.PaperFlag;
case Symbol.PreviewLink: return (int) PwIcon.Certificate;
case Symbol.Document: return (int) PwIcon.Notepad;
case Symbol.ProtectedDocument: return (int) PwIcon.PaperLocked;
case Symbol.ContactInfo: return (int) PwIcon.UserCommunication;
case Symbol.ViewAll: return (int) PwIcon.Parts;
case Symbol.Rotate: return (int) PwIcon.CDRom;
case Symbol.List: return (int) PwIcon.List;
case Symbol.Shop: return (int) PwIcon.Money;
case Symbol.BrowsePhotos: return (int) PwIcon.Thumbnail;
case Symbol.Caption: return (int) PwIcon.Monitor;
case Symbol.Repair: return (int) PwIcon.Tool;
case Symbol.Page2: return (int) PwIcon.PaperNew;
case Symbol.Paste: return (int) PwIcon.ClipboardReady;
case Symbol.Important: return (int) PwIcon.Warning;
case Symbol.SlideShow: return (int) PwIcon.Console;
case Symbol.MapDrive: return (int) PwIcon.NetworkServer;
case Symbol.ContactPresence: return (int) PwIcon.UserKey;
case Symbol.Contact2: return (int) PwIcon.Identity;
case Symbol.Folder: return (int) PwIcon.Folder;
case Symbol.View: return (int) PwIcon.IRCommunication;
case Symbol.Permissions: return (int) PwIcon.Key;
case Symbol.Map: return (int) PwIcon.MarkedDirectory;
case Symbol.CellPhone: return (int) PwIcon.BlackBerry;
case Symbol.OutlineStar: return (int) PwIcon.Star;
case Symbol.Calculator: return (int) PwIcon.Count;
case Symbol.Library: return (int) PwIcon.Book;
case Symbol.SyncFolder: return (int) PwIcon.PaperReady;
case Symbol.GoToStart: return (int) PwIcon.Screen;
case Symbol.ZeroBars: return (int) PwIcon.Energy;
case Symbol.FourBars: return (int) PwIcon.EnergyCareful;
case Symbol.Scan: return (int) PwIcon.Scanner;
case Symbol.Delete: return Icon.Delete;
case Symbol.Edit: return Icon.Edit;
case Symbol.Save: return Icon.Save;
case Symbol.Cancel: return Icon.Cancel;
case Symbol.Accept: return Icon.Accept;
case Symbol.Home: return Icon.Home;
case Symbol.Camera: return Icon.Camera;
case Symbol.Setting: return Icon.Setting;
case Symbol.Mail: return Icon.Mail;
case Symbol.Find: return Icon.Find;
case Symbol.Help: return Icon.Help;
case Symbol.Clock: return Icon.Clock;
case Symbol.Crop: return Icon.Crop;
case Symbol.World: return Icon.World;
case Symbol.Flag: return Icon.Flag;
case Symbol.PreviewLink: return Icon.PreviewLink;
case Symbol.Document: return Icon.Document;
case Symbol.ProtectedDocument: return Icon.ProtectedDocument;
case Symbol.ContactInfo: return Icon.ContactInfo;
case Symbol.ViewAll: return Icon.ViewAll;
case Symbol.Rotate: return Icon.Rotate;
case Symbol.List: return Icon.List;
case Symbol.Shop: return Icon.Shop;
case Symbol.BrowsePhotos: return Icon.BrowsePhotos;
case Symbol.Caption: return Icon.Caption;
case Symbol.Repair: return Icon.Repair;
case Symbol.Page: return Icon.Page;
case Symbol.Paste: return Icon.Paste;
case Symbol.Important: return Icon.Important;
case Symbol.SlideShow: return Icon.SlideShow;
case Symbol.MapDrive: return Icon.MapDrive;
case Symbol.ContactPresence: return Icon.ContactPresence;
case Symbol.Contact: return Icon.Contact;
case Symbol.Folder: return Icon.Folder;
case Symbol.View: return Icon.View;
case Symbol.Permissions: return Icon.Permissions;
case Symbol.Map: return Icon.Map;
case Symbol.CellPhone: return Icon.CellPhone;
case Symbol.OutlineStar: return Icon.OutlineStar;
case Symbol.Calculator: return Icon.Calculator;
case Symbol.Library: return Icon.Library;
case Symbol.SyncFolder: return Icon.SyncFolder;
case Symbol.GoToStart: return Icon.GoToStart;
case Symbol.ZeroBars: return Icon.ZeroBars;
case Symbol.FourBars: return Icon.FourBars;
case Symbol.Scan: return Icon.Scan;
case Symbol.ReportHacked: return Icon.ReportHacked;
case Symbol.Stop: return Icon.Stop;
default: return defaultIcon;
}
}

View File

@@ -1,5 +1,5 @@
using System;
using ModernKeePass.Application.Group.Models;
using ModernKeePass.ViewModels;
namespace ModernKeePass.Events
{

View File

@@ -28,7 +28,7 @@ namespace ModernKeePass.Interfaces
/// Move a entity to the destination group
/// </summary>
/// <param name="destination">The destination to move the entity to</param>
void Move(GroupVm destination);
Task Move(GroupVm destination);
/// <summary>
/// Delete from Model
/// </summary>

View File

@@ -1,5 +1,4 @@
using System;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Text;
using System.Threading.Tasks;
using Windows.Storage;
@@ -7,12 +6,11 @@ using Windows.Storage.AccessCache;
using MediatR;
using ModernKeePass.Application.Database.Commands.UpdateCredentials;
using ModernKeePass.Application.Database.Queries.OpenDatabase;
using ModernKeePass.Application.Security.Commands.GenerateKeyFile;
using ModernKeePass.Application.Security.Queries.EstimatePasswordComplexity;
using ModernKeePass.Common;
using ModernKeePass.Domain.Dtos;
using ModernKeePass.Interfaces;
using ModernKeePass.Services;
using ModernKeePassLib.Cryptography;
using ModernKeePassLib.Keys;
namespace ModernKeePass.ViewModels
{
@@ -101,8 +99,8 @@ namespace ModernKeePass.ViewModels
public Application.Group.Models.GroupVm RootGroup { get; set; }
public double PasswordComplexityIndicator => QualityEstimation.EstimatePasswordBits(Password?.ToCharArray());
public double PasswordComplexityIndicator => _mediator.Send(new EstimatePasswordComplexityQuery { Password = Password }).GetAwaiter().GetResult();
private bool _hasPassword;
private bool _hasKeyFile;
private bool _hasUserAccount;
@@ -129,15 +127,13 @@ namespace ModernKeePass.ViewModels
try
{
_isOpening = true;
OnPropertyChanged("IsValid");
var fileInfo = new FileInfo
{
Name = databaseFile.DisplayName,
Path = StorageApplicationPermissions.FutureAccessList.Add(databaseFile)
};
OnPropertyChanged(nameof(IsValid));
var database = await _mediator.Send(new OpenDatabaseQuery { FileInfo = fileInfo, Credentials = CreateCredentials()});
await Task.Run(() => RootGroup = database.RootGroup);
RootGroup = await _mediator.Send(new OpenDatabaseQuery {
FilePath = StorageApplicationPermissions.FutureAccessList.Add(databaseFile),
KeyFilePath = HasKeyFile && KeyFile != null ? StorageApplicationPermissions.FutureAccessList.Add(KeyFile) : null,
Password = Password = HasPassword ? Password : null,
});
return true;
}
catch (ArgumentException)
@@ -163,16 +159,19 @@ namespace ModernKeePass.ViewModels
public async Task UpdateKey()
{
//Database.UpdateCompositeKey(await CreateCompositeKey());
await _mediator.Send(new UpdateCredentialsCommand {Credentials = CreateCredentials()});
await _mediator.Send(new UpdateCredentialsCommand
{
KeyFilePath = HasKeyFile && KeyFile != null ? StorageApplicationPermissions.FutureAccessList.Add(KeyFile) : null,
Password = Password = HasPassword ? Password : null,
});
UpdateStatus(_resource.GetResourceValue("CompositeKeyUpdated"), StatusTypes.Success);
}
public async Task CreateKeyFile(StorageFile file)
{
var token = StorageApplicationPermissions.FutureAccessList.Add(file);
// TODO: implement entropy generator
var fileContents = await FileIO.ReadBufferAsync(file);
KcpKeyFile.Create(fileContents.ToArray());
await _mediator.Send(new GenerateKeyFileCommand {KeyFilePath = token});
KeyFile = file;
}
@@ -181,15 +180,5 @@ namespace ModernKeePass.ViewModels
Status = text;
StatusType = (int)type;
}
private Credentials CreateCredentials()
{
var credentials = new Credentials
{
Password = HasPassword ? Password: null,
KeyFilePath = HasKeyFile && KeyFile != null ? StorageApplicationPermissions.FutureAccessList.Add(KeyFile) : null
};
return credentials;
}
}
}

View File

@@ -5,7 +5,10 @@ using System.Threading.Tasks;
using System.Windows.Input;
using MediatR;
using ModernKeePass.Application.Database.Commands.SaveDatabase;
using ModernKeePass.Application.Database.Models;
using ModernKeePass.Application.Database.Queries.GetDatabase;
using ModernKeePass.Application.Entry.Commands.SetFieldValue;
using ModernKeePass.Application.Group.Commands.CreateGroup;
using ModernKeePass.Application.Group.Commands.DeleteEntry;
using ModernKeePass.Application.Resources.Queries;
using ModernKeePass.Application.Security.Commands.GeneratePassword;
@@ -32,7 +35,7 @@ namespace ModernKeePass.ViewModels
public bool BracketsPatternSelected { get; set; }
public string CustomChars { get; set; } = string.Empty;
public string Id => _entry.Id;
public bool IsRecycleOnDelete => _database.RecycleBinEnabled && !ParentGroup.IsSelected;
public bool IsRecycleOnDelete => GetDatabase().IsRecycleBinEnabled && !ParentGroup.IsSelected;
public IEnumerable<IVmEntity> BreadCrumb => new List<IVmEntity>(ParentGroup.BreadCrumb) {ParentGroup};
/// <summary>
/// Determines if the Entry is current or from history
@@ -211,7 +214,7 @@ namespace ModernKeePass.ViewModels
SaveCommand = new RelayCommand(() => _mediator.Send(new SaveDatabaseCommand()));
GeneratePasswordCommand = new RelayCommand(async () => await GeneratePassword());
UndoDeleteCommand = new RelayCommand(() => Move(PreviousGroup), () => PreviousGroup != null);
UndoDeleteCommand = new RelayCommand(async () => await Move(PreviousGroup), () => PreviousGroup != null);
}
public async Task GeneratePassword()
@@ -233,20 +236,21 @@ namespace ModernKeePass.ViewModels
}
public Task MarkForDelete(string recycleBinTitle)
public async Task MarkForDelete(string recycleBinTitle)
{
if (_database.RecycleBinEnabled && _database.RecycleBin?.IdUuid == null)
_database.CreateRecycleBin(recycleBinTitle);
Move(_database.RecycleBinEnabled && !ParentGroup.IsSelected ? _database.RecycleBin : null);
var database = GetDatabase();
if (database.IsRecycleBinEnabled && database.RecycleBinId == null)
await _mediator.Send(new CreateGroupCommand { ParentGroup = database.RootGroup, IsRecycleBin = true, Name = recycleBinTitle});
await Move(database.IsRecycleBinEnabled && !ParentGroup.IsSelected ? _database.RecycleBin : null);
}
public void Move(GroupVm destination)
public async Task Move(GroupVm destination)
{
PreviousGroup = ParentGroup;
PreviousGroup.Entries.Remove(this);
if (destination == null)
{
_database.AddDeletedItem(IdUuid);
await _mediator.Send(new DeleteEntryCommand { Entry = _entry });
return;
}
ParentGroup = destination;
@@ -269,5 +273,10 @@ namespace ModernKeePass.ViewModels
_mediator.Send(new GetResourceQuery{Key = "EntryCurrent"}).GetAwaiter().GetResult() :
_entry.ModificationDate.ToString("g");
}
private DatabaseVm GetDatabase()
{
return _mediator.Send(new GetDatabaseQuery()).GetAwaiter().GetResult();
}
}
}

View File

@@ -6,13 +6,16 @@ using System.Threading.Tasks;
using System.Windows.Input;
using MediatR;
using ModernKeePass.Application.Database.Commands.SaveDatabase;
using ModernKeePass.Application.Database.Models;
using ModernKeePass.Application.Database.Queries.GetDatabase;
using ModernKeePass.Application.Group.Commands.AddEntry;
using ModernKeePass.Application.Group.Commands.AddGroup;
using ModernKeePass.Application.Group.Commands.CreateEntry;
using ModernKeePass.Application.Group.Commands.CreateGroup;
using ModernKeePass.Application.Group.Commands.DeleteGroup;
using ModernKeePass.Application.Group.Commands.InsertEntry;
using ModernKeePass.Application.Group.Commands.RemoveEntry;
using ModernKeePass.Application.Group.Commands.RemoveGroup;
using ModernKeePass.Application.Group.Commands.SortEntries;
using ModernKeePass.Application.Group.Commands.SortGroups;
using ModernKeePass.Common;
@@ -54,14 +57,18 @@ namespace ModernKeePass.ViewModels
public bool ShowRestore => IsNotRoot && ParentGroup.IsSelected;
public bool IsRecycleOnDelete => IsRecycleBinEnabled().GetAwaiter().GetResult() && !IsSelected && !ParentGroup.IsSelected;
public bool IsRecycleOnDelete => GetDatabase().IsRecycleBinEnabled && !IsSelected && !ParentGroup.IsSelected;
/// <summary>
/// Is the Group the database Recycle Bin?
/// </summary>
public bool IsSelected
{
get { return IsRecycleBinEnabled().GetAwaiter().GetResult() && _database.RecycleBin?.Id == Id; }
get
{
var database = GetDatabase();
return database.IsRecycleBinEnabled && database.RecycleBinId == Id;
}
set
{
if (value && _group != null) _database.RecycleBin = this;
@@ -150,7 +157,7 @@ namespace ModernKeePass.ViewModels
await SortEntriesAsync().ConfigureAwait(false), () => IsEditMode);
SortGroupsCommand = new RelayCommand(async () =>
await SortGroupsAsync().ConfigureAwait(false), () => IsEditMode);
UndoDeleteCommand = new RelayCommand(() => Move(PreviousGroup), () => PreviousGroup != null);
UndoDeleteCommand = new RelayCommand(async () => await Move(PreviousGroup), () => PreviousGroup != null);
if (recycleBinId != null && _group.Id.Equals(recycleBinId)) _database.RecycleBin = this;
Entries = new ObservableCollection<EntryVm>(group.Entries.Select(e => new EntryVm(e, this)));
@@ -200,31 +207,31 @@ namespace ModernKeePass.ViewModels
public async Task MarkForDelete(string recycleBinTitle)
{
var isRecycleBinEnabled = await IsRecycleBinEnabled();
if (isRecycleBinEnabled && _database.RecycleBin?.IdUuid == null)
_database.CreateRecycleBin(recycleBinTitle);
Move(isRecycleBinEnabled && !IsSelected ? _database.RecycleBin : null);
var database = GetDatabase();
if (database.IsRecycleBinEnabled && database.RecycleBinId == null)
await _mediator.Send(new CreateGroupCommand {ParentGroup = database.RootGroup, IsRecycleBin = true, Name = recycleBinTitle});
await Move(database.IsRecycleBinEnabled && !IsSelected ? _database.RecycleBin : null);
((RelayCommand)UndoDeleteCommand).RaiseCanExecuteChanged();
}
public void UndoDelete()
public async Task UndoDelete()
{
Move(PreviousGroup);
await Move(PreviousGroup);
}
public void Move(GroupVm destination)
public async Task Move(GroupVm destination)
{
PreviousGroup = ParentGroup;
PreviousGroup.Groups.Remove(this);
PreviousGroup._group.SubGroups.Remove(_group);
await _mediator.Send(new RemoveGroupCommand {ParentGroup = PreviousGroup._group, Group = _group});
if (destination == null)
{
_database.AddDeletedItem(IdUuid);
await _mediator.Send(new DeleteGroupCommand { Group = _group });
return;
}
ParentGroup = destination;
ParentGroup.Groups.Add(this);
ParentGroup._group.AddGroup(_group, true);
await _mediator.Send(new AddGroupCommand {ParentGroup = ParentGroup._group, Group = _group});
}
public async Task CommitDelete()
@@ -251,10 +258,9 @@ namespace ModernKeePass.ViewModels
OnPropertyChanged(nameof(Groups));
}
private async Task<bool> IsRecycleBinEnabled()
private DatabaseVm GetDatabase()
{
var database = await _mediator.Send(new GetDatabaseQuery());
return database.IsRecycleBinEnabled;
return _mediator.Send(new GetDatabaseQuery()).GetAwaiter().GetResult();
}
}
}

View File

@@ -1,55 +1,74 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using MediatR;
using ModernKeePass.Application.Cryptography.Models;
using ModernKeePass.Application.Cryptography.Queries.GetCiphers;
using ModernKeePass.Application.Cryptography.Queries.GetCompressions;
using ModernKeePass.Application.Cryptography.Queries.GetKeyDerivations;
using ModernKeePass.Application.Database.Models;
using ModernKeePass.Application.Database.Queries.GetDatabase;
using ModernKeePass.Application.Parameters.Commands.SetCipher;
using ModernKeePass.Application.Parameters.Commands.SetCompression;
using ModernKeePass.Application.Parameters.Commands.SetHasRecycleBin;
using ModernKeePass.Application.Parameters.Commands.SetKeyDerivation;
using ModernKeePass.Application.Parameters.Commands.SetRecycleBin;
using ModernKeePass.Common;
using ModernKeePass.Interfaces;
using ModernKeePass.Services;
using ModernKeePassLib;
using ModernKeePassLib.Cryptography.Cipher;
using ModernKeePassLib.Cryptography.KeyDerivation;
namespace ModernKeePass.ViewModels
{
// TODO: implement Kdf settings
public class SettingsDatabaseVm: NotifyPropertyChangedBase, IHasSelectableObject
{
private readonly IDatabaseService _database;
private readonly IMediator _mediator;
private readonly DatabaseVm _database;
private GroupVm _selectedItem;
public bool HasRecycleBin
{
get { return _database.RecycleBinEnabled; }
get { return _database.IsRecycleBinEnabled; }
set
{
_database.RecycleBinEnabled = value;
OnPropertyChanged("HasRecycleBin");
_mediator.Send(new SetHasRecycleBinCommand {HasRecycleBin = value}).GetAwaiter().GetResult();
OnPropertyChanged(nameof(HasRecycleBin));
}
}
public bool IsNewRecycleBin
{
get { return _database.RecycleBin == null; }
get { return _database.RecycleBinId == null; }
set
{
if (value) _database.RecycleBin = null;
if (value) _mediator.Send(new SetRecycleBinCommand() { RecycleBinId = null }).GetAwaiter().GetResult();
}
}
public ObservableCollection<GroupVm> Groups { get; set; }
public IEnumerable<string> Ciphers
public IEnumerable<CipherVm> Ciphers => _mediator.Send(new GetCiphersQuery()).GetAwaiter().GetResult();
public IEnumerable<string> Compressions => _mediator.Send(new GetCompressionsQuery()).GetAwaiter().GetResult();
public IEnumerable<KeyDerivationVm> KeyDerivations => _mediator.Send(new GetKeyDerivationsQuery()).GetAwaiter().GetResult();
public CipherVm SelectedCipher
{
get
{
for (var inx = 0; inx < CipherPool.GlobalPool.EngineCount; inx++)
{
yield return CipherPool.GlobalPool[inx].DisplayName;
}
}
get { return Ciphers.FirstOrDefault(c => c.Id == _database.CipherId); }
set { _mediator.Send(new SetCipherCommand {CipherId = value.Id}).GetAwaiter().GetResult(); }
}
public int CipherIndex
public string SelectedCompression
{
get { return Compressions.FirstOrDefault(c => c == _database.Compression); }
set { _mediator.Send(new SetCompressionCommand {Compression = value}).GetAwaiter().GetResult(); }
}
public KeyDerivationVm SelectedKeyDerivation
{
get { return KeyDerivations.FirstOrDefault(c => c.Id == _database.KeyDerivationId); }
set { _mediator.Send(new SetKeyDerivationCommand {KeyDerivationId = value.Id}).GetAwaiter().GetResult(); }
}
/*public int CipherIndex
{
get
{
@@ -60,22 +79,19 @@ namespace ModernKeePass.ViewModels
return -1;
}
set { _database.DataCipher = CipherPool.GlobalPool[value].CipherUuid; }
}
}*/
public IEnumerable<string> Compressions => Enum.GetNames(typeof(PwCompressionAlgorithm)).Take((int)PwCompressionAlgorithm.Count);
public string CompressionName
/*public string CompressionName
{
get { return Enum.GetName(typeof(PwCompressionAlgorithm), _database.CompressionAlgorithm); }
get { return _database.}
set { _database.CompressionAlgorithm = (PwCompressionAlgorithm)Enum.Parse(typeof(PwCompressionAlgorithm), value); }
}
public IEnumerable<string> KeyDerivations => KdfPool.Engines.Select(e => e.Name);
public string KeyDerivationName
}*/
/*public string KeyDerivationName
{
get { return KdfPool.Get(_database.KeyDerivation.KdfUuid).Name; }
set { _database.KeyDerivation = KdfPool.Engines.FirstOrDefault(e => e.Name == value)?.GetDefaultParameters(); }
}
}*/
public ISelectableModel SelectedItem
{
@@ -97,12 +113,13 @@ namespace ModernKeePass.ViewModels
}
}
public SettingsDatabaseVm() : this(DatabaseService.Instance) { }
public SettingsDatabaseVm() : this(App.Mediator) { }
public SettingsDatabaseVm(IDatabaseService database)
public SettingsDatabaseVm(IMediator mediator)
{
_database = database;
Groups = _database?.RootGroup.Groups;
_mediator = mediator;
_database = _mediator.Send(new GetDatabaseQuery()).GetAwaiter().GetResult();
//Groups = _database.RootGroup.SubGroups;
}
}
}

View File

@@ -1,14 +1,21 @@
using Windows.Storage;
using System.Threading.Tasks;
using Windows.Storage;
using Windows.UI.Xaml.Controls;
using MediatR;
using ModernKeePass.Application.Database.Queries.GetDatabase;
using ModernKeePass.Application.Entry.Commands.SetFieldValue;
using ModernKeePass.Application.Group.Commands.CreateEntry;
using ModernKeePass.Application.Group.Commands.CreateGroup;
using ModernKeePass.Converters;
using ModernKeePass.Domain.Enums;
using ModernKeePass.ImportFormats;
using ModernKeePass.Interfaces;
using ModernKeePassLib;
namespace ModernKeePass.ViewModels
{
public class NewVm : OpenVm
{
private readonly IMediator _mediator;
private string _importFormatHelp;
public string Password { get; set; }
@@ -30,15 +37,23 @@ namespace ModernKeePass.ViewModels
}
}
public void PopulateInitialData(IDatabaseService database, ISettingsService settings, IImportService<IFormat> importService)
public NewVm(): this(App.Mediator) { }
public NewVm(IMediator mediator)
{
if (settings.GetSetting<bool>("Sample") && !IsImportChecked) CreateSampleData(database.RootGroup);
_mediator = mediator;
}
public async Task PopulateInitialData(ISettingsService settings, IImportService<IFormat> importService)
{
var database = await _mediator.Send(new GetDatabaseQuery());
if (settings.GetSetting<bool>("Sample") && !IsImportChecked) await CreateSampleData(database.RootGroup);
else if (IsImportChecked && ImportFile != null && ! (ImportFormat is NullImportFormat)) importService.Import(ImportFormat, ImportFile, database.RootGroup);
}
private void CreateSampleData(GroupVm group)
private async Task CreateSampleData(Application.Group.Models.GroupVm group)
{
var converter = new IntToSymbolConverter();
/*var converter = new IntToSymbolConverter();
var bankingGroup = group.AddNewGroup("Banking");
bankingGroup.Icon = (int)converter.ConvertBack(Symbol.Calculator, null, null, string.Empty);
@@ -60,7 +75,24 @@ namespace ModernKeePass.ViewModels
sample2.Title = "Sample Entry #2";
sample2.UserName = "Michael321";
sample2.Url = PwDefs.HelpUrl + "kb/testform.html";
sample2.Password = "12345";
sample2.Password = "12345";*/
var bankingGroup = await _mediator.Send(new CreateGroupCommand {ParentGroup = group, Name = "Banking"});
var emailGroup = await _mediator.Send(new CreateGroupCommand {ParentGroup = group, Name = "Email" });
var internetGroup = await _mediator.Send(new CreateGroupCommand {ParentGroup = group, Name = "Internet" });
var sample1 = await _mediator.Send(new CreateEntryCommand { ParentGroup = group });
await _mediator.Send(new SetFieldValueCommand {EntryId = sample1.Id, FieldName = EntryFieldName.Title, FieldValue = "Sample Entry"});
await _mediator.Send(new SetFieldValueCommand {EntryId = sample1.Id, FieldName = EntryFieldName.UserName, FieldValue = "Username" });
await _mediator.Send(new SetFieldValueCommand {EntryId = sample1.Id, FieldName = EntryFieldName.Password, FieldValue = "Password" });
await _mediator.Send(new SetFieldValueCommand {EntryId = sample1.Id, FieldName = EntryFieldName.Url, FieldValue = "https://keepass.info/" });
await _mediator.Send(new SetFieldValueCommand {EntryId = sample1.Id, FieldName = EntryFieldName.Notes, FieldValue = "You may safely delete this sample" });
var sample2 = await _mediator.Send(new CreateEntryCommand { ParentGroup = group });
await _mediator.Send(new SetFieldValueCommand {EntryId = sample2.Id, FieldName = EntryFieldName.Title, FieldValue = "Sample Entry #2"});
await _mediator.Send(new SetFieldValueCommand {EntryId = sample2.Id, FieldName = EntryFieldName.UserName, FieldValue = "Michael321" });
await _mediator.Send(new SetFieldValueCommand {EntryId = sample2.Id, FieldName = EntryFieldName.Password, FieldValue = "12345" });
await _mediator.Send(new SetFieldValueCommand {EntryId = sample2.Id, FieldName = EntryFieldName.Url, FieldValue = "https://keepass.info/help/kb/testform.html" });
}
}
}

View File

@@ -1,28 +1,32 @@
using Windows.Storage;
using ModernKeePass.Interfaces;
using ModernKeePass.Services;
using System.Threading.Tasks;
using Windows.Storage;
using Windows.Storage.AccessCache;
using MediatR;
using ModernKeePass.Application.Database.Commands.CloseDatabase;
using ModernKeePass.Application.Database.Commands.SaveDatabase;
namespace ModernKeePass.ViewModels
{
public class SaveVm
{
private readonly IDatabaseService _database;
public SaveVm() : this(DatabaseService.Instance) { }
private readonly IMediator _mediator;
public SaveVm() : this(App.Mediator) { }
public SaveVm(IDatabaseService database)
public SaveVm(IMediator mediator)
{
_database = database;
_mediator = mediator;
}
public void Save(bool close = true)
public async Task Save(bool close = true)
{
_database.Save();
if (close) _database.Close();
await _mediator.Send(new SaveDatabaseCommand());
if (close) await _mediator.Send(new CloseDatabaseCommand());
}
public void Save(StorageFile file)
public async Task Save(StorageFile file)
{
_database.Save(file);
var token = StorageApplicationPermissions.FutureAccessList.Add(file);
await _mediator.Send(new SaveDatabaseCommand { FilePath = token });
}
}
}

View File

@@ -1,6 +1,8 @@
using System.Collections.ObjectModel;
using System.Linq;
using Windows.UI.Xaml.Controls;
using MediatR;
using ModernKeePass.Application.Database.Queries.GetDatabase;
using ModernKeePass.Common;
using ModernKeePass.Interfaces;
using ModernKeePass.Views;
@@ -40,10 +42,11 @@ namespace ModernKeePass.ViewModels
}
}
public SettingsVm() : this(DatabaseService.Instance, new ResourcesService()) { }
public SettingsVm() : this(App.Mediator, new ResourcesService()) { }
public SettingsVm(IDatabaseService database, IResourceService resource)
public SettingsVm(IMediator mediator, IResourceService resource)
{
var database = mediator.Send(new GetDatabaseQuery()).GetAwaiter().GetResult();
var menuItems = new ObservableCollection<ListMenuItemVm>
{
new ListMenuItemVm

View File

@@ -47,7 +47,7 @@ namespace ModernKeePass.Views
{
NavigationHelper.OnNavigatedTo(e);
/*var args = e.Parameter as PasswordEventArgs;
var args = e.Parameter as PasswordEventArgs;
if (args != null)
DataContext = args.RootGroup;
else
@@ -55,9 +55,7 @@ namespace ModernKeePass.Views
var vm = e.Parameter as GroupVm;
if (vm != null)
DataContext = vm;
}*/
var args = e.Parameter as Application.Group.Models.GroupVm;
if (args != null) DataContext = new GroupVm(args);
}
}
protected override void OnNavigatedFrom(NavigationEventArgs e)

View File

@@ -27,10 +27,10 @@
<ComboBox ItemsSource="{Binding Source={StaticResource RecycleBinGroups}}" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" IsEnabled="{Binding IsChecked, ElementName=RadioButton}" />
</StackPanel>
<TextBlock x:Uid="SettingsDatabaseEncryption" Style="{StaticResource TextBlockSettingsHeaderStyle}" Margin="5,20,0,10" />
<ComboBox ItemsSource="{Binding Source={StaticResource Ciphers}}" SelectedIndex="{Binding CipherIndex, Mode=TwoWay}" ItemContainerStyle="{StaticResource MainColorComboBoxItem}" Style="{StaticResource MainColorComboBox}" />
<ComboBox ItemsSource="{Binding Source={StaticResource Ciphers}}" DisplayMemberPath="Name" SelectedItem="{Binding SelectedCipher, Mode=TwoWay}" ItemContainerStyle="{StaticResource MainColorComboBoxItem}" Style="{StaticResource MainColorComboBox}" />
<TextBlock x:Uid="SettingsDatabaseCompression" Style="{StaticResource TextBlockSettingsHeaderStyle}" Margin="5,20,0,10" />
<ComboBox ItemsSource="{Binding Source={StaticResource Compressions}}" SelectedItem="{Binding CompressionName, Mode=TwoWay}" ItemContainerStyle="{StaticResource MainColorComboBoxItem}" Style="{StaticResource MainColorComboBox}" />
<ComboBox ItemsSource="{Binding Source={StaticResource Compressions}}" SelectedItem="{Binding SelectedCompression, Mode=TwoWay}" ItemContainerStyle="{StaticResource MainColorComboBoxItem}" Style="{StaticResource MainColorComboBox}" />
<TextBlock x:Uid="SettingsDatabaseKdf" Style="{StaticResource TextBlockSettingsHeaderStyle}" Margin="5,20,0,10" />
<ComboBox ItemsSource="{Binding Source={StaticResource KeyDerivations}}" SelectedItem="{Binding KeyDerivationName, Mode=TwoWay}" ItemContainerStyle="{StaticResource MainColorComboBoxItem}" Style="{StaticResource MainColorComboBox}" />
<ComboBox ItemsSource="{Binding Source={StaticResource KeyDerivations}}" DisplayMemberPath="Name" SelectedItem="{Binding SelectedKeyDerivation, Mode=TwoWay}" ItemContainerStyle="{StaticResource MainColorComboBoxItem}" Style="{StaticResource MainColorComboBox}" />
</StackPanel>
</Page>

View File

@@ -95,7 +95,7 @@ namespace ModernKeePass.Views.UserControls
if (UpdateKey)
{
await Model.UpdateKey();
ValidationChecked?.Invoke(this, new PasswordEventArgs(Model.RootGroup));
ValidationChecked?.Invoke(this, new PasswordEventArgs(new GroupVm(Model.RootGroup, null)));
}
else
{
@@ -175,7 +175,7 @@ namespace ModernKeePass.Views.UserControls
ButtonLabel = resource.GetResourceValue("CompositeKeyOpening");
if (await Dispatcher.RunTaskAsync(async () => await Model.OpenDatabase(DatabaseFile, CreateNew)))
{
ValidationChecked?.Invoke(this, new PasswordEventArgs(Model.RootGroup));
ValidationChecked?.Invoke(this, new PasswordEventArgs(new GroupVm(Model.RootGroup, null)));
}
ButtonLabel = oldLabel;

View File

@@ -149,7 +149,7 @@
<Compile Include="Converters\EmptyStringToVisibilityConverter.cs" />
<Compile Include="Converters\NullToBooleanConverter.cs" />
<Compile Include="Extensions\DispatcherTaskExtensions.cs" />
<Compile Include="Interfaces\IDatabaseService.cs" />
<Content Include="Interfaces\IDatabaseService.cs" />
<Compile Include="Interfaces\IHasSelectableObject.cs" />
<Compile Include="Interfaces\ISelectableModel.cs" />
<Compile Include="Views\BasePages\LayoutAwarePageBase.cs" />
@@ -404,10 +404,6 @@
<HintPath>..\packages\AutoMapper.Extensions.Microsoft.DependencyInjection.2.0.1\lib\netstandard1.1\AutoMapper.Extensions.Microsoft.DependencyInjection.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="BouncyCastle.Crypto, Version=1.8.5.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
<HintPath>..\packages\Portable.BouncyCastle.1.8.5\lib\netstandard1.0\BouncyCastle.Crypto.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="FluentValidation, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7de548da2fbae0f0, processorArchitecture=MSIL">
<HintPath>..\packages\FluentValidation.8.6.2\lib\netstandard1.1\FluentValidation.dll</HintPath>
<Private>True</Private>
@@ -428,6 +424,10 @@
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.1.1.1\lib\netstandard1.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Graphics.Canvas, Version=255.255.255.255, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Win2D.win81.1.21.0\lib\win\Microsoft.Graphics.Canvas.winmd</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.HockeyApp.Core45, Version=4.1.6.1005, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\HockeySDK.Core.4.1.6\lib\portable-net45+win8+wp8+wpa81+win81+uap10.0\Microsoft.HockeyApp.Core45.dll</HintPath>
<Private>True</Private>
@@ -440,22 +440,6 @@
<HintPath>..\packages\Microsoft.Toolkit.Uwp.Notifications.2.0.0\lib\dotnet\Microsoft.Toolkit.Uwp.Notifications.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="ModernKeePassLib, Version=2.44.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ModernKeePassLib.2.44.1\lib\netstandard1.2\ModernKeePassLib.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SixLabors.Core, Version=0.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SixLabors.Core.1.0.0-beta0006\lib\netstandard1.1\SixLabors.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SixLabors.ImageSharp, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SixLabors.ImageSharp.1.0.0-beta0005\lib\netstandard1.1\SixLabors.ImageSharp.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Splat, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Splat.3.0.0\lib\netstandard1.1\Splat.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.0\lib\netstandard1.1\System.Buffers.dll</HintPath>
<Private>True</Private>
@@ -594,6 +578,13 @@
<VisualStudioVersion>12.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<Import Project="..\packages\Win2D.win81.1.21.0\build\win\Win2D.win81.targets" Condition="Exists('..\packages\Win2D.win81.1.21.0\build\win\Win2D.win81.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Win2D.win81.1.21.0\build\win\Win2D.win81.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Win2D.win81.1.21.0\build\win\Win2D.win81.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

View File

@@ -14,12 +14,7 @@
<package id="Microsoft.NETCore.Portable.Compatibility" version="1.0.1" targetFramework="win81" />
<package id="Microsoft.NETCore.UniversalWindowsPlatform" version="6.1.7" targetFramework="win81" />
<package id="Microsoft.Toolkit.Uwp.Notifications" version="2.0.0" targetFramework="win81" />
<package id="ModernKeePassLib" version="2.44.1" targetFramework="win81" />
<package id="NETStandard.Library" version="2.0.3" targetFramework="win81" />
<package id="Portable.BouncyCastle" version="1.8.5" targetFramework="win81" />
<package id="SixLabors.Core" version="1.0.0-beta0006" targetFramework="win81" />
<package id="SixLabors.ImageSharp" version="1.0.0-beta0005" targetFramework="win81" />
<package id="Splat" version="3.0.0" targetFramework="win81" />
<package id="System.Buffers" version="4.5.0" targetFramework="win81" />
<package id="System.Collections" version="4.3.0" targetFramework="win81" />
<package id="System.Collections.Concurrent" version="4.3.0" targetFramework="win81" />
@@ -57,4 +52,5 @@
<package id="System.Threading.Tasks.Parallel" version="4.3.0" targetFramework="win81" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="win81" />
<package id="System.Xml.XmlSerializer" version="4.3.0" targetFramework="win81" />
<package id="Win2D.win81" version="1.21.0" targetFramework="win81" />
</packages>