private void ProcessAckFile(string folderName, string fileName, IUserConfiguration user, IFtpHelper ftpHelper) { string ftpFileName = $@"{folderName}/{fileName}"; string localFileName = $@"{new FilePathHelper(_configuration, user.Name).GetReportsFilesFolder()}\{fileName}"; _logger.Debug($"Process ack file {ftpFileName}"); ftpHelper.DownloadFile(ftpFileName, localFileName); if (File.Exists(localFileName)) { if (user.HasDeleteFtp) { ftpHelper.DeleteFile(ftpFileName); } try { _logger.Debug($"Delete local file {fileName}"); File.Delete(localFileName); } catch (Exception e) { _logger.Error($"Error trying to delete file {localFileName} -- {e}"); } } }
private void RemoveFileFromFtp(string file, IUserConfiguration user, IFtpHelper ftpHelper) { if (user.HasDeleteFtp) { _logger.Debug($"Remove file {file} from FTP "); ftpHelper.DeleteFile(file); } }