51 lines
1.3 KiB
C#
51 lines
1.3 KiB
C#
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using LeafWeb.Core.Entities;
|
|
using LeafWeb.Core.Remote;
|
|
|
|
namespace LeafWeb.Web.Services
|
|
{
|
|
public class PiscalService
|
|
{
|
|
private readonly IPiscalClient _piscalClient;
|
|
|
|
public PiscalService(IPiscalClient piscalClient)
|
|
{
|
|
_piscalClient = piscalClient;
|
|
}
|
|
|
|
public PiscalService() : this(new PiscalSshClient(ConfigurationManager.ConnectionStrings["PiscalServer"].ConnectionString))
|
|
{
|
|
}
|
|
|
|
public void Run(LeafInput leafInput)
|
|
{
|
|
var inputFile = new PiscalLeafInput(leafInput);
|
|
_piscalClient.RunLeafInput(inputFile);
|
|
}
|
|
|
|
public PiscalStatus GetStatus(LeafInput leafInput)
|
|
{
|
|
var inputFile = new PiscalLeafInput(leafInput);
|
|
return _piscalClient.GetLeafInputStatus(inputFile);
|
|
}
|
|
|
|
public IEnumerable<LeafOutputFile> RetrieveOutputFiles(LeafInput leafInput)
|
|
{
|
|
var input = new PiscalLeafInput(leafInput);
|
|
var piscalLeafOutputFiles = _piscalClient.RetrieveLeafOutput(input);
|
|
foreach (var file in piscalLeafOutputFiles)
|
|
{
|
|
var leafOutputFile = file.GetLeafOutputFile();
|
|
leafOutputFile.LeafInput = leafInput;
|
|
yield return leafOutputFile;
|
|
}
|
|
}
|
|
|
|
public void Cleanup(LeafInput leafInput)
|
|
{
|
|
var input = new PiscalLeafInput(leafInput);
|
|
_piscalClient.CleanupLeafProcess(input);
|
|
}
|
|
}
|
|
} |