Initial commit
Initial commit til Git. V2 er deployed
This commit is contained in:
33
PointOfSale/Utilities/ESCPOS_NET/Printers/MemoryPrinter.cs
Normal file
33
PointOfSale/Utilities/ESCPOS_NET/Printers/MemoryPrinter.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System.IO;
|
||||
|
||||
namespace ESCPOS_NET
|
||||
{
|
||||
public class MemoryPrinter : BasePrinter
|
||||
{
|
||||
private readonly MemoryStream _ms;
|
||||
|
||||
// TODO: default values to their default values in ctor.
|
||||
public MemoryPrinter()
|
||||
: base()
|
||||
{
|
||||
_ms = new MemoryStream();
|
||||
Writer = new BinaryWriter(_ms);
|
||||
}
|
||||
|
||||
~MemoryPrinter()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
public byte[] GetAllData()
|
||||
{
|
||||
return _ms.ToArray();
|
||||
}
|
||||
|
||||
protected override void OverridableDispose()
|
||||
{
|
||||
_ms?.Close();
|
||||
_ms?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user