密文
cs pu lt 90 fd 500 rt 90 pd fd 100 rt 90 repeat 18[fd 5 rt 10] lt 135 fd 50 lt 135 pu bk 100 pd setcolor pick [ red orange yellow green blue violet ] repeat 18[fd 5 rt 10] rt 90 fd 60 rt 90 bk 30 rt 90 fd 60 pu lt 90 fd 100 pd rt 90 fd 50 bk 50 setcolor pick [ red orange yellow green blue violet ] lt 90 fd 50 rt 90 fd 50 pu fd 50 pd fd 25 bk 50 fd 25 rt 90 fd 50 pu setcolor pick [ red orange yellow green blue violet ] fd 100 rt 90 fd 30 rt 45 pd fd 50 bk 50 rt 90 fd 50 bk 100 fd 50 rt 45 pu fd 50 lt 90 pd fd 50 bk 50 rt 90 setcolor pick [ red orange yellow green blue violet ] fd 50 pu lt 90 fd 100 pd fd 50 rt 90 fd 25 bk 25 lt 90 bk 25 rt 90 fd 25 setcolor pick [ red orange yellow green blue violet ] pu fd 25 lt 90 bk 30 pd rt 90 fd 25 pu fd 25 lt 90 pd fd 50 bk 25 rt 90 fd 25 lt 90 fd 25 bk 50 pu bk 100 lt 90 setcolor pick [ red orange yellow green blue violet ] fd 100 pd rt 90 arc 360 20 pu rt 90 fd 50 pd arc 360 15 pu fd 15 setcolor pick [ red orange yellow green blue violet ] lt
/calculate
的代码在frontend/src/app.controller.ts
,它的逻辑是:
That's classified information. - Asahina Mikuru
;
export default class CalculateModel {
@IsNotEmpty()
@ExpressionValidator(15, {
message: 'Invalid input',
})
public readonly expression: string;
@IsBoolean()
public readonly isVip: boolean = false;
}
ExpressionValidator:
export function ExpressionValidator(property: number, validationOptions?: ValidationOptions) {
return (object: Object, propertyName: string) => {
registerDecorator({
name: 'ExpressionValidator',
target: object.constructor,
propertyName,
constraints: [property],
options: validationOptions,
validator: {
在476包里找到一个控制信号:
2MFG:4BARCODE;CMD:TSPL2;MDL:3B-363B;CLS:PRINTER;
打印机用的是TSPL2语言。
674、675包是输入的程序:
SIZE 47.5 mm, 80.1 mm
GAP 3 mm, 0 mm
DIRECTION 0,0
REFERENCE 0,0
OFFSET 0 mm
SET PEEL OFF
SET CUTTER OFF
SET PARTIAL_CUTTER OFF
SET TEAR ON
CLS
BITMAP 138,75,26,48,1,……
BITMAP 130,579,29,32,1,……
BAR 348, 439, 2, 96
BAR 292, 535, 56, 2
……
BAR 152, 351, 16, 2
BAR 152, 351, 2, 16
PRINT 1,1
查文档分析程序:
https://www.mediaform.de/fileadmin/support/handbuecher/Armilla/Handbuecher/TSC_TSPL_TSPL2_Programming.pdf
下面是重要的命令:
纸张的大小,1mm等于8像素或12像素,经测试是8像素。
将BMP图像打印出来,前四个参数分别是打印位置X、Y和图像长宽,第五个参数是模式,不需要管,第六个参数是图像数据,注意是二值,长是字节数,宽是像素数。
画长方形,前四个参数也是打印位置X、Y和长宽。
接下来用PIL模拟打印过程,最后要旋转180°:
from PIL import Image, ImageDraw
W_mm, H_mm = 47.5, 80.1
W, H = int(W_mm * 8), int(H_mm * 8)
img = Image.new('1', (W, H), 1)
fp = open('675.bin', 'rb')
print(fp.readline().strip()) # SET TEAR ON
print(fp.readline().strip()