public File GetFileFromServer(Connection connection, string fileToDownload) { var tempFileName = GetUniqueFileName(); DownloadFile(connection, fileToDownload, tempFileName); var file = new DotNetFile(new RelativeFileName(new RelativePathName(tempFileName))); return file; }
public void FtpTesting() { //Use actual credentials Connection connection = new Connection(); Connection connection2 = new Connection(); //var file1 = GetFileFromServer(connection, "invlist"); //var rename = new DotNetFile(new RelativeFileName(new RelativePathName(GetVendorQtyFileName()))); //file1.Move(rename); //var file2 = GetFileFromServer(connection, "itemmaster"); //rename = new DotNetFile(new RelativeFileName(new RelativePathName(GetVendorPriceFileName()))); //file2.Move(rename); //var file3 = GetFileFromServer(connection2, "654181pricelist/PRICELIST"); //rename = new DotNetFile(new RelativeFileName(new RelativePathName("20150429.1618.tucker-rocky.nothing.raw"))); //file3.Move(rename); //file1.ShouldNotBe(null); //file2.ShouldNotBe(null); //file3.ShouldNotBe(null); }
public FtpConnection GetConnection(Connection connection) { return new FtpConnection(connection.Host, connection.Port, connection.Credentials.Username, connection.Credentials.Password); }
//TODO: FtpDownloader : IDownloader void DownloadFile(Connection connection, string fileToDownload, string tempFileName) { using (var ftpConnection = GetConnection(connection)) { ftpConnection.Open(); ftpConnection.Login(); ftpConnection.GetFile(fileToDownload, tempFileName, false); ftpConnection.Close(); } }