|
| 1 | +# CommandExecutor |
| 2 | + |
| 3 | +### Feature |
| 4 | +- Executor register all method that inherit ICommandModule. |
| 5 | +- Can execute commands with only string. |
| 6 | +- String will automatically change to parameter type. |
| 7 | +- Provides set arguments count for array. |
| 8 | + |
| 9 | +### Example |
| 10 | +First, declare executor object. |
| 11 | +```cs |
| 12 | +// in Main method |
| 13 | +
|
| 14 | +Executor executor = new(new ExecutorConfiguration() { |
| 15 | + IgnoreCase = true, |
| 16 | + IgnoreExtraArguments = false, |
| 17 | + GetPrivateMethod = false |
| 18 | +}); |
| 19 | +``` |
| 20 | + |
| 21 | +Second, create class that inherit ICommandModule. |
| 22 | +```cs |
| 23 | +// outisde of Main class |
| 24 | +
|
| 25 | +public class BasicCommand : ICommandModule |
| 26 | +{ |
| 27 | + // You can set command name and alias. |
| 28 | + [Command] |
| 29 | + public void Hello(string person) |
| 30 | + { |
| 31 | + Console.WriteLine($"Hello, {person}!"); |
| 32 | + } |
| 33 | +} |
| 34 | +``` |
| 35 | + |
| 36 | +Third, register class. |
| 37 | +```cs |
| 38 | +// in Main method |
| 39 | +
|
| 40 | +executor.RegisterCommands<BasicCommand>(); |
| 41 | +``` |
| 42 | + |
| 43 | +Last, execute commands with string. |
| 44 | +```cs |
| 45 | +// in Main method |
| 46 | +
|
| 47 | +executor.Execute("Hello World"); |
| 48 | +``` |
| 49 | + |
| 50 | +Then, it execute 'Hello' method with arguments "World" |
| 51 | + |
| 52 | +[See Example Code](/Test/Program.cs) |
| 53 | + |
| 54 | +### New Features |
| 55 | +- [ ] Execute with string and object[] for arguments |
| 56 | +- [ ] Support override method |
| 57 | +- [ ] Checking attribute whether execute with custom attribute |
| 58 | + |
| 59 | +### Contact |
| 60 | +- Discord : 단비#1004 |
| 61 | +- Gmail : emailluana@gmail.com |
| 62 | + |
| 63 | +### Compile Information |
| 64 | +Framework version : Standard 2.1 / .NET 5.0 |
0 commit comments