Пример #1
0
        /// <summary>
        /// 初始化一个<see cref="PrintCommand"/>类型的实例
        /// </summary>
        /// <param name="printPaper">打印纸</param>
        /// <param name="encoding">字符编码</param>
        public PrintCommand(IPrintPaper printPaper, Encoding encoding)
        {
            Writer         = new WriterCommand(encoding);
            BarcodeBuilder = new BarcodeBuilder(encoding);

            FontStyle       = new FontStyleCommand();
            PagerCut        = new PagerCutCommand();
            Drawer          = new DrawerCommand();
            QrCode          = new QRCodeCommand();
            Barcode         = new BarcodeCommand(BarcodeBuilder);
            Style           = new StyleCommand(printPaper, encoding);
            InitializePrint = new InitializePrintCommand();
            PrintStyle      = new PrintStyleCommand();
            Image           = new ImageCommand(printPaper);
            PrintLine       = new PrintLineCommand(printPaper);
        }
Пример #2
0
        public string ProcessBenchmark(WriterCommand command)
        {
            try
            {
                var benchmark = new BenchmarkTest(command.ThreadsCount, command.DataCount);

                var testTypes = ParseTestTypes(command.TestType,
                                               () => new DbWriterAdapter(command.Host, command.Port, command.TableName),
                                               command.Generator, new KeyGenerator(command.KeyRange));
                foreach (var func in testTypes)
                {
                    benchmark.AddLoadTestFactory(func);
                }

                benchmark.Run();
            }
            catch (Exception e)
            {
                return(e.Message);
            }

            return(string.Empty);
        }
Пример #3
0
 public string WriterCommandHandler(WriterCommand command)
 {
     return(_writerExecutor.ProcessBenchmark(command));
 }