70 lines
3.4 KiB
C#
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;
|
|
}
|
|
}
|
|
}
|