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
38 lines
1.2 KiB
C#
38 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace EpsonPrinter.Services
|
|
{
|
|
public class PrintString
|
|
{
|
|
/// <summary>
|
|
/// An appropriate interval is converted into the length of
|
|
/// the tab about two texts. And make a printing data.
|
|
/// </summary>
|
|
/// <param name="iLineChars">
|
|
/// The width of the territory which it prints on is converted into the number of
|
|
/// characters, and that value is specified.
|
|
/// </param>
|
|
/// <param name="strBuf">
|
|
/// It is necessary as an information for deciding the interval of the text.
|
|
/// </param>
|
|
/// <param name="strPrice">
|
|
/// It is necessary as an information for deciding the interval of the text, too.
|
|
/// </param>
|
|
/// <returns>printing data.
|
|
/// </returns>
|
|
public String MakePrintString(int iLineChars, String strBuf, String strPrice)
|
|
{
|
|
int bufferWidth = Math.Max(0, iLineChars - strPrice.Length);
|
|
if (strBuf.Length > bufferWidth)
|
|
{
|
|
strBuf = strBuf.Substring(0, bufferWidth);
|
|
}
|
|
|
|
return strBuf.PadRight(bufferWidth) + strPrice;
|
|
}
|
|
}
|
|
}
|