Example #1
0
 /// <summary>
 /// Инициализирует новый экземпляр класса <see cref="ServiceBase{TConfig}"/>.
 /// </summary>
 public ServiceBase()
 {
     this.State           = ServiceState.Stopped;
     this.Config          = new TConfig();
     this.DiscordCommands = DiscordCommandLoader.GetCommands(this.GetType().Assembly);
     this.ConsoleCommands = ConsoleCommandLoader.GetCommands(this.GetType().Assembly);
 }
Example #2
0
    private void ExecuteCommand(string input)
    {
        var data = input.Split(new [] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

        var dict = ConsoleCommandLoader.GetCommandsWithGroup(terminalGroup);

        ConsoleCommand cmd = null;

        if (dict.ContainsKey(data[0].ToLower()))
        {
            cmd = dict[data[0].ToLower()];
        }

        StartCoroutine(CommandWrapper(cmd?.Execute(this, data.Skip(1).ToArray())));

        if (cmd == null)
        {
            WriteLine("Command not found!");
        }
    }