Exemple #1
0
        /// <summary>
        /// Parse a print mode format and add to self for storage.
        /// </summary>
        /// <param name="format">The print mode format to parse.</param>
        /// <param name="factory">The element factory to generate elements after parsing.</param>
        /// <returns>The parsed format.</returns>
        public static PrintModeParser Parse(string format, IPrinterElementFactory factory)
        {
            var parser = new PrintModeParser();

            parser.InternalProcess(format, factory);
            return(parser);
        }
Exemple #2
0
        /// <summary>
        /// Set the print mode value to use. This will reset any existing print mode values.
        /// </summary>
        /// <param name="mode">The print mode to use.</param>
        /// <param name="printer">The printer that will be using the print mode.</param>
        public void SetMode(string mode, IPrinter printer)
        {
            if (mode == null)
            {
                throw new ArgumentNullException(nameof(mode));
            }

            logConditional = null;
            elements       = null;

            var factory = printer.ElementFactory ?? new ElementFactory();
            var parser  = PrintModeParser.Parse(mode, factory);

            logConditional = parser.GlobalConditional;
            elements       = parser;
        }