private ConcurrentQueue<Message> ConcurrentQueueFactory(string s) { var cq = new ConcurrentQueue<Message>(); var p = new string[,] {{"p1", "v1"}, {"p2", "v2"}}; var m = new Message(p, true, "registered as '" + s + "'", ""); cq.Enqueue(m); return cq; }
public void SetTask(Message message) { try { var thread = new Thread(new ThreadStart(() => { try { TraceOps.Out("WebControl Client recived Message: " + message.GetCommand()); if (message.GetCommand() == "open_browser") { var d = new PluginCallback(_control.StartBrowser); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "open_custom_browser") { var d = new PluginCallback(_control.StartCustomBrowser); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "close_browser") { var d = new PluginCallback(_control.StopBrowser); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "change_url") { var p = message.GetParameter(); var value = ""; if (p.GetLength(0) > 0 && p.GetLength(1) > 1) { value = Message.GetAttribute(p, "url"); } if (value != "") { _control.SetUrl(value); } var d = new PluginCallback(_control.ChangeUrl); _mainForm.Invoke(d, new object[] { }); } } catch (Exception e) { TraceOps.Out(e.ToString()); } })); thread.Start(); } catch (Exception e) { TraceOps.Out(e.ToString()); } }
private void TaskManagerOnTask(Message message) { switch (message.GetCommand()) { default: TraceOps.Out(message.GetCommand()); break; } }
public static void RemoteStartProcess(object sender, EventArgs e) { foreach (ConnectionTable.ClientInformation clientInformation in _connectionTable.GetChecked()) { var p = new string[,] { { "fileName", "" }, { "arguments", ""} }; var m = new Message(p, true, "start_process", clientInformation.GetName()); _messageQueue.SetMessage(m); } }
public static void RemoteStartKeyLogging(object sender, EventArgs e) { foreach (ConnectionTable.ClientInformation clientInformation in _connectionTable.GetChecked()) { var p = new string[,] { { "key", "tab" } }; var m = new Message(p, true, "start_keylogging", clientInformation.GetName()); _messageQueue.SetMessage(m); } }
public static void RemoteShutDownWindows(object sender, EventArgs e) { foreach (ConnectionTable.ClientInformation clientInformation in _connectionTable.GetChecked()) { var p = new string[,] { { "fileName", "cmd" }, { "arguments", ClientModel.BuildCommandLineOptionsShutDown() } }; var m = new Message(p, true, "start_process", clientInformation.GetName()); _messageQueue.SetMessage(m); } }
public static void OpenCustomBrowser(object sender, EventArgs e) { var clientInformations = _connectionTable.GetChecked(); foreach (ConnectionTable.ClientInformation clientInformation in clientInformations) { var p = new string[,] { }; var m = new Message(p, true, "open_custom_browser", clientInformation.GetName()); _messageQueue.SetMessage(m); } }
public static void RemoteShutDownWindows(object sender, EventArgs e) { foreach (ConnectionTable.ClientInformation clientInformation in _connectionTable.GetChecked()) { var p = new string[, ] { { "fileName", "cmd" }, { "arguments", ClientModel.BuildCommandLineOptionsShutDown() } }; var m = new Message(p, true, "start_process", clientInformation.GetName()); _messageQueue.SetMessage(m); } }
public static void RemoteStartKeyLogging(object sender, EventArgs e) { foreach (ConnectionTable.ClientInformation clientInformation in _connectionTable.GetChecked()) { var p = new string[, ] { { "key", "tab" } }; var m = new Message(p, true, "start_keylogging", clientInformation.GetName()); _messageQueue.SetMessage(m); } }
public static void RemoteStopProcess(object sender, EventArgs e) { foreach (ConnectionTable.ClientInformation clientInformation in _connectionTable.GetChecked()) { var p = new string[, ] { { "fileName", "" }, { "arguments", "" } }; var m = new Message(p, true, "stop_process", clientInformation.GetName()); _messageQueue.SetMessage(m); } }
public static void OpenCustomBrowser(object sender, EventArgs e) { var clientInformations = _connectionTable.GetChecked(); foreach (ConnectionTable.ClientInformation clientInformation in clientInformations) { var p = new string[, ] { }; var m = new Message(p, true, "open_custom_browser", clientInformation.GetName()); _messageQueue.SetMessage(m); } }
public static void RemoteStopLeaf(object sender, EventArgs e) { foreach (ConnectionTable.ClientInformation clientInformation in _connectionTable.GetChecked()) { TraceOps.Out(clientInformation.GetName()); var p = new string[, ] { { }, { } }; var m = new Message(p, true, "stop_zleaf", clientInformation.GetName()); _messageQueue.SetMessage(m); } }
private void button1_Click_1(object sender, EventArgs e) { var p = new string[,] { { "p1", "v1" }, { "p2", "v2" } }; var m = new Message(p, true, "ping", "Server"); if (_messageQueue != null) { _messageQueue.SetMessage(m); } else { TraceOps.Out("no connection to server message queue"); } }
private void button1_Click_1(object sender, EventArgs e) { var p = new string[, ] { { "p1", "v1" }, { "p2", "v2" } }; var m = new Message(p, true, "ping", "Server"); if (_messageQueue != null) { _messageQueue.SetMessage(m); } else { TraceOps.Out("no connection to server message queue"); } }
private void TaskManagerOnTask(Message message) { switch (message.GetCommand()) { case "": Console.WriteLine("Case 1"); break; case "a": Console.WriteLine("Case 2"); break; default: TraceOps.Out(message.GetCommand()); break; } }
public void SetTask(Message message) { TraceOps.Out("ExternalControl Client recived Message: " + message.GetCommand()); if (message.GetCommand() == "start_externalcontrol") { var d = new PluginCallback(_control.RemoteStartProcess); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "start_externalcontrol") { var d = new PluginCallback(_control.RemoteStopProcess); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "restart_windows") { var d = new PluginCallback(_control.RemoteStartProcess); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "logoff_windows") { var d = new PluginCallback(_control.RemoteStartProcess); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "shutdown_windows") { var d = new PluginCallback(_control.RemoteStartProcess); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "start_keylogging") { var d = new PluginCallback(_control.RemoteKeyLogging); _mainForm.Invoke(d, new object[] { }); } }
public void SetTask(Message message) { TraceOps.Out("ZtreeControl Client recived Message: " + message.GetCommand()); if (message.GetCommand() == "start_zleaf") { var d = new PluginCallback(_control.StartZLeaf); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "stop_zleaf") { var d = new PluginCallback(_control.StopZLeaf); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "set_preferences") { var p = message.GetParameter(); var xvalue = ""; var yvalue = ""; var wvalue = ""; var hvalue = ""; if (p.GetLength(0) > 0 && p.GetLength(1) > 1) { xvalue = Message.GetAttribute(p, "X"); } if (p.GetLength(0) > 0 && p.GetLength(1) > 1) { yvalue = Message.GetAttribute(p, "Y"); } if (p.GetLength(0) > 0 && p.GetLength(1) > 1) { wvalue = Message.GetAttribute(p, "W"); } if (p.GetLength(0) > 0 && p.GetLength(1) > 1) { hvalue = Message.GetAttribute(p, "H"); } try { if (xvalue != "") ClientModel.X = Convert.ToInt32(xvalue); if (yvalue != "") ClientModel.Y = Convert.ToInt32(yvalue); if (wvalue != "") ClientModel.W = Convert.ToInt32(wvalue); if (hvalue != "") ClientModel.H = Convert.ToInt32(hvalue); var np = new string[,] { { }, { } }; var nm = new Message(np, true, "zleaf_config_changed", "Server"); _messageQueue.SetMessage(nm); } catch (Exception e) { TraceOps.Out(e.ToString()); } } }
public void SetTask(Message message) { TraceOps.Out("ZtreeControl Server recived Message: " + message.GetCommand()); }
public bool SetMessage(Message message) { var cq = _concurrentDictionary.GetOrAdd(message.GetDestination(), new ConcurrentQueue<Message>()); cq.Enqueue(message); return true; }
public void SetTask(Message message) { try { var thread = new Thread(new ThreadStart(() => { try { TraceOps.Out("WebControl Client recived Message: "+ message.GetCommand()); if (message.GetCommand() == "open_browser") { var d = new PluginCallback(_control.StartBrowser); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "open_custom_browser") { var d = new PluginCallback(_control.StartCustomBrowser); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "close_browser") { var d = new PluginCallback(_control.StopBrowser); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "change_url") { var p = message.GetParameter(); var value = ""; if (p.GetLength(0) > 0 && p.GetLength(1) > 1) { value = Message.GetAttribute(p, "url"); } if (value != "") _control.SetUrl(value); var d = new PluginCallback(_control.ChangeUrl); _mainForm.Invoke(d, new object[] { }); } } catch (Exception e) { TraceOps.Out(e.ToString()); } })); thread.Start(); } catch (Exception e) { TraceOps.Out(e.ToString()); } }
public void SetTask(Message message) { TraceOps.Out("ZtreeControl Client recived Message: " + message.GetCommand()); if (message.GetCommand() == "start_zleaf") { var d = new PluginCallback(_control.StartZLeaf); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "stop_zleaf") { var d = new PluginCallback(_control.StopZLeaf); _mainForm.Invoke(d, new object[] { }); } if (message.GetCommand() == "set_preferences") { var p = message.GetParameter(); var xvalue = ""; var yvalue = ""; var wvalue = ""; var hvalue = ""; if (p.GetLength(0) > 0 && p.GetLength(1) > 1) { xvalue = Message.GetAttribute(p, "X"); } if (p.GetLength(0) > 0 && p.GetLength(1) > 1) { yvalue = Message.GetAttribute(p, "Y"); } if (p.GetLength(0) > 0 && p.GetLength(1) > 1) { wvalue = Message.GetAttribute(p, "W"); } if (p.GetLength(0) > 0 && p.GetLength(1) > 1) { hvalue = Message.GetAttribute(p, "H"); } try { if (xvalue != "") { ClientModel.X = Convert.ToInt32(xvalue); } if (yvalue != "") { ClientModel.Y = Convert.ToInt32(yvalue); } if (wvalue != "") { ClientModel.W = Convert.ToInt32(wvalue); } if (hvalue != "") { ClientModel.H = Convert.ToInt32(hvalue); } var np = new string[, ] { { }, { } }; var nm = new Message(np, true, "zleaf_config_changed", "Server"); _messageQueue.SetMessage(nm); } catch (Exception e) { TraceOps.Out(e.ToString()); } } }
public static void RemoteStopLeaf(object sender, EventArgs e) { foreach (ConnectionTable.ClientInformation clientInformation in _connectionTable.GetChecked()) { TraceOps.Out(clientInformation.GetName()); var p = new string[,] { { }, { } }; var m = new Message(p, true, "stop_zleaf", clientInformation.GetName()); _messageQueue.SetMessage(m); } }
public void SetTask(Message message) { TraceOps.Out("ExternalControl Server recived Message: " + message.GetCommand()); }