Exemple #1
0
 /// <summary>
 ///     Connects to a FTP server trying every methods
 /// </summary>
 private void ConnectOrReconnectFtp(FtpsClient ftp, string userName, string passWord, string host, int port)
 {
     // try to connect!
     if (!ftp.Connected)
     {
         ConnectFtp(ftp, userName, passWord, host, port);
     }
     else
     {
         try {
             ftp.GetCurrentDirectory();
         } catch (Exception) {
             ConnectFtp(ftp, userName, passWord, host, port);
         }
     }
 }
Exemple #2
0
        private static void DoList(FtpsClient client)
        {
            var remoteDirName = _commandArguments.Count > 0 ? NormalizeRemotePath(_commandArguments[0]) : client.GetCurrentDirectory();

            Console.WriteLine();
            Console.WriteLine("Remote directory: " + remoteDirName);

            // Get the dirList before the WriteLine in order to avoid writing an empty newline in case of exceptions
            var dirList = client.GetDirectoryListUnparsed(remoteDirName);

            Console.WriteLine();
            Console.WriteLine(dirList);
        }