Har muligvis rettet den print fejl der er - men mangler at få det testet. Der er slettet en masse projekter som ikke bliver brugt mere. Og flyttet rundt på de få projekter som er tilbage. Dette er V2 og i sit eget repo, så dette er initial commit
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;
|
|
}
|
|
}
|
|
}
|