private void FTPTestAccount(FTPAccount account) { string msg = ""; string remotePath = account.GetSubFolderPath(); List <string> directories = new List <string>(); try { if (account.Protocol == FTPProtocol.FTP || account.Protocol == FTPProtocol.FTPS) { using (FTP ftp = new FTP(account)) { if (ftp.Connect()) { if (!ftp.DirectoryExists(remotePath)) { directories = ftp.CreateMultiDirectory(remotePath); } if (ftp.IsConnected) { if (directories.Count > 0) { msg = Resources.UploadersConfigForm_TestFTPAccount_Connected_Created_folders + "\r\n" + string.Join("\r\n", directories); } else { msg = Resources.UploadersConfigForm_TestFTPAccount_Connected_; } } } } } else if (account.Protocol == FTPProtocol.SFTP) { using (SFTP sftp = new SFTP(account)) { if (sftp.Connect()) { if (!sftp.DirectoryExists(remotePath)) { directories = sftp.CreateMultiDirectory(remotePath); } if (sftp.IsConnected) { if (directories.Count > 0) { msg = Resources.UploadersConfigForm_TestFTPAccount_Connected_Created_folders + "\r\n" + string.Join("\r\n", directories); } else { msg = Resources.UploadersConfigForm_TestFTPAccount_Connected_; } } } } } } catch (Exception e) { msg = e.Message; } MessageBox.Show(msg, "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Information); }