internal void InvokeCommand(string Data, TCP_ClientNode node) { var DataForm = new { Command = "" }; var CommandData = Newtonsoft.Json.JsonConvert.DeserializeAnonymousType(Data, DataForm); // Deserializes an interface for command pharsing Command cmd = (Command)Commands.First(x => x.Key == CommandData.Command).Value; // Gets the command by searching cmd.Invoke(Newtonsoft.Json.JsonConvert.DeserializeObject(Data, cmd.DataType), node); }
} // Callback /// <summary> /// Invokes the callback /// </summary> /// <param name="Data">The Data to send the callback</param> /// <param name="node">The Client that send the command</param> internal void Invoke(object Data, TCP_ClientNode node) { Callback.Invoke(Data, node); }
private void CMDHandel(object Data, TCP_ClientNode Client) { Console.Dispatcher.Invoke(new Action(() => Console.AppendText("\n[" + DateTime.Now.ToShortTimeString() + "] -> " + ((MessageData)Data).Message))); }