Add output file type, collect all files

This commit is contained in:
2016-05-18 13:05:24 -04:00
parent 4343f08733
commit 77ae03534e
19 changed files with 288 additions and 48 deletions
+14 -7
View File
@@ -59,7 +59,7 @@ namespace LeafWeb.Core.Remote
public void RunLeafInput(PiscalLeafInput leafInput)
{
var inputDirectory = $"{BaseDirectory}/{leafInput.DirectoryName}";
var inputDirectory = $"{BaseDirectory}/{leafInput.PiscalDirectoryName}";
CopyLeafInput(leafInput, inputDirectory);
@@ -67,7 +67,7 @@ namespace LeafWeb.Core.Remote
using (var ssh = GetSshClient())
{
ssh.Connect();
var commandText = $"{RemoteScriptPath} -d {leafInput.DirectoryName} -p {leafInput.PhotosyntheticType} -s";
var commandText = $"{RemoteScriptPath} -d {leafInput.PiscalDirectoryName} -p {leafInput.PhotosyntheticType} -s";
if (leafInput.SuppressStorageCopy)
commandText += " -t";
@@ -80,7 +80,7 @@ namespace LeafWeb.Core.Remote
ssh.Disconnect();
if (command.ExitStatus != 0)
throw new PiscalClientException(leafInput.LeafInputId, command.Result.TrimEndNewLine());
throw new PiscalClientException(leafInput.LeafInputId, command.Error.TrimEndNewLine());
_logger.Debug("RunLeafInput result: " + command.Result.TrimEndNewLine());
}
@@ -108,13 +108,13 @@ namespace LeafWeb.Core.Remote
using (var ssh = GetSshClient())
{
ssh.Connect();
var commandText = $"{RemoteScriptPath} -d {leafInput.DirectoryName}";
var commandText = $"{RemoteScriptPath} -d {leafInput.PiscalDirectoryName}";
var command = ssh.CreateCommand(commandText);
command.Execute();
ssh.Disconnect();
if (command.ExitStatus != 0)
throw new PiscalClientException(leafInput.LeafInputId, command.Result.TrimEndNewLine());
throw new PiscalClientException(leafInput.LeafInputId, command.Error.TrimEndNewLine());
return command.Result
.SplitNewLine()
@@ -138,8 +138,14 @@ namespace LeafWeb.Core.Remote
using (var scp = GetScpClient())
{
scp.Connect();
string outputFileType = string.Empty;
foreach (var filePath in filePaths)
{
if (filePath.StartsWith("#"))
{
outputFileType = filePath.Substring(1);
continue;
}
using (var stream = new MemoryStream())
{
scp.Download(filePath, stream);
@@ -148,7 +154,8 @@ namespace LeafWeb.Core.Remote
{
Contents = stream.ToArray(),
Filename = filePath.FilenameFromPath(),
DirectoryName = leafInput.DirectoryName
PiscalDirectoryName = leafInput.PiscalDirectoryName,
OutputFileType = outputFileType
};
}
}
@@ -162,7 +169,7 @@ namespace LeafWeb.Core.Remote
using (var ssh = GetSshClient())
{
ssh.Connect();
var commandText = $"{RemoteScriptPath} -d {leafInput.DirectoryName} -c";
var commandText = $"{RemoteScriptPath} -d {leafInput.PiscalDirectoryName} -c";
var command = ssh.CreateCommand(commandText);
command.Execute();
ssh.Disconnect();