示例#1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="controllers">Controllers</param>
        /// <param name="variables">Variables</param>
        /// <param name="logs">Logs</param>
        /// <param name="networkManager">Network manger</param>
        /// <param name="consoleReaderInit">Console reader init</param>
        /// <param name="consoleWriterInit">Console writer init</param>
        /// <param name="logger">Logger</param>
        /// <param name="blockchain">Blockchain</param>
        /// <param name="vmFactory">VM Factory</param>
        public Prompt
        (
            IEnumerable <IPromptController> controllers,
            IPromptUserVariables variables,
            ILogBag logs,
            INetworkManager networkManager,
            IConsoleReader consoleReaderInit,
            IConsoleWriter consoleWriterInit,
            Core.Logging.ILogger <Prompt> logger,
            IBlockchain blockchain
        )
        {
            _networkManager = networkManager;
            _consoleReader  = consoleReaderInit;
            _consoleWriter  = consoleWriterInit;
            _logger         = logger;
            _blockchain     = blockchain;
            _logs           = logs;
            _variables      = variables;

            // Get controllers

            _commandAutocompleteCache = new AutoCommandComplete();
            _commandCache             = new Dictionary <string[], PromptCommandAttribute>();
            _commandCache.Cache(this, _commandAutocompleteCache);

            foreach (var controller in controllers)
            {
                _commandCache.Cache(controller, _commandAutocompleteCache);
            }
        }
示例#2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="logBag">Log bag</param>
 /// <param name="logger">Logger</param>
 /// <param name="log">Log</param>
 /// <param name="vmFactory">VM Factory</param>
 /// <param name="consoleHandler">Console handler</param>
 public PromptDebugController
 (
     ILogBag logBag,
     Core.Logging.ILogger <Prompt> logger, ILoggerFactoryExtended log,
     IVMFactory vmFactory, IConsoleHandler consoleHandler
 )
 {
     _logs           = logBag;
     _log            = log;
     _logger         = logger;
     _vmFactory      = vmFactory;
     _consoleHandler = consoleHandler;
 }
示例#3
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="controllers">Controllers</param>
        /// <param name="variables">Variables</param>
        /// <param name="logs">Logs</param>
        /// <param name="networkManager">Network manger</param>
        /// <param name="consoleHandler">Console handler</param>
        /// <param name="logger">Logger</param>
        /// <param name="blockchain">Blockchain</param>
        /// <param name="vmFactory">VM Factory</param>
        public Prompt
        (
            IEnumerable <IPromptController> controllers,
            IPromptUserVariables variables,
            ILogBag logs,
            INetworkManager networkManager,
            IConsoleHandler consoleHandler,
            Core.Logging.ILogger <Prompt> logger,
            IBlockchain blockchain
        )
        {
            _networkManager = networkManager;
            _consoleHandler = consoleHandler;
            _logger         = logger;
            _blockchain     = blockchain;
            _logs           = logs;
            _variables      = variables;

            // Get controllers

            _commandAutocompleteCache = new AutoCommandComplete();
            _commandCache             = new Dictionary <string[], PromptCommandAttribute>();
            _commandCache.Cache(this, _commandAutocompleteCache);

            foreach (var controller in controllers)
            {
                _commandCache.Cache(controller, _commandAutocompleteCache);
            }

            // Help autocomplete

            var ls = new List <string>();

            foreach (var keys in _commandCache.Keys)
            {
                foreach (var key in keys)
                {
                    if (_commandCache.TryGetValue(keys, out var value) && !ls.Contains(value.Command))
                    {
                        ls.Add(value.Command);
                    }
                }
            }

            CommandAutoCompleteAttribute.Availables = ls.OrderBy(u => u).ToArray();
        }