Initial commit

Initial commit til Git.
V2 er deployed
This commit is contained in:
2026-06-13 17:31:50 +02:00
parent 9fcd2b145e
commit 41e23b6184
375 changed files with 15956 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
using System.IO;
using System.IO.Ports;
using System.Threading.Tasks;
namespace ESCPOS_NET
{
public class SerialPrinter : BasePrinter
{
private readonly SerialPort _serialPort;
public SerialPrinter(string portName, int baudRate)
: base()
{
_serialPort = new SerialPort(portName, baudRate);
_serialPort.Open();
Writer = new BinaryWriter(_serialPort.BaseStream);
Reader = new BinaryReader(_serialPort.BaseStream);
}
protected override void OverridableDispose()
{
_serialPort?.Close();
_serialPort?.Dispose();
Task.Delay(250).Wait(); // Based on MSDN Documentation, should sleep after calling Close or some functionality will not be determinant.
}
public void Disable()
{
OverridableDispose();
}
}
}