Skip to content

Commit

Permalink
Remove Create Key Store section. It was a complete duplicate with Ope…
Browse files Browse the repository at this point in the history
…n Key Store (with current key stores at least).
  • Loading branch information
Maxhy committed Oct 22, 2023
1 parent a620780 commit 734954f
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 71 deletions.
11 changes: 2 additions & 9 deletions KeyManager.Library.KeyStore.File/FileKeyStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,8 @@ public override Task Open()
log.Info(String.Format("Opening the key store `{0}`...", GetFileProperties().Fullpath));
if (!System.IO.Directory.Exists(GetFileProperties().Fullpath))
{
if (CreateIfMissing)
{
System.IO.Directory.CreateDirectory(GetFileProperties().Fullpath);
}
else
{
log.Error(string.Format("Cannot open the key sore `{0}`.", GetFileProperties().Fullpath));
throw new KeyStoreException("Cannot open the key sore.");
}
log.Error(string.Format("Cannot open the key sore `{0}`.", GetFileProperties().Fullpath));
throw new KeyStoreException("Cannot open the key sore.");
}
log.Info("Key store opened.");
return Task.CompletedTask;
Expand Down
2 changes: 0 additions & 2 deletions KeyManager.Library/KeyStore/KeyStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ protected KeyStore()

public IDictionary<KeyEntryClass, KeyEntry?> DefaultKeyEntries { get; set; }

public bool CreateIfMissing { get; set; }

public Task<bool> CheckKeyEntryExists(KeyEntry keyEntry)
{
return CheckKeyEntryExists(keyEntry.Identifier, keyEntry.KClass);
Expand Down
6 changes: 0 additions & 6 deletions KeyManager/HomeControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@
<Setter Property="Padding" Value="5,5" />
</Style>
</WrapPanel.Resources>
<materialDesign:Card x:Name="createKeyStore" HorizontalAlignment="Left" VerticalAlignment="Center" Height="175" Width="175" Cursor="Hand" MouseDown="CreateKeyStore_MouseDown">
<StackPanel HorizontalAlignment="Center">
<Label Content="{x:Static properties:Resources.CreateKeyStore}" HorizontalAlignment="Center" Margin="0,24,0,0" VerticalAlignment="Top"/>
<materialDesign:PackIcon Kind="CreateNewFolder" Height="87" Width="132"/>
</StackPanel>
</materialDesign:Card>
<materialDesign:Card x:Name="openKeyStore" HorizontalAlignment="Center" VerticalAlignment="Center" Height="175" Width="175" Cursor="Hand" MouseDown="OpenKeyStore_MouseDown">
<StackPanel HorizontalAlignment="Center">
<Label Content="{x:Static properties:Resources.OpenKeyStore}" HorizontalAlignment="Center" Margin="0,24,0,0" VerticalAlignment="Top"/>
Expand Down
39 changes: 0 additions & 39 deletions KeyManager/HomeControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,8 @@
using Leosac.KeyManager.Library.UI;
using Leosac.KeyManager.Library.UI.Domain;
using MaterialDesignThemes.Wpf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Leosac.KeyManager
{
Expand All @@ -30,32 +17,6 @@ public HomeControl()
InitializeComponent();
}

private async void CreateKeyStore_MouseDown(object sender, MouseButtonEventArgs e)
{
var model = new KeyStoreSelectorDialogViewModel { Message = Properties.Resources.CreateKeyStore };
var dialog = new KeyStoreSelectorDialog
{
DataContext = model
};

object? ret = await DialogHost.Show(dialog, "RootDialog");
if (ret != null)
{
if (DataContext is HomeControlViewModel homeModel)
{
var store = model.CreateKeyStore();
if (store != null)
{
store.CreateIfMissing = true;
if (homeModel.KeyStoreCommand != null)
{
await homeModel.KeyStoreCommand.ExecuteAsync(store);
}
}
}
}
}

private async void OpenKeyStore_MouseDown(object sender, MouseButtonEventArgs e)
{
var model = new KeyStoreSelectorDialogViewModel { Message = Properties.Resources.OpenKeyStore };
Expand Down
9 changes: 0 additions & 9 deletions KeyManager/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions KeyManager/Properties/Resources.fr.resx
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,6 @@
<data name="Confirm" xml:space="preserve">
<value>Confirmer</value>
</data>
<data name="CreateKeyStore" xml:space="preserve">
<value>Créer un nouveau magasin de clés</value>
</data>
<data name="DeleteFavorite" xml:space="preserve">
<value>Supprimer le magasin de clés des favoris</value>
</data>
Expand Down
3 changes: 0 additions & 3 deletions KeyManager/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,6 @@
<data name="Confirm" xml:space="preserve">
<value>Confirm</value>
</data>
<data name="CreateKeyStore" xml:space="preserve">
<value>Create a new Key Store</value>
</data>
<data name="DeleteFavorite" xml:space="preserve">
<value>Remove Key Store from favorites</value>
</data>
Expand Down

0 comments on commit 734954f

Please sign in to comment.