Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tetradog committed Jul 19, 2020
1 parent f16e865 commit 5900771
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion SimpleEncrypt/EncryptDecryptFile.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:SimpleEncrypt"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
d:DesignHeight="450" d:DesignWidth="800" AllowDrop="True" PreviewDragOver="UserControl_PreviewDragOver" Drop="UserControl_Drop">
<Grid>

<Grid.ColumnDefinitions>
Expand Down
18 changes: 17 additions & 1 deletion SimpleEncrypt/EncryptDecryptFile.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.Win32;
using Gabriel.Cat.S.Extension;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.IO;
Expand Down Expand Up @@ -57,5 +58,20 @@ private void btnEncryptOrDecrypt_Click(object sender, RoutedEventArgs e)
MessageBox.Show("Hecho");

}

private void UserControl_PreviewDragOver(object sender, DragEventArgs e)
{
e.Handled = true;
}

private void UserControl_Drop(object sender, DragEventArgs e)
{
string path= e.Data.GetFilePath();
if (path != default)
{
txtUrlOrigen.Text = path;
txtUrlDestino.Text = path + ".bin";
}
}
}
}
7 changes: 5 additions & 2 deletions SimpleEncrypt/KeyManager.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private void btnAddKey_Click(object sender, System.Windows.RoutedEventArgs e)
{
keyToAdd =new KeyName(txtNameKey.Text, Key.GetKey(100));
keyToAdd.Save(KeysFolder);
KeysDic.Add(keyToAdd.Name, keyToAdd);
KeysDic.Add(keyToAdd.UniqueName, keyToAdd);
lstKeys.Items.Add(keyToAdd);
txtNameKey.Text = "";

Expand Down Expand Up @@ -77,7 +77,7 @@ public void LoadKeys()
{
aux = new KeyName(path);
lstKeys.Items.Add(aux);
KeysDic.Add(aux.Name, aux);
KeysDic.Add(aux.UniqueName, aux);
}
if (lstKeys.Items.Count > 0)
lstKeys.SelectedIndex = 0;
Expand Down Expand Up @@ -110,13 +110,16 @@ public class KeyName
public KeyName(string path)
{
Name = Path.GetFileNameWithoutExtension(path);
UniqueName = Path.GetFileName(path);
Key = (Key)KeyBin.GetObject(File.ReadAllBytes(path));
}
public KeyName(string name,Key key)
{
Name = name;
UniqueName = Name;
Key = key;
}
public string UniqueName { get; set; }
public string Name { get; set; }
public Key Key { get; set; }
public void Save(string folder)
Expand Down
2 changes: 1 addition & 1 deletion SimpleEncrypt/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
xmlns:local="clr-namespace:SimpleEncrypt"
xmlns:wpf="clr-namespace:Gabriel.Cat.Wpf;assembly=Gabriel.Cat.S.Wpf"
mc:Ignorable="d"
Title="Simple Encrypt" Height="450" Width="800" KeyDown="Window_KeyDown">
Title="Simple Encrypt V2.5" Height="450" Width="800" KeyDown="Window_KeyDown">
<TabControl>
<TabItem Header="Keys">
<local:KeyManager x:Name="keyManager" KeySelected="keyManager_KeySelected"/>
Expand Down

0 comments on commit 5900771

Please sign in to comment.