1- using System . Text ;
1+ using System . IO . Ports ;
2+ using System . Text ;
23using Vip . Printer . Enums ;
34using Vip . Printer . Interfaces . Engine ;
45
@@ -12,6 +13,7 @@ public sealed class PrinterSettings
1213 public PrinterType PrinterType { get ; }
1314 public ProtocolType Protocol { get ; }
1415 public Encoding Encoding { get ; }
16+ public SerialOptions SerialOptions { get ; }
1517 public IEngine Engine { get ; }
1618 public int ColsNormal { get ; }
1719 public int ColsCondensed { get ; }
@@ -21,12 +23,13 @@ public sealed class PrinterSettings
2123
2224 #region Constructors
2325
24- private PrinterSettings ( string printerName , PrinterType printerType , ProtocolType protocol , Encoding encoding , IEngine engine , int colsNormal , int colsCondensed , int colsExpanded )
26+ private PrinterSettings ( string printerName , PrinterType printerType , ProtocolType protocol , Encoding encoding , SerialOptions serialOptions , IEngine engine , int colsNormal , int colsCondensed , int colsExpanded )
2527 {
2628 PrinterName = string . IsNullOrWhiteSpace ( printerName ) ? "temp.prn" : printerName . Trim ( ) ;
2729 PrinterType = printerType ;
2830 Protocol = protocol ;
2931 Encoding = encoding ;
32+ SerialOptions = serialOptions ;
3033 Engine = engine ;
3134 ColsNormal = colsNormal ;
3235 ColsCondensed = colsCondensed ;
@@ -62,6 +65,7 @@ public sealed class PrinterSettingsBuilder
6265 private PrinterType _printerType = PrinterType . Epson ;
6366 private ProtocolType _protocol = ProtocolType . Raw ;
6467 private Encoding _encoding ;
68+ private SerialOptions _serialOptions ;
6569 private IEngine _engine ;
6670 private int _colsNormal ;
6771 private int _colsCondensed ;
@@ -73,7 +77,7 @@ public sealed class PrinterSettingsBuilder
7377
7478 public PrinterSettings Build ( )
7579 {
76- return new PrinterSettings ( _printerName , _printerType , _protocol , _encoding , _engine , _colsNormal , _colsCondensed , _colsExpanded ) ;
80+ return new PrinterSettings ( _printerName , _printerType , _protocol , _encoding , _serialOptions , _engine , _colsNormal , _colsCondensed , _colsExpanded ) ;
7781 }
7882
7983 #endregion
@@ -104,6 +108,12 @@ public PrinterSettingsBuilder WithEncoding(Encoding encoding)
104108 return this ;
105109 }
106110
111+ public PrinterSettingsBuilder WithSerialOptions ( int baudeRate , int dataBits = 8 , Parity parity = Parity . None , StopBits stopBits = StopBits . One , Handshake handshake = Handshake . None )
112+ {
113+ _serialOptions = new SerialOptions ( baudeRate , dataBits , parity , stopBits , handshake ) ;
114+ return this ;
115+ }
116+
107117 public PrinterSettingsBuilder WithEngine ( IEngine engine )
108118 {
109119 _engine = engine ;
0 commit comments