Corrected some Sonar issues

Changed a little bit the Open and Set credentials User controls
This commit is contained in:
Geoffroy BONNEVILLE
2020-05-02 14:21:59 +02:00
parent 7b88461333
commit 654bd6b4e5
16 changed files with 16 additions and 98 deletions

View File

@@ -25,7 +25,7 @@ namespace ModernKeePass.Application.Common.Interfaces
Task Open(byte[] file, Credentials credentials); Task Open(byte[] file, Credentials credentials);
Task ReOpen(byte[] file); Task ReOpen(byte[] file);
Task Create(Credentials credentials, string name, DatabaseVersion version = DatabaseVersion.V3); Task Create(Credentials credentials, string name, DatabaseVersion version = DatabaseVersion.V4);
Task<byte[]> SaveDatabase(); Task<byte[]> SaveDatabase();
Task<byte[]> SaveDatabase(byte[] newFileContents); Task<byte[]> SaveDatabase(byte[] newFileContents);
void UpdateCredentials(Credentials credentials); void UpdateCredentials(Credentials credentials);

View File

@@ -1,5 +1,4 @@
using System.Reflection; using System.Reflection;
using FluentValidation;
using MediatR; using MediatR;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using ModernKeePass.Application.Common.Behaviors; using ModernKeePass.Application.Common.Behaviors;
@@ -13,7 +12,6 @@ namespace ModernKeePass.Application
var assembly = typeof(DependencyInjection).GetTypeInfo().Assembly; var assembly = typeof(DependencyInjection).GetTypeInfo().Assembly;
services.AddMediatR(assembly); services.AddMediatR(assembly);
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(DirtyStatusBehavior<,>)); services.AddTransient(typeof(IPipelineBehavior<,>), typeof(DirtyStatusBehavior<,>));
//services.AddValidatorsFromAssembly(assembly);
return services; return services;
} }

View File

@@ -1,5 +1,4 @@
using System.Collections.Generic; using System.Linq;
using System.Linq;
using MediatR; using MediatR;
using ModernKeePass.Application.Common.Interfaces; using ModernKeePass.Application.Common.Interfaces;
using ModernKeePass.Application.Group.Models; using ModernKeePass.Application.Group.Models;

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.12" /> <Identity Name="wismna.ModernKeePass" Publisher="CN=0719A91A-C322-4EE0-A257-E60733EECF06" Version="1.17.0.12" />
<Properties> <Properties>
<DisplayName>ModernKeePass</DisplayName> <DisplayName>ModernKeePass</DisplayName>
<PublisherDisplayName>wismna</PublisherDisplayName> <PublisherDisplayName>wismna</PublisherDisplayName>

View File

@@ -3,7 +3,6 @@ using System.Linq;
using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls;
using GalaSoft.MvvmLight; using GalaSoft.MvvmLight;
using MediatR; using MediatR;
using Microsoft.Extensions.DependencyInjection;
using ModernKeePass.Application.Common.Interfaces; using ModernKeePass.Application.Common.Interfaces;
using ModernKeePass.Application.Database.Queries.GetDatabase; using ModernKeePass.Application.Database.Queries.GetDatabase;
using ModernKeePass.Domain.Interfaces; using ModernKeePass.Domain.Interfaces;

View File

@@ -11,7 +11,7 @@
<Page.Resources> <Page.Resources>
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/> <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
</Page.Resources> </Page.Resources>
<Grid x:Name="Grid" Background="{StaticResource ApplicationPageBackgroundThemeBrush}"> <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="40" /> <RowDefinition Height="40" />
<RowDefinition Height="*" /> <RowDefinition Height="*" />

View File

@@ -9,8 +9,6 @@ namespace ModernKeePass.Views
/// </summary> /// </summary>
public sealed partial class RecentDatabasesPage public sealed partial class RecentDatabasesPage
{ {
private RecentVm Model => (RecentVm)DataContext;
public RecentDatabasesPage() public RecentDatabasesPage()
{ {
InitializeComponent(); InitializeComponent();

View File

@@ -39,8 +39,7 @@
<CheckBox Grid.Row="1" Grid.Column="0" IsChecked="{Binding HasKeyFile, Mode=TwoWay}" /> <CheckBox Grid.Row="1" Grid.Column="0" IsChecked="{Binding HasKeyFile, Mode=TwoWay}" />
<HyperlinkButton Grid.Row="1" Grid.Column="1" Margin="-15,0,0,0" <HyperlinkButton Grid.Row="1" Grid.Column="1" Margin="-15,0,0,0"
x:Name="HyperlinkButton" x:Name="HyperlinkButton"
Content="{Binding KeyFileText}" Content="{Binding KeyFileText}"
IsEnabled="{Binding HasKeyFile}"
Click="KeyFileButton_Click" /> Click="KeyFileButton_Click" />
<Button Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="2" <Button Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="2"

View File

@@ -55,6 +55,7 @@ namespace ModernKeePass.Views.UserControls
var token = StorageApplicationPermissions.FutureAccessList.Add(file, file.Name); var token = StorageApplicationPermissions.FutureAccessList.Add(file, file.Name);
Model.KeyFilePath = token; Model.KeyFilePath = token;
Model.KeyFileText = file.Name; Model.KeyFileText = file.Name;
Model.HasKeyFile = true;
} }
} }
} }

View File

@@ -35,17 +35,13 @@
x:Uid="CompositeKeyPassword" x:Uid="CompositeKeyPassword"
x:Name="PasswordBox" x:Name="PasswordBox"
Password="{Binding Password, Mode=TwoWay}" Password="{Binding Password, Mode=TwoWay}"
IsPasswordRevealButtonEnabled="True" > IsEnabled="{Binding HasPassword}"
<interactivity:Interaction.Behaviors> IsPasswordRevealButtonEnabled="True" />
<core:EventTriggerBehavior EventName="GotFocus">
<core:ChangePropertyAction TargetObject="{Binding}" PropertyName="HasPassword" Value="True" />
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</PasswordBox>
<PasswordBox Grid.Row="1" Grid.Column="1" Height="30" <PasswordBox Grid.Row="1" Grid.Column="1" Height="30"
x:Uid="CompositeKeyConfirmPassword" x:Uid="CompositeKeyConfirmPassword"
x:Name="ConfirmPasswordBox" x:Name="ConfirmPasswordBox"
Password="{Binding ConfirmPassword, Mode=TwoWay}" Password="{Binding ConfirmPassword, Mode=TwoWay}"
IsEnabled="{Binding HasPassword}"
IsPasswordRevealButtonEnabled="True" /> IsPasswordRevealButtonEnabled="True" />
<ProgressBar Grid.Row="1" Grid.Column="1" <ProgressBar Grid.Row="1" Grid.Column="1"
Maximum="128" VerticalAlignment="Bottom" Maximum="128" VerticalAlignment="Bottom"

View File

@@ -1,7 +0,0 @@
Database corruption issues should now be a thing of the past:
Database integrity is checked after each save
Data is written to the filesystem using a transactional model (meaning: if an error occurs, the original file is left untouched)
Auto-save on suspend/exit is now only active when database has changes and its size is under 1MB
Added the ability to move entries and groups
Allows restoring and deleting from entry history
Updated KeePass lib to version 2.44

View File

@@ -1,7 +0,0 @@
Les problemes de corruption de bases de donn<6E>es sont maintenant totalement corrigees :
L'integrite de la base de donnees est verfiee apres chaque sauvegarde
Les donnees sont ecrites dans le systeme de fichiers en utilisant un modele transactionnel (autrement dit, s'il y a une erreur, le fichier original n'est pas modifie)
L'auto-sauvegarde lors de la suspension/sortie ne se fait que lorsqu'il y a eu des changements et que la taille de la base de donnees est inferieure a 1MB
Possibilite de deplacer des groupes et des entree
Possibilite de supprimer et restaurer des versions de l'historique d'entrees
Libraire mise a jour en version 2.44

View File

@@ -17,7 +17,7 @@ You can get it [here](https://www.microsoft.com/en-us/store/p/modernkeepass/9mwq
- Use Recycle Bin - Use Recycle Bin
- Search entries - Search entries
- Sort and reorder entries - Sort and reorder entries
- View entries history - View, delete and restore from entry history
- Use Semantic Zoom to see your entries in a grouped mode - Use Semantic Zoom to see your entries in a grouped mode
- List recently opened databases - List recently opened databases
- Open database from Windows Explorer - Open database from Windows Explorer
@@ -43,4 +43,4 @@ Otherwise, there are still many things left to implement:
# Credits # Credits
*Dominik Reichl* for the [KeePass application](https://keepass.info/), library and file format *Dominik Reichl* for the [KeePass application](https://keepass.info/), library and file format
*David Lechner* for his [PCL adapatation](https://github.com/dlech/KeePass2PCL) of the KeePass Library and the correlated tests which served as an inspiration basis for my own adaptation *David Lechner* for his [PCL adapatation](https://github.com/dlech/KeePass2PCL) of the KeePass Library and the related tests which served as an inspiration basis for my own adaptation

View File

@@ -1,20 +1,20 @@
namespace ModernKeePass.Common namespace ModernKeePass.Common
{ {
public class Constants public static class Constants
{ {
public class Navigation public static class Navigation
{ {
public static string MainPage => nameof(MainPage); public static string MainPage => nameof(MainPage);
public static string EntryPage => nameof(EntryPage); public static string EntryPage => nameof(EntryPage);
public static string GroupPage => nameof(GroupPage); public static string GroupPage => nameof(GroupPage);
} }
public class File public static class File
{ {
public static int OneMegaByte => 1048576; public static int OneMegaByte => 1048576;
} }
public class Settings public static class Settings
{ {
public static string SaveSuspend => nameof(SaveSuspend); public static string SaveSuspend => nameof(SaveSuspend);
public static string Sample => nameof(Sample); public static string Sample => nameof(Sample);

View File

@@ -1,56 +0,0 @@
using System;
using System.Threading.Tasks;
using Windows.UI.Popups;
namespace ModernKeePass.Common
{
public static class MessageDialogHelper
{
public static async Task ShowActionDialog(string title, string contentText, string actionButtonText, string cancelButtonText, UICommandInvokedHandler actionCommand, UICommandInvokedHandler cancelCommand)
{
// Create the message dialog and set its content
var messageDialog = CreateBasicDialog(title, contentText, cancelButtonText, cancelCommand);
// Add commands and set their callbacks; both buttons use the same callback function instead of inline event handlers
messageDialog.Commands.Add(new UICommand(actionButtonText, actionCommand));
// Show the message dialog
await messageDialog.ShowAsync().AsTask().ConfigureAwait(false);
}
public static async Task ShowErrorDialog(Exception exception)
{
if (exception == null) return;
// Create the message dialog and set its content
var messageDialog = CreateBasicDialog(exception.Message, exception.StackTrace, "OK");
// Show the message dialog
await messageDialog.ShowAsync().AsTask().ConfigureAwait(false);
}
public static async Task ShowNotificationDialog(string title, string message)
{
var dialog = CreateBasicDialog(title, message, "OK");
// Show the message dialog
await dialog.ShowAsync().AsTask().ConfigureAwait(false);
}
private static MessageDialog CreateBasicDialog(string title, string message, string dismissActionText, UICommandInvokedHandler cancelCommand = null)
{
// Create the message dialog and set its content
var messageDialog = new MessageDialog(message, title);
// Add commands and set their callbacks
messageDialog.Commands.Add(new UICommand(dismissActionText, cancelCommand));
// Set the command that will be invoked by default
messageDialog.DefaultCommandIndex = 1;
// Set the command to be invoked when escape is pressed
messageDialog.CancelCommandIndex = 1;
return messageDialog;
}
}
}

View File

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