public OpenFileResult InputFileOpenRead(IInFileDef fileDef, ExternalFileDef externalFileDefinition, DynamicContext ctx) { OpenFileResult result; string storageId = externalFileDefinition.Locator; if (String.IsNullOrEmpty(storageId)) { result = new OpenFileResult { FilePath = "", // note: or fileName Stream = null, }; } else { string tmpFileName = Path.GetTempFileName(); _tmpFilesToDel.Add(tmpFileName); Log.Debug("Loading input file from storage for PB: " + storageId); IOProxy.Storage.Download(storageId, tmpFileName); Log.Debug("Loading done for file: " + storageId); result = new OpenFileResult { FilePath = tmpFileName, // note: or fileName Stream = File.OpenRead(tmpFileName), }; } return result; }
public OpenFileResult InputFileOpenWrite(IInFileDef fileDef, DynamicContext ctx) { string tmpFilePath = Path.GetTempFileName(); _tmpFilesToDel.Add(tmpFilePath); _filesToCopyFromTmp.Add(Tuple.Create( new TaskFileDescription { FileName = GetFileName(fileDef), SlotName = GetSlotName(fileDef) }, tmpFilePath )); var res = new OpenFileResult() { FilePath = tmpFilePath, // note: or fileName Stream = File.OpenWrite(tmpFilePath) }; return res; }
public OpenFileResult OutputFileOpenRead(IOutFileDef fileDef, string filePath, DynamicContext ctx) { string ftpPath = _ftpRoot + filePath.TrimStart(new[] { '/', '\\' }); string tmpFilePath = Path.GetTempFileName(); Log.Debug("Downloading file for PB: " + ftpPath); IOProxy.Ftp.DownloadFile(ftpPath, tmpFilePath); Log.Debug("Downloading file done: " + ftpPath); _tmpFilesToDel.Add(tmpFilePath); var res = new OpenFileResult() { FilePath = filePath, Stream = File.OpenRead(tmpFilePath) }; return res; }