private void readFileProperties(string filePath) { ctxtFile cTextFile = new ctxtFile(filePath); if (cTextFile.GetEncryption() == ctxtFile.Encryption.TimeAES) { comboBoxEncryption.SelectedIndex = 0; } else if (cTextFile.GetEncryption() == ctxtFile.Encryption.CryptotextEditorAES) { comboBoxEncryption.SelectedIndex = 1; string plainPassword = ctxtFile.GetPassphrase(filePath); if (plainPassword.Length > 1) { checkBoxSavePassInFile.Checked = true; textBoxPassphrase.Text = plainPassword; } else { checkBoxSavePassInFile.Checked = false; textBoxPassphrase.Focus(); } } else { comboBoxEncryption.SelectedIndex = 2; } if (ctxtProperties.DocIsRTF(filePath) == true) { checkBoxWithRTF.Checked = true; } else { checkBoxWithRTF.Checked = false; } }
internal void SaveFile(string FilePath) { if (FilePath.ToLower().EndsWith(".ctxt") == true) { ctxtFile ctxtfile = new ctxtFile(FilePath); if (ctxtfile.GetEncryption() == ctxtFile.Encryption.CryptotextEditorAES & ctxtFile.GetPassphrase(FilePath).Length < 2) { ctxtproperties ctxtp = new ctxtproperties(FilePath, true, MainForm); ctxtp.ShowDialog(); } else { ctxtfile.saveOpenedCtxt(MainForm.Document.Rtf); } MainForm.MenuItemFileProperties.Enabled = true; MainForm.mtsProperties.Enabled = true; } else { if (FilePath.ToLower().EndsWith(".txt") == true) { MainForm.Document.SaveFile(FilePath, RichTextBoxStreamType.PlainText); } else { MainForm.Document.SaveFile(FilePath, RichTextBoxStreamType.RichText); } MainForm.MenuItemFileProperties.Enabled = false; MainForm.mtsProperties.Enabled = false; } FileInfo fi = new FileInfo(FilePath); MainForm.Text = fi.Name.ToString() + " - CryptotextEditor"; Settings.CurrentFileSaved = true; Settings.CurrentFilePath = FilePath; if (Settings.LastOpenedFile != FilePath) { MainForm.MenuItemFileLastOpened.Text = fi.Name.ToString(); Settings.LastOpenedFile = FilePath; } }