public override Stream DownloadStream(string remotePath) { Stream stream = new MemoryStream(); _client.Download(stream, remotePath); return(stream); }
public Stream GetFile(string idOrPath, DirectoryInfo rootDir = null) { var dir = new DirectoryInfo("."); string relativePath = ""; if (rootDir != null) { relativePath = rootDir.FullName.Replace(dir.FullName, "");// Path.GetRelativePath(dir.FullName, rootDir.FullName); } string realName; if (idOrPath.StartsWith("path:")) { realName = idOrPath.Substring(5); } else { realName = idOrPath.StartsWith("id:") ? idOrPath.Substring(3) : idOrPath; relativePath = Storage.PathHelper.GetDictionary(relativePath, realName); } var stream = new MemoryStream(); if (Client.Download(stream, Path.Combine(relativePath, realName))) { return(stream); } else { stream.Close(); } throw new FileNotFoundException($"FTP:{realName}"); }
public void Download(Stream fileStream, string fullRemotePath) { _client.Download(fileStream, fullRemotePath); }