public void executeCommand(String command) { Console.WriteLine("[COMMAND] " + command); String[] commandAttr = command.Split(' '); switch (commandAttr[0]) { case "Server": createServerDelegate createServer_Del = new createServerDelegate(createServer); createServer_Del.BeginInvoke(commandAttr, null, null); break; case "Client": createClientDelegate createClient_Del = new createClientDelegate(createClient); createClient_Del.BeginInvoke(commandAttr, null, null); break; case "AddRoom": addRoomDelegate addRoom_Del = new addRoomDelegate(addRoom); addRoom_Del.BeginInvoke(commandAttr, null, null); break; case "Status": statusDelegate status_Del = new statusDelegate(status); status_Del.BeginInvoke(null, null); break; case "Crash": crashDelegate crash_Del = new crashDelegate(crash); crash_Del.BeginInvoke(commandAttr[1], null, null); break; case "Freeze": //TODO freezeDelegate freeze_Del = new freezeDelegate(freeze); freeze_Del.BeginInvoke(commandAttr[1], null, null); break; case "Unfreeze": //TODO unfreezeDelegate unfreeze_Del = new unfreezeDelegate(unfreeze); unfreeze_Del.BeginInvoke(commandAttr[1], null, null); break; case "Wait": wait(commandAttr[1]); break; } }
private void executeCommand(string command) { string[] items = command.Split(' '); switch (items[0]) { case "Server": createServerDelegate createServerDel = new createServerDelegate(createServer); createServerDel.BeginInvoke(items, null, null); break; case "Client": createClientDelegate createClientDel = new createClientDelegate(createClient); createClientDel.BeginInvoke(items, null, null); break; case "Status": statusDelegate statusDel = new statusDelegate(status); statusDel.BeginInvoke(null, null); break; case "Crash": crashDelegate crashDel = new crashDelegate(crash); crashDel.BeginInvoke(items[1], null, null); break; case "Freeze": freezeDelegate freezeDel = new freezeDelegate(freeze); freezeDel.BeginInvoke(items[1], null, null); break; case "Unfreeze": unfreezeDelegate unfreezeDel = new unfreezeDelegate(unfreeze); unfreezeDel.BeginInvoke(items[1], null, null); break; case "Wait": Console.Write("wait" + items[1]); System.Threading.Thread.Sleep(int.Parse(items[1])); break; default: //script executeScript(items); break; } }