Thanks to TCExecutor you can add communication/configuration layer to your application in just four steps:
- Create TCExecutor object
- Define commands
- Hook up your code to commands events (TCExecutor is multithread/multiconection application remeber that your code must be threadsafe)
- Start TCExecutor listener.
Commands style:
>command1 subcommand1 ... subcommandN param1=X1 ... paramN=XN ARGV1...ARGVN
Features:
Project in action>command1 subcommand1 ... subcommandN param1=X1 ... paramN=XN ARGV1...ARGVN
Features:
- Adds network communication layer to your application
- Supports multiple connections. For each connection separate session is established.
- Commands can be defined at your application startup.
- Each command has separate event to which you can connect to.
- Each command has a short and long help string which helps end user to navigate through available options.
- Enable SSH connections to the TCExecutor.
- Add simple user autentication. Login password.
Project can be found here: https://bitbucket.org/chesti/tcexecutor/
You can clone code from git: git clone https://bitbucket.org/chesti/tcexecutor.git
using TelentCommandExecutor; class ProgramObject { private TCExecutor executorSRV; public ProgramObject() { //create an executor executorSRV = new TCExecutor(); //hook up some commands CmdExecutor e; e = executorSRV.AddCommand("set name"); e.ExecutorEvent += new CmdExecutor.ExecutorHandler(Execute_SetName); e.HelpString = "set name n=name"; e.ShortHelpString = "Dispalys your name"; //listen to the any end point on port 9999 System.Net.IPEndPoint endPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Any, 9999); //start executor executorSRV.StartServer(endPoint); Console.ReadKey(); //stop executor and disconnect all users. executorSRV.StopServer(); } //handle command event string Execute_SetName(Cmd command) { if (command.CmdParams.ContainsKey("n")) { return String.Format("Your name is: {0}", command.CmdParams["n"]); } else { return "Use n= parameter"; } } }