private void MenuItemFileProperties_Click(object sender, EventArgs e) { if (ctxtProperties.DocIsCTXT(Settings.CurrentFilePath) == true) { ctxtproperties ctxtp = new ctxtproperties(Settings.CurrentFilePath, true, this); ctxtp.ShowDialog(); } else { MessageBox.Show("Этот файл не является CTXT-файлом!"); } }
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; } }
internal void SaveInDirectory() { SaveFileDialog sfd = new SaveFileDialog(); sfd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal); sfd.Filter = "CryptotextEditor file (*.ctxt)|*.ctxt|Textfile (*.rtf, *.txt)|*.rtf;*.txt|All files (*.*)|*.*"; sfd.DefaultExt = ".ctxt"; if (sfd.ShowDialog() == DialogResult.OK) { if (sfd.FileName.EndsWith(".ctxt") == true) { ctxtproperties ctxtp = new ctxtproperties(sfd.FileName, false, MainForm); ctxtp.ShowDialog(); } else { SaveFile(sfd.FileName.ToString()); } } }
internal Language(ctxtproperties c) { ctxtPropWindow = c; }