private void encryptFileDrop_DragDrop(object sender, DragEventArgs e) { string[] FileList = (string[])e.Data.GetData(DataFormats.FileDrop, false); if (FileList.Length > 1) { MessageBox.Show("You may only encrypt a single file or folder at a time.", "Multiple Files Unsupported"); } else { if (Directory.Exists(FileList[0])) { Program.doEncryptFolder = true; } else if (File.Exists(FileList[0])) { Program.doEncryptFile = true; } using (FileAES_Encrypt encrypt = new FileAES_Encrypt(FileList[0].Replace(@"\\", @"\"))) { encrypt.StartPosition = FormStartPosition.CenterParent; encrypt.ShowDialog(); encrypt.Focus(); } } }
private void encryptFileDrop_Click(object sender, EventArgs e) { string fileToEncrypt = ""; if (openFileToEncrypt.ShowDialog() == DialogResult.OK) { fileToEncrypt = openFileToEncrypt.FileName; if (Directory.Exists(fileToEncrypt)) { Program.doEncryptFolder = true; } else if (File.Exists(fileToEncrypt)) { Program.doEncryptFile = true; } using (FileAES_Encrypt encrypt = new FileAES_Encrypt(fileToEncrypt.Replace(@"\\", @"\"))) { encrypt.StartPosition = FormStartPosition.CenterParent; encrypt.ShowDialog(); encrypt.Focus(); } } }