Esempio n. 1
0
 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;
 }
Esempio n. 2
0
        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());
            }
        }
Esempio n. 3
0
 private void TaskManagerOnTask(Message message)
 {
     switch (message.GetCommand())
     {
     default:
         TraceOps.Out(message.GetCommand());
         break;
     }
 }
Esempio n. 4
0
 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);
     }
 }
Esempio n. 5
0
 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);
     }
 }
Esempio n. 6
0
 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);
     }
 }
Esempio n. 7
0
 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);
     }
 }
Esempio n. 8
0
 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);
     }
 }
Esempio n. 9
0
 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);
     }
 }
Esempio n. 10
0
 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);
     }
 }
Esempio n. 11
0
        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);
            }
        }
Esempio n. 12
0
 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);
     }
 }
Esempio n. 13
0
        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");
            }
        }
Esempio n. 14
0
        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");
            }
        }
Esempio n. 15
0
        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;
            }
        }
Esempio n. 16
0
        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[] { });
            }
        }
Esempio n. 17
0
        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());
                }
            }
        }
Esempio n. 18
0
 public void SetTask(Message message)
 {
     TraceOps.Out("ZtreeControl Server recived Message: " + message.GetCommand());
 }
Esempio n. 19
0
 private void TaskManagerOnTask(Message message)
 {
     switch (message.GetCommand())
     {
         default:
             TraceOps.Out(message.GetCommand());
             break;
     }
 }
Esempio n. 20
0
 public bool SetMessage(Message message)
 {
     var cq = _concurrentDictionary.GetOrAdd(message.GetDestination(), new ConcurrentQueue<Message>());
     cq.Enqueue(message);
     return true;
 }
Esempio n. 21
0
 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;
     }
 }
Esempio n. 22
0
        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());
            }
        }
Esempio n. 23
0
        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());
                }
            }
        }
Esempio n. 24
0
 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);
     }
 }
Esempio n. 25
0
        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[] { });
            }
        }
Esempio n. 26
0
 public void SetTask(Message message)
 {
     TraceOps.Out("ExternalControl Server recived Message: " + message.GetCommand());
 }