Exemplo n.º 1
0
 public string[] Dir(IFTPConnection connection)
 {
     //"NLST"
     string []    fileList;
     using(var dataConn = new FTPDataConnection(connection))
     {
             fileList = dataConn.GetFileList();
     }
     return fileList;
 }
Exemplo n.º 2
0
 public void GetFile(IFTPConnection connection, string localFilePath, string remoteFileName)
 {
     Stream stream = File.Open (localFilePath,FileMode.Create,FileAccess.Write,FileShare.None);
     try
     {
         using (var dataConn = new FTPDataConnection(connection))
         {
             dataConn.GetStream(remoteFileName, stream);
         }
     }
     finally
     {
         stream.Close();
     }
 }
Exemplo n.º 3
0
        public void SendFile(IFTPConnection connection, string localFilePath, string remoteFileName)
        {
            var stream = File.OpenRead(localFilePath);
            try
            {

                using(var dataConn = new FTPDataConnection(connection))
                {
                    dataConn.SendStream(stream, remoteFileName);
                }
            }
            finally
            {
                stream.Close();
            }
        }