Exemplo n.º 1
0
        private void ValidateConfiguration(ISystemCommandConfiguration config)
        {
            var configClassName = config.GetType().FullName;

            if (string.IsNullOrWhiteSpace(config.CommandName))
            {
                RaiseValidationEvent(
                    new HyperNodeConfigurationException(
                        $"The CommandName property is required for {configClassName}."
                        )
                    );
            }
            else
            {
                if (!SystemCommandName.IsSystemCommand(config.CommandName))
                {
                    RaiseValidationEvent(
                        new HyperNodeConfigurationException(
                            string.Format(
                                "The value '{0}' is not a valid system command name. The following is a list of all recognized system command names:{1}{1}{2}",
                                config.CommandName,
                                Environment.NewLine,
                                string.Join(Environment.NewLine, SystemCommandName.GetAll())
                                )
                            )
                        );
                }
            }
        }
 internal IEnumerable <CommandStatus> GetCommandStatuses()
 {
     return(_commandModuleConfigurations.Keys.Select(
                commandName => new CommandStatus
     {
         CommandName = commandName,
         CommandType = (SystemCommandName.IsSystemCommand(commandName) ? HyperNodeCommandType.SystemCommand : HyperNodeCommandType.CustomCommand),
         Enabled = _commandModuleConfigurations[commandName].Enabled
     }
                ));
 }