public static void DownloadRequiredFilesFromFtp() { FTPClient clientFtp = new FTPClient(Properties.Settings.Default.UserName, Properties.Settings.Default.UserPassword, Properties.Settings.Default.FtpSerwer); if (clientFtp.IsInternetAvailable()) { clientFtp.DownloadFileFromFTP("informacje_kzl.pdf"); clientFtp.DownloadFileFromFTP("kontakt_kzl.xps"); } }
public string GetText(string fileName) { FTPClient ftpClient = new FTPClient(Properties.Settings.Default.UserName, Properties.Settings.Default.UserPassword, Properties.Settings.Default.FtpSerwer); string result = string.Empty; if (ftpClient.IsInternetAvailable()) { try { result = ftpClient.ReadFromFtpTxtFile(fileName); } catch (Exception ex) { result = "Błąd serwera FTP. Nie mozna pobrać zasobów"; logger.Error(ex, "Problem z załadowaniem zawartości pliku " + fileName); } } return(result); }