private void buttonSave_Click(object sender, EventArgs e) { ctxtFile.Encryption sEnc; if (comboBoxEncryption.SelectedIndex == 0) { sEnc = ctxtFile.Encryption.TimeAES; } else if (comboBoxEncryption.SelectedIndex == 1) { sEnc = ctxtFile.Encryption.CryptotextEditorAES; } else { sEnc = ctxtFile.Encryption.Base64; } ctxtFile ctxtfile = new ctxtFile(thisFilePath); ctxtfile.encName = sEnc; ctxtfile.SaveWithRTF = checkBoxWithRTF.Checked; ctxtfile.PassPhrase = textBoxPassphrase.Text; ctxtfile.SavePassString = checkBoxSavePassInFile.Checked; ctxtfile.WriteFile(editor.Document.Rtf); System.IO.FileInfo fi = new System.IO.FileInfo(thisFilePath); editor.Text = fi.Name.ToString() + " - CryptotextEditor"; Settings.CurrentFileSaved = true; Settings.CurrentFilePath = thisFilePath; if (Settings.LastOpenedFile != thisFilePath) { editor.MenuItemFileLastOpened.Text = fi.Name.ToString(); Settings.LastOpenedFile = thisFilePath; } Settings.Save(); this.Close(); }
internal void AutoSave(int SaveNum) { string asFilePath; ctxtFile file; try { asFilePath = Settings.tmpPath + "\\~CryptotextEditortext32.tmp"; file = new ctxtFile(asFilePath); if (SaveNum == 0 & Settings.AutoSave == true) { file.SaveWithRTF = false; file.WriteFile(MainForm.Document.Text); } else if (SaveNum == 1) { MainForm.Document.Text = file.ReadFile(); } } catch (UnauthorizedAccessException) { MainForm.MenuItemFormatAutoSave.Checked = false; } }