templates support
This commit is contained in:
23
Inspectron.Epson.Templates/TemplateReceiptConverter.cs
Normal file
23
Inspectron.Epson.Templates/TemplateReceiptConverter.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Inspectron.Epson.PrintServer.Printers.Utils;
|
||||
using Inspectron.Epson.Templates.Configuration;
|
||||
|
||||
namespace Inspectron.Epson.Templates;
|
||||
|
||||
public class TemplateReceiptConverter : IReceiptConverter
|
||||
{
|
||||
private readonly TemplateEngine _engine;
|
||||
private readonly int _receiptType;
|
||||
private readonly PrinterProfile _profile;
|
||||
|
||||
public TemplateReceiptConverter(TemplateEngine engine, int receiptType, PrinterProfile profile)
|
||||
{
|
||||
_engine = engine ?? throw new ArgumentNullException(nameof(engine));
|
||||
_receiptType = receiptType;
|
||||
_profile = profile ?? throw new ArgumentNullException(nameof(profile));
|
||||
}
|
||||
|
||||
public List<PrintCommand> Convert(string jsonContent)
|
||||
{
|
||||
return _engine.Render(_receiptType, _profile.Id, jsonContent);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user