//turn this into some kind of interface
        public GatherResults DownloadQtyFiles(IVendorDirectory dir)
        {
            var files = new List<File>();

            using (var ftp = new FtpLib.FtpConnection(_config.QtyFileHost,
                _config.QtyFilePort,
                _config.QtyFileUsername,
                _config.QtyFilePassword))
            {
                ftp.Open();
                ftp.Login();

                dir.EnsureExists();

                var localFile = dir.GetNewRawFile(FileTypes.Qty);
                ftp.GetFile(_config.QtyFileName, localFile.Name.GetPath(), true);
                files.Add(localFile);

                ftp.Close();
            }

            return new GatherResults
            {
                VendorHandle = dir.VendorHandle,
                Files = files
            };
        }
Exemple #2
0
 /// <summary>
 /// Cierra conexión FTP
 /// </summary>
 public void Stop()
 {
     try
     {
         clienteFTP.Close();
     }
     catch (Exception ex)
     {
         throw SpinException.GetException("SpinFTP:: " + ex.Message, ex);
     }
 }
Exemple #3
0
 void FTPLogin(string server, string username, string password, string uploadDir, bool upperChannel, bool first = true)
 {
     try
     {
         using (FtpLib.FtpConnection ftp = new FtpLib.FtpConnection(server, username, password))
         {
             ftp.Open();  /* Open the FTP connection */
             ftp.Login(); /* Login using previously provided credentials */
             DirSearch(uploadDir, ftp, "/", upperChannel, first);
             ftp.Close();
         }
     }
     catch {  }
 }