Cleanup code

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

3
.gitignore vendored
View File

@@ -38,4 +38,5 @@ packages/
project.lock.json project.lock.json
AppPackages/ AppPackages/
BundleArtifacts/ BundleArtifacts/
*.DotSettings *.DotSettings
/ModernKeePass/Win81App_StoreKey.pfx

View File

@@ -26,6 +26,16 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize> <Optimize>true</Optimize>

View File

@@ -27,7 +27,7 @@ namespace ModernKeePass.Application.Common.Interfaces
void CloseDatabase(); void CloseDatabase();
Task AddEntry(string parentGroupId, string entryId); Task AddEntry(string parentGroupId, string entryId);
Task InsertEntry(string parentGroupId, string entryId, int messageIndex); Task InsertEntry(string parentGroupId, string entryId, int index);
Task AddGroup(string parentGroupId, string groupId); Task AddGroup(string parentGroupId, string groupId);
void UpdateEntry(string entryId, string fieldName, object fieldValue); void UpdateEntry(string entryId, string fieldName, object fieldValue);
void UpdateGroup(string groupId); void UpdateGroup(string groupId);

View File

@@ -1,5 +1,4 @@
using System.Collections.Generic; using ModernKeePass.Domain.Enums;
using ModernKeePass.Domain.Enums;
namespace ModernKeePass.Application.Common.Interfaces namespace ModernKeePass.Application.Common.Interfaces
{ {

View File

@@ -39,9 +39,9 @@ namespace ModernKeePass.Application.Database.Commands.CreateDatabase
if (message.CreateSampleData) if (message.CreateSampleData)
{ {
var bankingGroup = _database.CreateGroup(_database.RootGroupId, "Banking"); _database.CreateGroup(_database.RootGroupId, "Banking");
var emailGroup = _database.CreateGroup(_database.RootGroupId, "Email"); _database.CreateGroup(_database.RootGroupId, "Email");
var internetGroup = _database.CreateGroup(_database.RootGroupId, "Internet"); _database.CreateGroup(_database.RootGroupId, "Internet");
var sample1 = _database.CreateEntry(_database.RootGroupId); var sample1 = _database.CreateEntry(_database.RootGroupId);
_database.UpdateEntry(sample1.Id, EntryFieldName.Title, "Sample Entry" ); _database.UpdateEntry(sample1.Id, EntryFieldName.Title, "Sample Entry" );

View File

@@ -1,4 +1,5 @@
using MediatR; using System;
using MediatR;
using System.Threading.Tasks; using System.Threading.Tasks;
using ModernKeePass.Application.Common.Interfaces; using ModernKeePass.Application.Common.Interfaces;
using ModernKeePass.Domain.Exceptions; using ModernKeePass.Domain.Exceptions;
@@ -24,22 +25,34 @@ namespace ModernKeePass.Application.Database.Commands.SaveDatabase
{ {
if (!_database.IsOpen) throw new DatabaseClosedException(); if (!_database.IsOpen) throw new DatabaseClosedException();
byte[] contents; try
if (string.IsNullOrEmpty(message.FilePath))
{ {
contents = await _database.SaveDatabase(); byte[] contents;
await _file.WriteBinaryContentsToFile(_database.FileAccessToken, contents); if (string.IsNullOrEmpty(message.FilePath))
{
contents = await _database.SaveDatabase();
// Test DB integrity before writing changes to file
_database.CloseDatabase();
var file = await _file.OpenBinaryFile(_database.FileAccessToken);
await _database.ReOpen(file);
await _file.WriteBinaryContentsToFile(_database.FileAccessToken, contents);
}
else
{
var newFileContents = await _file.OpenBinaryFile(message.FilePath);
contents = await _database.SaveDatabase(newFileContents);
await _file.WriteBinaryContentsToFile(message.FilePath, contents);
_file.ReleaseFile(_database.FileAccessToken);
_database.FileAccessToken = message.FilePath;
}
} }
else catch (Exception exception)
{ {
var newFileContents = await _file.OpenBinaryFile(message.FilePath); throw new SaveException(exception);
contents = await _database.SaveDatabase(newFileContents);
await _file.WriteBinaryContentsToFile(message.FilePath, contents);
_file.ReleaseFile(_database.FileAccessToken);
_database.FileAccessToken = message.FilePath;
} }
} }
} }
} }

View File

@@ -1,6 +1,4 @@
using ModernKeePass.Application.Group.Models; namespace ModernKeePass.Application.Database.Models
namespace ModernKeePass.Application.Database.Models
{ {
public class DatabaseVm public class DatabaseVm
{ {

View File

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

View File

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

View File

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

View File

@@ -24,23 +24,6 @@ namespace ModernKeePass.Application.Group.Commands.AddEntry
public async Task Handle(AddEntryCommand message) public async Task Handle(AddEntryCommand message)
{ {
if (!_database.IsOpen) throw new DatabaseClosedException(); if (!_database.IsOpen) throw new DatabaseClosedException();
/*var entryEntity = new EntryEntity
{
Id = message.Entry.Id,
Name = message.Entry.Title,
UserName = message.Entry.Username,
Password = message.Entry.Password,
Url = message.Entry.Url,
Notes = message.Entry.Notes,
HasExpirationDate = message.Entry.HasExpirationDate,
ExpirationDate = message.Entry.ExpirationDate,
LastModificationDate = message.Entry.ModificationDate,
BackgroundColor = message.Entry.BackgroundColor,
ForegroundColor = message.Entry.ForegroundColor,
Icon = message.Entry.Icon,
AdditionalFields = message.Entry.AdditionalFields,
History = message.Entry.History
};*/
await _database.AddEntry(message.ParentGroup.Id, message.Entry.Id); await _database.AddEntry(message.ParentGroup.Id, message.Entry.Id);
message.ParentGroup.Entries.Add(message.Entry); message.ParentGroup.Entries.Add(message.Entry);

View File

@@ -1,7 +1,5 @@
using System.Resources; using System.Resources;
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information

View File

@@ -26,6 +26,16 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize> <Optimize>true</Optimize>

View File

@@ -1,6 +1,6 @@
namespace ModernKeePass.Domain.Enums namespace ModernKeePass.Domain.Enums
{ {
public class EntryFieldName public static class EntryFieldName
{ {
public const string Title = nameof(Title); public const string Title = nameof(Title);
public const string UserName = nameof(UserName); public const string UserName = nameof(UserName);

View File

@@ -1,7 +1,5 @@
using System.Resources; using System.Resources;
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information

View File

@@ -34,6 +34,16 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize> <Optimize>true</Optimize>

View File

@@ -6,7 +6,6 @@ using ModernKeePass.Application.Common.Interfaces;
using ModernKeePass.Domain.Dtos; using ModernKeePass.Domain.Dtos;
using ModernKeePass.Domain.Entities; using ModernKeePass.Domain.Entities;
using ModernKeePass.Domain.Enums; using ModernKeePass.Domain.Enums;
using ModernKeePass.Domain.Exceptions;
using ModernKeePass.Domain.Interfaces; using ModernKeePass.Domain.Interfaces;
using ModernKeePassLib; using ModernKeePassLib;
using ModernKeePassLib.Cryptography.KeyDerivation; using ModernKeePassLib.Cryptography.KeyDerivation;
@@ -126,6 +125,8 @@ namespace ModernKeePass.Infrastructure.KeePass
_pwDatabase.Name = name; _pwDatabase.Name = name;
_pwDatabase.RootGroup.Name = name; _pwDatabase.RootGroup.Name = name;
_credentials = credentials;
switch (version) switch (version)
{ {
case DatabaseVersion.V4: case DatabaseVersion.V4:
@@ -142,34 +143,20 @@ namespace ModernKeePass.Infrastructure.KeePass
public async Task<byte[]> SaveDatabase() public async Task<byte[]> SaveDatabase()
{ {
try return await Task.Run(() =>
{ {
return await Task.Run(() => _pwDatabase.Save(new NullStatusLogger());
{ return _pwDatabase.IOConnectionInfo.Bytes;
_pwDatabase.Save(new NullStatusLogger()); });
return _pwDatabase.IOConnectionInfo.Bytes;
});
}
catch (Exception e)
{
throw new SaveException(e);
}
} }
public async Task<byte[]> SaveDatabase(byte[] newFileContents) public async Task<byte[]> SaveDatabase(byte[] newFileContents)
{ {
try return await Task.Run(() =>
{ {
return await Task.Run(() => _pwDatabase.SaveAs(IOConnectionInfo.FromByteArray(newFileContents), true, new NullStatusLogger());
{ return _pwDatabase.IOConnectionInfo.Bytes;
_pwDatabase.SaveAs(IOConnectionInfo.FromByteArray(newFileContents), true, new NullStatusLogger()); });
return _pwDatabase.IOConnectionInfo.Bytes;
});
}
catch (Exception e)
{
throw new SaveException(e);
}
} }
public void CloseDatabase() public void CloseDatabase()

View File

@@ -1,7 +1,5 @@
using System.Resources; using System.Resources;
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information

View File

@@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Windows.Storage.AccessCache; using Windows.Storage.AccessCache;
using ModernKeePass.Application.Common.Interfaces; using ModernKeePass.Application.Common.Interfaces;

View File

@@ -70,7 +70,7 @@ namespace ModernKeePass.KeePassDatabaseTests
var path = Path.Combine(Path.GetTempPath(), "NewDatabase.kdbx"); var path = Path.Combine(Path.GetTempPath(), "NewDatabase.kdbx");
var newFile = await _fileProxy.OpenBinaryFile(path); var newFile = await _fileProxy.OpenBinaryFile(path);
await _database.Create(newFile, _credentials); await _database.Create(_credentials, "NewDatabase");
var result = await _database.SaveDatabase(); var result = await _database.SaveDatabase();
await _fileProxy.WriteBinaryContentsToFile(path, result); await _fileProxy.WriteBinaryContentsToFile(path, result);
_database.CloseDatabase(); _database.CloseDatabase();

View File

@@ -1,7 +1,7 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16 # Visual Studio 14
VisualStudioVersion = 16.0.29911.84 VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Win81App", "ModernKeePass\Win81App.csproj", "{A0CFC681-769B-405A-8482-0CDEE595A91F}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Win81App", "ModernKeePass\Win81App.csproj", "{A0CFC681-769B-405A-8482-0CDEE595A91F}"
EndProject EndProject
@@ -11,6 +11,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{107C7C00
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "solution items", "solution items", "{3779FC26-0435-4823-81F5-3F27A525E991}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "solution items", "solution items", "{3779FC26-0435-4823-81F5-3F27A525E991}"
ProjectSection(SolutionItems) = preProject ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
LICENSE = LICENSE
PRIVACY = PRIVACY PRIVACY = PRIVACY
README.md = README.md README.md = README.md
UpdateVersion.ps1 = UpdateVersion.ps1 UpdateVersion.ps1 = UpdateVersion.ps1
@@ -94,50 +96,50 @@ Global
{7E80F5E7-724A-4668-9333-B10F5D75C6D0}.Release|x86.Deploy.0 = Release|x86 {7E80F5E7-724A-4668-9333-B10F5D75C6D0}.Release|x86.Deploy.0 = Release|x86
{42353562-5E43-459C-8E3E-2F21E575261D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {42353562-5E43-459C-8E3E-2F21E575261D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{42353562-5E43-459C-8E3E-2F21E575261D}.Debug|Any CPU.Build.0 = Debug|Any CPU {42353562-5E43-459C-8E3E-2F21E575261D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{42353562-5E43-459C-8E3E-2F21E575261D}.Debug|ARM.ActiveCfg = Debug|Any CPU {42353562-5E43-459C-8E3E-2F21E575261D}.Debug|ARM.ActiveCfg = Debug|ARM
{42353562-5E43-459C-8E3E-2F21E575261D}.Debug|ARM.Build.0 = Debug|Any CPU {42353562-5E43-459C-8E3E-2F21E575261D}.Debug|ARM.Build.0 = Debug|ARM
{42353562-5E43-459C-8E3E-2F21E575261D}.Debug|x64.ActiveCfg = Debug|Any CPU {42353562-5E43-459C-8E3E-2F21E575261D}.Debug|x64.ActiveCfg = Debug|x64
{42353562-5E43-459C-8E3E-2F21E575261D}.Debug|x64.Build.0 = Debug|Any CPU {42353562-5E43-459C-8E3E-2F21E575261D}.Debug|x64.Build.0 = Debug|x64
{42353562-5E43-459C-8E3E-2F21E575261D}.Debug|x86.ActiveCfg = Debug|Any CPU {42353562-5E43-459C-8E3E-2F21E575261D}.Debug|x86.ActiveCfg = Debug|Any CPU
{42353562-5E43-459C-8E3E-2F21E575261D}.Debug|x86.Build.0 = Debug|Any CPU {42353562-5E43-459C-8E3E-2F21E575261D}.Debug|x86.Build.0 = Debug|Any CPU
{42353562-5E43-459C-8E3E-2F21E575261D}.Release|Any CPU.ActiveCfg = Release|Any CPU {42353562-5E43-459C-8E3E-2F21E575261D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{42353562-5E43-459C-8E3E-2F21E575261D}.Release|Any CPU.Build.0 = Release|Any CPU {42353562-5E43-459C-8E3E-2F21E575261D}.Release|Any CPU.Build.0 = Release|Any CPU
{42353562-5E43-459C-8E3E-2F21E575261D}.Release|ARM.ActiveCfg = Release|Any CPU {42353562-5E43-459C-8E3E-2F21E575261D}.Release|ARM.ActiveCfg = Release|ARM
{42353562-5E43-459C-8E3E-2F21E575261D}.Release|ARM.Build.0 = Release|Any CPU {42353562-5E43-459C-8E3E-2F21E575261D}.Release|ARM.Build.0 = Release|ARM
{42353562-5E43-459C-8E3E-2F21E575261D}.Release|x64.ActiveCfg = Release|Any CPU {42353562-5E43-459C-8E3E-2F21E575261D}.Release|x64.ActiveCfg = Release|x64
{42353562-5E43-459C-8E3E-2F21E575261D}.Release|x64.Build.0 = Release|Any CPU {42353562-5E43-459C-8E3E-2F21E575261D}.Release|x64.Build.0 = Release|x64
{42353562-5E43-459C-8E3E-2F21E575261D}.Release|x86.ActiveCfg = Release|Any CPU {42353562-5E43-459C-8E3E-2F21E575261D}.Release|x86.ActiveCfg = Release|Any CPU
{42353562-5E43-459C-8E3E-2F21E575261D}.Release|x86.Build.0 = Release|Any CPU {42353562-5E43-459C-8E3E-2F21E575261D}.Release|x86.Build.0 = Release|Any CPU
{9A0759F1-9069-4841-99E3-3BEC44E17356}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9A0759F1-9069-4841-99E3-3BEC44E17356}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9A0759F1-9069-4841-99E3-3BEC44E17356}.Debug|Any CPU.Build.0 = Debug|Any CPU {9A0759F1-9069-4841-99E3-3BEC44E17356}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9A0759F1-9069-4841-99E3-3BEC44E17356}.Debug|ARM.ActiveCfg = Debug|Any CPU {9A0759F1-9069-4841-99E3-3BEC44E17356}.Debug|ARM.ActiveCfg = Debug|ARM
{9A0759F1-9069-4841-99E3-3BEC44E17356}.Debug|ARM.Build.0 = Debug|Any CPU {9A0759F1-9069-4841-99E3-3BEC44E17356}.Debug|ARM.Build.0 = Debug|ARM
{9A0759F1-9069-4841-99E3-3BEC44E17356}.Debug|x64.ActiveCfg = Debug|Any CPU {9A0759F1-9069-4841-99E3-3BEC44E17356}.Debug|x64.ActiveCfg = Debug|x64
{9A0759F1-9069-4841-99E3-3BEC44E17356}.Debug|x64.Build.0 = Debug|Any CPU {9A0759F1-9069-4841-99E3-3BEC44E17356}.Debug|x64.Build.0 = Debug|x64
{9A0759F1-9069-4841-99E3-3BEC44E17356}.Debug|x86.ActiveCfg = Debug|Any CPU {9A0759F1-9069-4841-99E3-3BEC44E17356}.Debug|x86.ActiveCfg = Debug|Any CPU
{9A0759F1-9069-4841-99E3-3BEC44E17356}.Debug|x86.Build.0 = Debug|Any CPU {9A0759F1-9069-4841-99E3-3BEC44E17356}.Debug|x86.Build.0 = Debug|Any CPU
{9A0759F1-9069-4841-99E3-3BEC44E17356}.Release|Any CPU.ActiveCfg = Release|Any CPU {9A0759F1-9069-4841-99E3-3BEC44E17356}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9A0759F1-9069-4841-99E3-3BEC44E17356}.Release|Any CPU.Build.0 = Release|Any CPU {9A0759F1-9069-4841-99E3-3BEC44E17356}.Release|Any CPU.Build.0 = Release|Any CPU
{9A0759F1-9069-4841-99E3-3BEC44E17356}.Release|ARM.ActiveCfg = Release|Any CPU {9A0759F1-9069-4841-99E3-3BEC44E17356}.Release|ARM.ActiveCfg = Release|ARM
{9A0759F1-9069-4841-99E3-3BEC44E17356}.Release|ARM.Build.0 = Release|Any CPU {9A0759F1-9069-4841-99E3-3BEC44E17356}.Release|ARM.Build.0 = Release|ARM
{9A0759F1-9069-4841-99E3-3BEC44E17356}.Release|x64.ActiveCfg = Release|Any CPU {9A0759F1-9069-4841-99E3-3BEC44E17356}.Release|x64.ActiveCfg = Release|x64
{9A0759F1-9069-4841-99E3-3BEC44E17356}.Release|x64.Build.0 = Release|Any CPU {9A0759F1-9069-4841-99E3-3BEC44E17356}.Release|x64.Build.0 = Release|x64
{9A0759F1-9069-4841-99E3-3BEC44E17356}.Release|x86.ActiveCfg = Release|Any CPU {9A0759F1-9069-4841-99E3-3BEC44E17356}.Release|x86.ActiveCfg = Release|Any CPU
{9A0759F1-9069-4841-99E3-3BEC44E17356}.Release|x86.Build.0 = Release|Any CPU {9A0759F1-9069-4841-99E3-3BEC44E17356}.Release|x86.Build.0 = Release|Any CPU
{09577E4C-4899-45B9-BF80-1803D617CCAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {09577E4C-4899-45B9-BF80-1803D617CCAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{09577E4C-4899-45B9-BF80-1803D617CCAE}.Debug|Any CPU.Build.0 = Debug|Any CPU {09577E4C-4899-45B9-BF80-1803D617CCAE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{09577E4C-4899-45B9-BF80-1803D617CCAE}.Debug|ARM.ActiveCfg = Debug|Any CPU {09577E4C-4899-45B9-BF80-1803D617CCAE}.Debug|ARM.ActiveCfg = Debug|ARM
{09577E4C-4899-45B9-BF80-1803D617CCAE}.Debug|ARM.Build.0 = Debug|Any CPU {09577E4C-4899-45B9-BF80-1803D617CCAE}.Debug|ARM.Build.0 = Debug|ARM
{09577E4C-4899-45B9-BF80-1803D617CCAE}.Debug|x64.ActiveCfg = Debug|Any CPU {09577E4C-4899-45B9-BF80-1803D617CCAE}.Debug|x64.ActiveCfg = Debug|x64
{09577E4C-4899-45B9-BF80-1803D617CCAE}.Debug|x64.Build.0 = Debug|Any CPU {09577E4C-4899-45B9-BF80-1803D617CCAE}.Debug|x64.Build.0 = Debug|x64
{09577E4C-4899-45B9-BF80-1803D617CCAE}.Debug|x86.ActiveCfg = Debug|Any CPU {09577E4C-4899-45B9-BF80-1803D617CCAE}.Debug|x86.ActiveCfg = Debug|Any CPU
{09577E4C-4899-45B9-BF80-1803D617CCAE}.Debug|x86.Build.0 = Debug|Any CPU {09577E4C-4899-45B9-BF80-1803D617CCAE}.Debug|x86.Build.0 = Debug|Any CPU
{09577E4C-4899-45B9-BF80-1803D617CCAE}.Release|Any CPU.ActiveCfg = Release|Any CPU {09577E4C-4899-45B9-BF80-1803D617CCAE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{09577E4C-4899-45B9-BF80-1803D617CCAE}.Release|Any CPU.Build.0 = Release|Any CPU {09577E4C-4899-45B9-BF80-1803D617CCAE}.Release|Any CPU.Build.0 = Release|Any CPU
{09577E4C-4899-45B9-BF80-1803D617CCAE}.Release|ARM.ActiveCfg = Release|Any CPU {09577E4C-4899-45B9-BF80-1803D617CCAE}.Release|ARM.ActiveCfg = Release|ARM
{09577E4C-4899-45B9-BF80-1803D617CCAE}.Release|ARM.Build.0 = Release|Any CPU {09577E4C-4899-45B9-BF80-1803D617CCAE}.Release|ARM.Build.0 = Release|ARM
{09577E4C-4899-45B9-BF80-1803D617CCAE}.Release|x64.ActiveCfg = Release|Any CPU {09577E4C-4899-45B9-BF80-1803D617CCAE}.Release|x64.ActiveCfg = Release|x64
{09577E4C-4899-45B9-BF80-1803D617CCAE}.Release|x64.Build.0 = Release|Any CPU {09577E4C-4899-45B9-BF80-1803D617CCAE}.Release|x64.Build.0 = Release|x64
{09577E4C-4899-45B9-BF80-1803D617CCAE}.Release|x86.ActiveCfg = Release|Any CPU {09577E4C-4899-45B9-BF80-1803D617CCAE}.Release|x86.ActiveCfg = Release|Any CPU
{09577E4C-4899-45B9-BF80-1803D617CCAE}.Release|x86.Build.0 = Release|Any CPU {09577E4C-4899-45B9-BF80-1803D617CCAE}.Release|x86.Build.0 = Release|Any CPU
{52FEA1EE-2FA7-4862-85FE-CB05893D439E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {52FEA1EE-2FA7-4862-85FE-CB05893D439E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU

View File

@@ -364,5 +364,28 @@
</ReservedNames> </ReservedNames>
</ProductReservedInfo> </ProductReservedInfo>
<AccountPackageIdentityNames /> <AccountPackageIdentityNames />
<PackageInfoList LandingUrl="https://developer.microsoft.com/dashboard/Application?appId=9MWQ48ZK8NHV" /> <PackageInfoList LandingUrl="https://developer.microsoft.com/dashboard/Application?appId=9MWQ48ZK8NHV">
<BundleInfo>
<PackageInfo>
<OsMinVersion>6.3.0.0</OsMinVersion>
<PackageArchitecture>Neutral</PackageArchitecture>
<PackageMaxArchitectureVersion>1.15.2557.0</PackageMaxArchitectureVersion>
</PackageInfo>
<PackageInfo>
<OsMinVersion>6.3.0.0</OsMinVersion>
<PackageArchitecture>Neutral</PackageArchitecture>
<PackageMaxArchitectureVersion>1.15.2557.0</PackageMaxArchitectureVersion>
</PackageInfo>
<PackageInfo>
<OsMinVersion>6.3.0.0</OsMinVersion>
<PackageArchitecture>Neutral</PackageArchitecture>
<PackageMaxArchitectureVersion>1.15.2557.0</PackageMaxArchitectureVersion>
</PackageInfo>
<PackageInfo>
<OsMinVersion>6.3.0.0</OsMinVersion>
<PackageArchitecture>Neutral</PackageArchitecture>
<PackageMaxArchitectureVersion>1.15.2557.0</PackageMaxArchitectureVersion>
</PackageInfo>
</BundleInfo>
</PackageInfoList>
</StoreAssociation> </StoreAssociation>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest"> <Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest">
<Identity Name="wismna.ModernKeePass" Publisher="CN=0719A91A-C322-4EE0-A257-E60733EECF06" Version="1.16.0.2" /> <Identity Name="wismna.ModernKeePass" Publisher="CN=0719A91A-C322-4EE0-A257-E60733EECF06" Version="1.16.0.12" />
<Properties> <Properties>
<DisplayName>ModernKeePass</DisplayName> <DisplayName>ModernKeePass</DisplayName>
<PublisherDisplayName>wismna</PublisherDisplayName> <PublisherDisplayName>wismna</PublisherDisplayName>

View File

@@ -74,7 +74,6 @@ namespace ModernKeePass.ViewModels
Title = resource.GetResourceValue("MainMenuItemNew"), Title = resource.GetResourceValue("MainMenuItemNew"),
PageType = typeof(NewDatabasePage), PageType = typeof(NewDatabasePage),
Destination = destinationFrame, Destination = destinationFrame,
Parameter = referenceFrame,
SymbolIcon = Symbol.Add SymbolIcon = Symbol.Add
}, },
new MainMenuItemVm new MainMenuItemVm

View File

@@ -1,14 +1,10 @@
using Windows.Storage; using Windows.Storage;
using MediatR;
using Microsoft.Extensions.DependencyInjection;
using ModernKeePass.Application.Common.Interfaces; using ModernKeePass.Application.Common.Interfaces;
namespace ModernKeePass.ViewModels namespace ModernKeePass.ViewModels
{ {
public class NewVm : OpenVm public class NewVm : OpenVm
{ {
private readonly IMediator _mediator;
private readonly ISettingsProxy _settings;
private string _importFormatHelp; private string _importFormatHelp;
public bool IsImportChecked { get; set; } public bool IsImportChecked { get; set; }
@@ -28,13 +24,5 @@ namespace ModernKeePass.ViewModels
OnPropertyChanged(nameof(ImportFormatHelp)); OnPropertyChanged(nameof(ImportFormatHelp));
} }
} }
public NewVm(): this(App.Services.GetService<IMediator>(), App.Services.GetService<ISettingsProxy>()) { }
public NewVm(IMediator mediator, ISettingsProxy settings)
{
_mediator = mediator;
_settings = settings;
}
} }
} }

View File

@@ -4,10 +4,8 @@ using Windows.Storage.AccessCache;
using Windows.Storage.Pickers; using Windows.Storage.Pickers;
using Windows.UI.Xaml; using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
using ModernKeePass.Common; using ModernKeePass.Common;
using ModernKeePass.Domain.Dtos; using ModernKeePass.Domain.Dtos;
using ModernKeePass.Events;
using ModernKeePass.Infrastructure.File; using ModernKeePass.Infrastructure.File;
using ModernKeePass.ViewModels; using ModernKeePass.ViewModels;
@@ -20,20 +18,12 @@ namespace ModernKeePass.Views
/// </summary> /// </summary>
public sealed partial class NewDatabasePage public sealed partial class NewDatabasePage
{ {
private Frame _mainFrame;
public NewVm Model => (NewVm)DataContext; public NewVm Model => (NewVm)DataContext;
public NewDatabasePage() public NewDatabasePage()
{ {
InitializeComponent(); InitializeComponent();
} }
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
_mainFrame = e.Parameter as Frame;
}
private async void CreateDatabaseButton_OnClick(object sender, RoutedEventArgs e) private async void CreateDatabaseButton_OnClick(object sender, RoutedEventArgs e)
{ {

View File

@@ -14,10 +14,10 @@
<MinimumVisualStudioVersion>12</MinimumVisualStudioVersion> <MinimumVisualStudioVersion>12</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <ProjectTypeGuids>{BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<PackageCertificateKeyFile>ModernKeePass_StoreKey.pfx</PackageCertificateKeyFile> <PackageCertificateKeyFile>Win81App_StoreKey.pfx</PackageCertificateKeyFile>
<PackageCertificateThumbprint>ED3AA34F46D03498F989901C5DB2742B65D72F60</PackageCertificateThumbprint> <PackageCertificateThumbprint>2F2C96140E5F198DC331284960C96B3174A25070</PackageCertificateThumbprint>
<AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision> <AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>
<AppxBundlePlatforms>x64</AppxBundlePlatforms> <AppxBundlePlatforms>x86|x64|arm</AppxBundlePlatforms>
<AppxBundle>Always</AppxBundle> <AppxBundle>Always</AppxBundle>
<NuGetPackageImportStamp> <NuGetPackageImportStamp>
</NuGetPackageImportStamp> </NuGetPackageImportStamp>
@@ -238,6 +238,7 @@
<None Include="packages.config"> <None Include="packages.config">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</None> </None>
<None Include="Win81App_StoreKey.pfx" />
<PRIResource Include="Strings\fr-FR\Resources.resw" /> <PRIResource Include="Strings\fr-FR\Resources.resw" />
<PRIResource Include="Strings\fr-FR\CodeBehind.resw" /> <PRIResource Include="Strings\fr-FR\CodeBehind.resw" />
<PRIResource Include="Strings\en-US\CodeBehind.resw" /> <PRIResource Include="Strings\en-US\CodeBehind.resw" />