Swapped the app name and the file name in the window title

This commit is contained in:
Alexander 2019-11-07 20:05:30 +02:00
parent 8db3dbd89d
commit feb0dcb16a

View file

@ -100,7 +100,7 @@ private async Task DecryptAES()
} }
string NameWithotPath = Path.GetFileName(openFileDialog.FileName); string NameWithotPath = Path.GetFileName(openFileDialog.FileName);
Text = PublicVar.appName + " " + NameWithotPath; Text = NameWithotPath + " " + PublicVar.appName;
filePath = openFileDialog.FileName; filePath = openFileDialog.FileName;
PublicVar.openFileName = Path.GetFileName(openFileDialog.FileName); PublicVar.openFileName = Path.GetFileName(openFileDialog.FileName);
PublicVar.encryptionKey.Set(TypedPassword.Value); 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, DialogResult res = MessageBox.Show(this, "Try to decrypt \"" + PublicVar.openFileName + "\" file?", PublicVar.appName,
MessageBoxButtons.YesNo, MessageBoxIcon.Information); MessageBoxButtons.YesNo, MessageBoxIcon.Information);
if (res == DialogResult.No) if (res == DialogResult.No)
{ Text = NameWithotPath + " " + PublicVar.appName;
string opnfile = File.ReadAllText(args[1]);
string NameWithotPath = Path.GetFileName(args[1]);
richTextBox.Text = opnfile;
filePath = args[1];
Text = PublicVar.appName + " " + NameWithotPath;
StatusPanelFileInfo();
return;
}
} }
await DecryptAES(); await DecryptAES();
} }
@ -195,7 +187,7 @@ private async void SendTo()
string NameWithotPath = Path.GetFileName(argsPath); string NameWithotPath = Path.GetFileName(argsPath);
richTextBox.Text = opnfile; richTextBox.Text = opnfile;
filePath = argsPath; filePath = argsPath;
Text = PublicVar.appName + " " + NameWithotPath; Text = NameWithotPath + " " + PublicVar.appName;
StatusPanelFileInfo(); StatusPanelFileInfo();
return; return;
} }
@ -465,6 +457,7 @@ private async Task UnlockFile()
richTextBox.Text = await AES.Decrypt(openedFileText, TypedPassword.Value, null, settings.HashAlgorithm, richTextBox.Text = await AES.Decrypt(openedFileText, TypedPassword.Value, null, settings.HashAlgorithm,
Convert.ToInt32(settings.PasswordIterations), Convert.ToInt32(settings.KeySize)); ; Convert.ToInt32(settings.PasswordIterations), Convert.ToInt32(settings.KeySize)); ;
} }
richTextBox.Modified = false;
fileLockedPanel.Visible = false; fileLockedPanel.Visible = false;
richTextBox.SelectionStart = caretPos; richTextBox.SelectionStart = caretPos;
PublicVar.encryptionKey.Set(TypedPassword.Value); PublicVar.encryptionKey.Set(TypedPassword.Value);
@ -666,7 +659,7 @@ private void RichTextBox_ModifiedChanged(object sender, EventArgs e)
{ {
if (Text.Contains("*")) 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 opnfile = File.ReadAllText(openFileDialog.FileName);
string NameWithotPath = Path.GetFileName(openFileDialog.FileName); string NameWithotPath = Path.GetFileName(openFileDialog.FileName);
richTextBox.Text = opnfile; richTextBox.Text = opnfile;
Text = PublicVar.appName + " " + NameWithotPath; Text = NameWithotPath + " " + PublicVar.appName;
filePath = openFileDialog.FileName; filePath = openFileDialog.FileName;
StatusPanelFileInfo(); StatusPanelFileInfo();
return; return;
@ -938,22 +931,20 @@ private void RichTextBox_TextChanged(object sender, EventArgs e)
{ {
if (!Text.Contains("*")) if (!Text.Contains("*"))
{ {
Text += "*";
} }
} }
else else
{ {
if (Text.Contains("*")) if (Text.Contains("*"))
{ {
Text = Text.Substring(0, Text.Length - 1); Text = Text.Replace("*", string.Empty);
} }
} }
if (richTextBox.TextLength == 0) if (richTextBox.TextLength == 0)
{ {
if (Text.Contains("*")) 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); PublicVar.encryptionKey.Set(TypedPassword.Value);
StreamWriter sw = new StreamWriter(saveFileDialog.FileName); StreamWriter sw = new StreamWriter(saveFileDialog.FileName);
string NameWithotPath = Path.GetFileName(saveFileDialog.FileName); string NameWithotPath = Path.GetFileName(saveFileDialog.FileName);
Text = PublicVar.appName + " " + NameWithotPath; Text = NameWithotPath + " " + PublicVar.appName;
filePath = saveFileDialog.FileName; filePath = saveFileDialog.FileName;
PublicVar.openFileName = Path.GetFileName(saveFileDialog.FileName); PublicVar.openFileName = Path.GetFileName(saveFileDialog.FileName);
sw.Close(); sw.Close();
@ -1068,7 +1059,7 @@ private async void OpenMainMenu_Click(object sender, EventArgs e)
string opnfile = File.ReadAllText(openFileDialog.FileName); string opnfile = File.ReadAllText(openFileDialog.FileName);
string NameWithotPath = Path.GetFileName(openFileDialog.FileName); string NameWithotPath = Path.GetFileName(openFileDialog.FileName);
richTextBox.Text = opnfile; richTextBox.Text = opnfile;
Text = PublicVar.appName + " " + NameWithotPath; Text = NameWithotPath + " " + PublicVar.appName;
filePath = openFileDialog.FileName; filePath = openFileDialog.FileName;
StatusPanelFileInfo(); StatusPanelFileInfo();
return; return;