public IFile CopyToWorkingDirectory(Guid processId, string filePath) { if (!_fileStorage.Exists(filePath)) { throw new FileNotFoundException($"File at path '{filePath}' not found."); } _logger.LogInfo("Waiting on file to be ready..."); _fileStorage.WaitForFileReady(filePath, _settings.DropFileReadyTimeout); _logger.LogInfo("File ready."); var file = _fileStorage.GetFile(filePath); ValidateIntegrationFile(file); var workingFileInfo = GetWorkingFileInfo(file, processId); _logger.LogInfo($"Copying dropped file at '{file}' to '{workingFileInfo}'..."); string workingFilePath = _fileStorage.CopyFile(file.FullPath, workingFileInfo.FullPath); _logger.LogInfo("Copying complete."); if (_settings.DeleteFromDropDirectory) { _logger.LogInfo($"Deleting dropped file at '{filePath}'..."); _fileStorage.Delete(filePath); _logger.LogInfo($"Dropped file deleted."); } return(_fileStorage.GetFile(workingFilePath)); }
public void Archive(Guid processId, string filePath) { if (!_settings.Archive) { return; } _logger.LogInfo("Archiving integration..."); var archiveFile = GetArchiveFile(filePath, processId); _logger.LogInfo($"Copying '{filePath}' to '{archiveFile.FullPath}'..."); _fileStorage.CopyFile(filePath, archiveFile.FullPath); _logger.LogInfo("Copying complete."); _logger.LogInfo($"Integration files archived to '{archiveFile.FullPath}'."); CleanUpArchive(archiveFile.Directory, _settings.ArchiveLimit); }