public static void TestFTPAccount(FTPAccount account)
        {
            string msg = string.Empty;
            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 = "Connected!\r\nCreated folders:\r\n" + string.Join("\r\n", directories);
                                }
                                else
                                {
                                    msg = "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 = "Connected!\r\nCreated folders:\r\n" + string.Join("\r\n", directories);
                                }
                                else
                                {
                                    msg = "Connected!";
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                msg = e.Message;
            }

            MessageBox.Show(msg, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        public static void TestFTPAccount(FTPAccount account, bool silent)
        {
            string msg = string.Empty;
            string sfp = account.GetSubFolderPath();

            switch (account.Protocol)
            {
                case FTPProtocol.SFTP:
                    try
                    {
                        using (SFTP sftp = new SFTP(account))
                        {
                            if (!sftp.IsValidAccount)
                            {
                                msg = "An SFTP client couldn't be instantiated, not enough information.\r\nCould be a missing key file.";
                            }
                            else if (sftp.Connect())
                            {
                                List<string> createddirs = new List<string>();

                                if (!sftp.DirectoryExists(sfp))
                                {
                                    createddirs = sftp.CreateMultiDirectory(sfp);
                                }

                                if (sftp.IsConnected)
                                {
                                    msg = (createddirs.Count == 0) ? "Connected!" : "Connected!\r\nCreated folders:\r\n";
                                    for (int x = 0; x <= createddirs.Count - 1; x++)
                                    {
                                        msg += createddirs[x] + "\r\n";
                                    }
                                    msg += "\r\n\r\nPing results:\r\n " + SendPing(account.Host, 3);
                                }
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        msg = e.Message;
                    }
                    break;
                default:
                    try
                    {
                        using (FTP ftpClient = new FTP(account))
                        {
                            if (ftpClient.ChangeDirectory(sfp, true))
                            {
                                msg = "Connected!\r\n\r\nPing results:\r\n" + SendPing(account.Host, 3);
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        msg = e.Message;
                    }

                    break;
            }

            if (silent)
            {
                DebugHelper.WriteLine(string.Format("Tested {0} sub-folder path in {1}", sfp, account));
            }
            else
            {
                MessageBox.Show(msg, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        public static void TestFTPAccount(FTPAccount account, bool silent)
        {
            string msg = string.Empty;
            string sfp = account.GetSubFolderPath();
            switch (account.Protocol)
            {
                case FTPProtocol.SFTP:
                    SFTP sftp = new SFTP(account);
                    if (!sftp.IsInstantiated)
                    {
                        msg = "An SFTP client couldn't be instantiated, not enough information.\nCould be a missing key file.";
                    }
                    else if (sftp.Connect())
                    {
                        List<string> createddirs = new List<string>();
                        if (!sftp.DirectoryExists(sfp))
                        {
                            createddirs = sftp.CreateMultipleDirectorys(FTPHelpers.GetPaths(sfp));
                        }
                        if (sftp.IsConnected)
                        {
                            msg = (createddirs.Count == 0) ? "Connected!" : "Conected!\nCreated folders;\n";
                            for (int x = 0; x <= createddirs.Count - 1; x++)
                            {
                                msg += createddirs[x] + "\n";
                            }
                            msg += " \n\nPing results:\n " + SendPing(account.Host, 3);
                            sftp.Disconnect();
                        }
                    }
                    break;
                default:
                    using (FTP ftpClient = new FTP(account))
                    {
                        try
                        {
                            //DateTime time = DateTime.Now;
                            ftpClient.Test(sfp);
                            msg = "Success!";
                        }
                        catch (Exception e)
                        {
                            if (e.Message.StartsWith("Could not change working directory to"))
                            {
                                try
                                {
                                    ftpClient.MakeMultiDirectory(sfp);
                                    ftpClient.Test(sfp);
                                    msg = "Success!\nAuto created folders: " + sfp;
                                }
                                catch (Exception e2)
                                {
                                    msg = e2.Message;
                                }
                            }
                            else
                            {
                                msg = e.Message;
                            }
                        }
                    }

                    if (!string.IsNullOrEmpty(msg))
                    {
                        string ping = SendPing(account.Host, 3);
                        if (!string.IsNullOrEmpty(ping))
                        {
                            msg += "\n\nPing results:\n" + ping;
                        }

                        if (silent)
                        {
                            // Engine.MyLogger.WriteLine(string.Format("Tested {0} sub-folder path in {1}", sfp, account.ToString()));
                        }
                        else
                        {
                            //MessageBox.Show(msg, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    break;
            }
            if (silent)
            {
                DebugHelper.WriteLine(string.Format("Tested {0} sub-folder path in {1}", sfp, account.ToString()));
            }
            else
            {
                MessageBox.Show(msg, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }