// NO default public constructor - by design
        internal CommandEngine(CommandManager commandManager, ICommandParserOptions options, CommandEngineStyles styles, HelpPrinter printHelper, IConsole console)
        {
            if (commandManager == null)
            {
                throw new ArgumentNullException(nameof(commandManager));
            }
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }
            if (styles == null)
            {
                throw new ArgumentNullException(nameof(styles));
            }
            if (console == null)
            {
                throw new ArgumentNullException(nameof(console));
            }

            this._commandManager = commandManager;
            this._console        = console;
            this._options        = options;
            this._styles         = styles;
            this._helpPrinter    = printHelper;
        }
 public OutputManager(IConsole consoleInstance, CommandEngineStyles engineStyles, CultureInfo uiCulture)
 {
     this._consoleInstance = consoleInstance;
     this._engineStyles    = engineStyles;
     this._uiCulture       = uiCulture;
     this._tablePrinter    = new DataTablePrinter(consoleInstance);
 }
        private CommandEngineBuilder()
        {
            this._commands = new List <Type>();
            this._styles   = CommandEngineStyles.DefaultStyles;
            // TODO: this._options = CommandParserOptions.Default;

            this.AddStandardCommands();
        }
        public CommandEngineBuilder UsingStyles(CommandEngineStyles styles)
        {
            if (styles == null)
            {
                throw new ArgumentNullException(nameof(styles));
            }

            this._styles = styles;

            return(this);
        }
示例#5
0
        public OutputManager(IConsole consoleInstance, CommandEngineStyles engineStyles, CultureInfo uiCulture)
        {
            this._consoleInstance = consoleInstance;
            this._engineStyles    = engineStyles;
            this._uiCulture       = uiCulture;

            this._tablePrinter = new SimpleTablePrinter(
                consoleInstance,
                new SimpleTableStyle(engineStyles.HelpStyles.HelpHeader, engineStyles.OddRowColor)
            {
                EvenRowColor      = engineStyles.EvenRowColor,
                AtomicPrinting    = true,
                ShowHeader        = true,
                OverflowBehaviour = TableOverflowContentBehavior.Wrap
            });
        }
示例#6
0
        // NO default public constructor - by design -> use builder
        internal CommandEngine(CommandManager commandManager, ICommandParserOptions options, CommandEngineStyles styles, HelpPrinter printHelper, IConsole console, IClipboard clipboard)
        {
            commandManager.Requires(nameof(commandManager)).IsNotNull();
            options.Requires(nameof(options)).IsNotNull();
            styles.Requires(nameof(styles)).IsNotNull();
            printHelper.Requires(nameof(printHelper)).IsNotNull();
            console.Requires(nameof(console)).IsNotNull();
            clipboard.Requires(nameof(clipboard)).IsNotNull();

            this._commandManager        = commandManager;
            this._autoCompletionManager = new CommandAutoCompletionProvider(this._commandManager);
            this._virtualLine           = new VirtualEntryLine(console, clipboard, styles.Default);
            this._console       = console;
            this._options       = options;
            this._styles        = styles;
            this._helpPrinter   = printHelper;
            this._outputManager = new OutputManager(this._console, this._styles, this._options.UiCulture);

            // TODO: check option before displaying this message
            // this._console.WriteLine(styles.Default, "Initializing ObscureWare's command engine...");
        }