diff --git a/Crypto Notepad/ChangeKeyForm.cs b/Crypto Notepad/ChangeKeyForm.cs index 6f5bc4c..c09a35e 100644 --- a/Crypto Notepad/ChangeKeyForm.cs +++ b/Crypto Notepad/ChangeKeyForm.cs @@ -14,10 +14,10 @@ public ChangeKeyForm() private async void button1_Click(object sender, EventArgs e) { - if (textBox1.Text == publicVar.encryptionKey.Get() & textBox1.Text != textBox2.Text) + if (textBox1.Text == PublicVar.encryptionKey.Get() & textBox1.Text != textBox2.Text) { - publicVar.encryptionKey.Set(textBox2.Text); - publicVar.keyChanged = true; + PublicVar.encryptionKey.Set(textBox2.Text); + PublicVar.keyChanged = true; textBox1.Text = ""; textBox2.Text = ""; statusLabel.Text = "Key was successfully changed"; @@ -25,11 +25,10 @@ private async void button1_Click(object sender, EventArgs e) button1.Enabled = false; await Task.Delay(2000); statusLabel.Text = ""; - //this.Close(); return; } - if (textBox1.Text != publicVar.encryptionKey.Get()) + if (textBox1.Text != PublicVar.encryptionKey.Get()) { SystemSounds.Beep.Play(); statusLabel.Text = "Invalid old key"; diff --git a/Crypto Notepad/EncryptedString.cs b/Crypto Notepad/EncryptedString.cs index 64280eb..1f0824d 100644 --- a/Crypto Notepad/EncryptedString.cs +++ b/Crypto Notepad/EncryptedString.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Text; using System.Security.Cryptography; namespace Crypto_Notepad diff --git a/Crypto Notepad/Form2.Designer.cs b/Crypto Notepad/Form2.Designer.cs index f391622..5088c96 100644 --- a/Crypto Notepad/Form2.Designer.cs +++ b/Crypto Notepad/Form2.Designer.cs @@ -133,13 +133,12 @@ private void InitializeComponent() } #endregion - - private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.Button button1; private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.ToolTip toolTip1; private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Label label1; private System.Windows.Forms.PictureBox pictureBox2; + public System.Windows.Forms.TextBox textBox1; } } \ No newline at end of file diff --git a/Crypto Notepad/Form2.cs b/Crypto Notepad/Form2.cs index 22c9ecf..23f13d6 100644 --- a/Crypto Notepad/Form2.cs +++ b/Crypto Notepad/Form2.cs @@ -8,16 +8,15 @@ public partial class Form2 : Form public Form2() { // Initialize to false in case user presses the exit button - publicVar.okPressed = false; + PublicVar.okPressed = false; InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { - publicVar.encryptionKey.Set(textBox1.Text); + TypedPassword.Value = textBox1.Text; textBox1.Focus(); - textBox1.Text = ""; - publicVar.okPressed = true; + PublicVar.okPressed = true; this.Hide(); } @@ -57,12 +56,11 @@ private void pictureBox1_Click(object sender, EventArgs e) private void Form2_FormClosed(object sender, FormClosedEventArgs e) { textBox1.Focus(); - textBox1.Text = ""; } private void Form2_Load(object sender, EventArgs e) { - this.Text = publicVar.openFileName; + this.Text = PublicVar.openFileName; } } } diff --git a/Crypto Notepad/Program.cs b/Crypto Notepad/Program.cs index dd1c2c3..1816972 100644 --- a/Crypto Notepad/Program.cs +++ b/Crypto Notepad/Program.cs @@ -17,7 +17,6 @@ static void Main() } } - static class publicVar static class PublicVar { public static EncryptedString encryptionKey = new EncryptedString();