diff --git a/Crypto Notepad/MainForm.cs b/Crypto Notepad/MainForm.cs index a4c7197..74a719d 100644 --- a/Crypto Notepad/MainForm.cs +++ b/Crypto Notepad/MainForm.cs @@ -100,7 +100,7 @@ private async Task DecryptAES() } string NameWithotPath = Path.GetFileName(openFileDialog.FileName); - Text = PublicVar.appName + " – " + NameWithotPath; + Text = NameWithotPath + " – " + PublicVar.appName; filePath = openFileDialog.FileName; PublicVar.openFileName = Path.GetFileName(openFileDialog.FileName); PublicVar.encryptionKey.Set(TypedPassword.Value); @@ -162,15 +162,7 @@ private async void OpenAsotiations() DialogResult res = MessageBox.Show(this, "Try to decrypt \"" + PublicVar.openFileName + "\" file?", PublicVar.appName, MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (res == DialogResult.No) - { - string opnfile = File.ReadAllText(args[1]); - string NameWithotPath = Path.GetFileName(args[1]); - richTextBox.Text = opnfile; - filePath = args[1]; - Text = PublicVar.appName + " – " + NameWithotPath; - StatusPanelFileInfo(); - return; - } + Text = NameWithotPath + " – " + PublicVar.appName; } await DecryptAES(); } @@ -195,7 +187,7 @@ private async void SendTo() string NameWithotPath = Path.GetFileName(argsPath); richTextBox.Text = opnfile; filePath = argsPath; - Text = PublicVar.appName + " – " + NameWithotPath; + Text = NameWithotPath + " – " + PublicVar.appName; StatusPanelFileInfo(); return; } @@ -465,6 +457,7 @@ private async Task UnlockFile() richTextBox.Text = await AES.Decrypt(openedFileText, TypedPassword.Value, null, settings.HashAlgorithm, Convert.ToInt32(settings.PasswordIterations), Convert.ToInt32(settings.KeySize)); ; } + richTextBox.Modified = false; fileLockedPanel.Visible = false; richTextBox.SelectionStart = caretPos; PublicVar.encryptionKey.Set(TypedPassword.Value); @@ -666,7 +659,7 @@ private void RichTextBox_ModifiedChanged(object sender, EventArgs e) { if (Text.Contains("*")) { - Text = Text.Substring(0, Text.Length - 1); + Text = Text.Replace("*", string.Empty); } } } @@ -918,7 +911,7 @@ private async void RichTextBox_DragDrop(object sender, DragEventArgs e) string opnfile = File.ReadAllText(openFileDialog.FileName); string NameWithotPath = Path.GetFileName(openFileDialog.FileName); richTextBox.Text = opnfile; - Text = PublicVar.appName + " – " + NameWithotPath; + Text = NameWithotPath + " – " + PublicVar.appName; filePath = openFileDialog.FileName; StatusPanelFileInfo(); return; @@ -938,22 +931,20 @@ private void RichTextBox_TextChanged(object sender, EventArgs e) { if (!Text.Contains("*")) { - Text += "*"; } - } else { if (Text.Contains("*")) { - Text = Text.Substring(0, Text.Length - 1); + Text = Text.Replace("*", string.Empty); } } if (richTextBox.TextLength == 0) { if (Text.Contains("*")) { - Text = Text.Substring(0, Text.Length - 1); + Text = Text.Replace("*", string.Empty); } } } @@ -1033,7 +1024,7 @@ private void NewMainMenu_Click(object sender, EventArgs e) PublicVar.encryptionKey.Set(TypedPassword.Value); StreamWriter sw = new StreamWriter(saveFileDialog.FileName); string NameWithotPath = Path.GetFileName(saveFileDialog.FileName); - Text = PublicVar.appName + " – " + NameWithotPath; + Text = NameWithotPath + " – " + PublicVar.appName; filePath = saveFileDialog.FileName; PublicVar.openFileName = Path.GetFileName(saveFileDialog.FileName); sw.Close(); @@ -1068,7 +1059,7 @@ private async void OpenMainMenu_Click(object sender, EventArgs e) string opnfile = File.ReadAllText(openFileDialog.FileName); string NameWithotPath = Path.GetFileName(openFileDialog.FileName); richTextBox.Text = opnfile; - Text = PublicVar.appName + " – " + NameWithotPath; + Text = NameWithotPath + " – " + PublicVar.appName; filePath = openFileDialog.FileName; StatusPanelFileInfo(); return;