printer-api/Instructions/BaseInstruction.cs

28 lines
566 B
C#
Raw Normal View History

2022-02-17 15:45:42 +00:00
using System.Runtime.Serialization;
2022-02-17 17:29:41 +00:00
using ESCPOS_NET.Emitters;
2022-02-17 15:45:42 +00:00
public abstract class BaseInstruction
{
[DataMember(IsRequired = true)]
public string? type { get; set; }
public abstract List<byte[]> GetInstructions();
2022-02-17 17:29:41 +00:00
2022-02-18 18:32:13 +00:00
protected EPSON e = new EPSON();
2022-02-17 17:29:41 +00:00
protected byte[] alignmentCommand(Alignment alignment){
var e = new EPSON();
switch (alignment)
{
case Alignment.Center:
return e.CenterAlign();
case Alignment.Left:
return e.LeftAlign();
case Alignment.Right:
return e.RightAlign();
default:
return e.LeftAlign();
}
}
2022-02-17 15:45:42 +00:00
}