/// <summary>
        /// Проверить соответствие формата
        /// </summary>
        private static bool CheckPaperSizeName(string paperName, StampPaperSizeType paperSize, string prefixSearchPaperSize)
        {
            string drawPaperSize = paperSize.ToString();

            if (paperName?.ContainsIgnoreCase(drawPaperSize) != true ||
                paperName.ContainsIgnoreCase(prefixSearchPaperSize) != true)
            {
                return(false);
            }

            int indexSubstringStart = paperName.IndexOf(drawPaperSize, StringComparison.OrdinalIgnoreCase);
            int indexSubstringEnd   = indexSubstringStart + drawPaperSize.Length;

            bool success = false;

            if (indexSubstringEnd >= paperName.Length)
            {
                success = true; //дальше символов нет
            }
            else
            {
                char postDrawFormat = paperName[indexSubstringEnd];
                if (!Char.IsNumber(postDrawFormat) && postDrawFormat != 'x' && postDrawFormat != 'х')
                {
                    success = true; //не число и не содержит знаков
                }
            }
            return(success);
        }
 public StampSettingsWord(StampIdentifier id, string personId, PdfNamingTypeApplication pdfNamingType,
                          StampPaperSizeType paperSize, StampOrientationType orientationType, bool useDefaultSignature)
     : base(id, personId, pdfNamingType, useDefaultSignature)
 {
     PaperSize   = paperSize;
     Orientation = orientationType;
 }
 public FileDataSourceServer(string filePathServer, string filePathClient, ConvertingModeType convertingModeType,
                             StampPaperSizeType paperSize, string printerName)
     : base(filePathServer, filePathClient)
 {
     PaperSize          = paperSize;
     PrinterName        = printerName;
     ConvertingModeType = convertingModeType;
 }
 /// <summary>
 /// Установить формат печати характерный для принтера
 /// </summary>
 public IResultApplication SetPrinterPaperSize(StampPaperSizeType paperSize, string prefixSearchPaperSize) =>
 GetPrinterPaperSize(paperSize, prefixSearchPaperSize).
 ResultVoidOk(paperName =>
 {
     Application.CadInputQueue.SendKeyin("print driver printer.pltcfg");
     Application.CadInputQueue.SendCommand("Print Units mm");
     Application.CadInputQueue.SendCommand($"PRINT papername {paperName}");
     Application.CadInputQueue.SendCommand("PRINT MAXIMIZE");
 }).ToResultApplication();
예제 #5
0
 /// <summary>
 /// Получить принтер по типу конвертации и формату
 /// </summary>
 public IResultValue <IPrinterInformation> GetPrinter(ConvertingModeType convertingModeType, ColorPrintType colorPrintType,
                                                      StampPaperSizeType paperSize) =>
 convertingModeType switch
 {
 public FileDataSourceServer(string filePathServer, string filePathClient,
                             ConvertingModeType convertingModeType, StampPaperSizeType paperSize)
     : this(filePathServer, filePathClient, convertingModeType, paperSize, "-")
 {
 }
 /// <summary>
 /// Получить формат принтера по формату штампа
 /// </summary>
 private static IResultAppValue <string> GetPrinterPaperSize(StampPaperSizeType paperSize, string prefixSearchPaperSize) =>
 new PageSettings().
 Map(pageSettings => pageSettings.PrinterSettings.PaperSizes.Cast <PaperSize>()).
 FirstOrDefault(paper => CheckPaperSizeName(paper.PaperName, paperSize, prefixSearchPaperSize)).
 Map(paperSizeChecked => new ResultAppValue <string>(paperSizeChecked?.PaperName, new ErrorApplication(ErrorApplicationType.PaperSizeNotFound,
                                                                                                       $"Формат печати {paperSize} не найден")));