Files
point_of_sale/PointOfSale/EpsonPrinterLinux/Services/PrintStyleCombination.cs
Bjarne Pedersen 41e23b6184 Initial commit
Initial commit til Git.
V2 er deployed
2026-06-13 17:31:50 +02:00

70 lines
3.4 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using EpsonPrinter.Enums;
using EpsonPrinter.Model;
using ESCPOS_NET.Emitters;
namespace EpsonPrinter.Services
{
public class PrintStyleCombination
{
public PrintStyle Combine(PrintStyleModel printStyleModel)
{
//Bold
if (printStyleModel.Bold && !printStyleModel.DoubleHeight && !printStyleModel.DoubleWidth && !printStyleModel.FontB && !printStyleModel.Underline)
return PrintStyle.Bold;
if (printStyleModel.Bold && printStyleModel.DoubleHeight && !printStyleModel.DoubleWidth && !printStyleModel.FontB && !printStyleModel.Underline)
return PrintStyle.Bold | PrintStyle.DoubleHeight;
if(printStyleModel.Bold && printStyleModel.DoubleHeight && printStyleModel.DoubleWidth && !printStyleModel.FontB && !printStyleModel.Underline)
return PrintStyle.Bold | PrintStyle.DoubleHeight | PrintStyle.DoubleWidth;
if (printStyleModel.Bold && printStyleModel.DoubleHeight && printStyleModel.DoubleWidth && printStyleModel.FontB && !printStyleModel.Underline)
return PrintStyle.Bold | PrintStyle.DoubleHeight | PrintStyle.DoubleWidth | PrintStyle.FontB;
if (printStyleModel.Bold && printStyleModel.DoubleHeight && printStyleModel.DoubleWidth && printStyleModel.FontB && printStyleModel.Underline)
return PrintStyle.Bold | PrintStyle.DoubleHeight | PrintStyle.DoubleWidth | PrintStyle.FontB | PrintStyle.Underline;
//DoubleHeight
if (printStyleModel.DoubleHeight && !printStyleModel.DoubleWidth && !printStyleModel.FontB && !printStyleModel.Underline)
return PrintStyle.DoubleHeight;
if (printStyleModel.DoubleHeight && printStyleModel.DoubleWidth && !printStyleModel.FontB && !printStyleModel.Underline)
return PrintStyle.DoubleHeight | PrintStyle.DoubleWidth;
if (printStyleModel.DoubleHeight && printStyleModel.DoubleWidth && printStyleModel.FontB && !printStyleModel.Underline)
return PrintStyle.DoubleHeight | PrintStyle.DoubleWidth | PrintStyle.FontB;
if (printStyleModel.DoubleHeight && printStyleModel.DoubleWidth && printStyleModel.FontB && printStyleModel.Underline)
return PrintStyle.DoubleHeight | PrintStyle.DoubleWidth | PrintStyle.FontB | PrintStyle.Underline;
//DoubleWidth
if (printStyleModel.DoubleWidth && !printStyleModel.FontB && !printStyleModel.Underline)
return PrintStyle.DoubleWidth;
if (printStyleModel.DoubleWidth && printStyleModel.FontB && !printStyleModel.Underline)
return PrintStyle.DoubleWidth | PrintStyle.FontB;
if (printStyleModel.DoubleWidth && printStyleModel.FontB && printStyleModel.Underline)
return PrintStyle.DoubleWidth | PrintStyle.FontB | PrintStyle.Underline;
//FontB
if (printStyleModel.FontB && !printStyleModel.Underline)
return PrintStyle.FontB;
if(printStyleModel.FontB && printStyleModel.Underline)
return PrintStyle.FontB | PrintStyle.Underline;
//Underline
if (printStyleModel.Underline)
return PrintStyle.Underline;
return PrintStyle.None;
}
}
}