public string GetTemplatePath(string templateFilePath) { using (var stream = FTPService.Donwload(templateFilePath)) { if (stream != null) { if (!Directory.Exists(@"C:\temp")) { Directory.CreateDirectory(@"c:\temp"); } string targetFileName = "C:\\temp\\" + templateFilePath; using (var targetStream = new FileStream(targetFileName, FileMode.OpenOrCreate)) { if (targetStream == null) { return(null); } var bufferSize = 1024; byte[] byteBuffer = new byte[bufferSize]; int bytesRead = stream.Read(byteBuffer, 0, bufferSize); try { while (bytesRead > 0) { targetStream.Write(byteBuffer, 0, bytesRead); bytesRead = stream.Read(byteBuffer, 0, bufferSize); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); return(null); } targetStream.Seek(0, SeekOrigin.Begin); targetStream.Close(); } stream.Close(); return(targetFileName); } } return(null); }
public Stream GetTemplateStream(string templateFilePath) { return(FTPService.Donwload(templateFilePath)); }
public Stream GetDocument(string filePath) { return(FTPService.Donwload(filePath)); }
public bool GetDocument(string filePath, string saveAs) { return(FTPService.Donwload(filePath, saveAs)); }