Esempio n. 1
0
        void m_Server_DataReceived(object sender, Utf8TcpPeerEventArgs e)
        {
            XmlDocument xdoc = new XmlDocument();

            xdoc.LoadXml(e.Message);

            if (xdoc.DocumentElement.Name == "policy-file-request")
            {
                Send(xw =>
                {
                    using (xw.Element("cross-domain-policy"))
                    {
                        using (xw.Element("allow-access-from"))
                        {
                            xw.Attribute("domain", "*");
                            xw.Attribute("to-ports", m_Server.PortNumber);
                        }
                    }
                });
                return;
            }

            if (xdoc.DocumentElement.Name == "Command")
            {
                string cmd = xdoc.DocumentElement.GetAttribute("cmd").ToLowerInvariant();
                string arg = xdoc.DocumentElement.GetAttribute("arg");

                switch (cmd)
                {
                case "handshake":
                    SendWelcome();

                    for (int i = 0; i < m_Script.SourceCodeCount; i++)
                    {
                        SetSourceCode(m_Script.GetSourceCode(i));
                    }
                    break;

                case "stepin":
                    QueueAction(new DebuggerAction()
                    {
                        Action = DebuggerAction.ActionType.StepIn
                    });
                    break;

                case "refresh":
                    lock (m_Lock)
                    {
                        for (int i = 0; i < (int)WatchType.MaxValue; i++)
                        {
                            m_CachedWatches[i] = null;
                        }
                    }
                    QueueRefresh();
                    break;

                case "run":
                    QueueAction(new DebuggerAction()
                    {
                        Action = DebuggerAction.ActionType.Run
                    });
                    break;

                case "stepover":
                    QueueAction(new DebuggerAction()
                    {
                        Action = DebuggerAction.ActionType.StepOver
                    });
                    break;

                case "stepout":
                    QueueAction(new DebuggerAction()
                    {
                        Action = DebuggerAction.ActionType.StepOut
                    });
                    break;

                case "pause":
                    m_RequestPause = true;
                    break;

                case "error_rx":
                    m_ErrorRegEx = new Regex(arg.Trim());
                    SendOption("error_rx", m_ErrorRegEx.ToString());
                    break;

                case "addwatch":
                    lock (m_Lock)
                        m_WatchesChanging.UnionWith(arg.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(s => s.Trim()));

                    QueueRefresh();
                    break;

                case "delwatch":
                    lock (m_Lock)
                    {
                        var args = arg.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                        foreach (var a in args)
                        {
                            m_WatchesChanging.Remove(a);
                        }
                    }
                    QueueRefresh();
                    break;

                case "breakpoint":
                    DebuggerAction.ActionType action = DebuggerAction.ActionType.ToggleBreakpoint;

                    if (arg == "set")
                    {
                        action = DebuggerAction.ActionType.SetBreakpoint;
                    }
                    else if (arg == "clear")
                    {
                        action = DebuggerAction.ActionType.ClearBreakpoint;
                    }

                    QueueAction(new DebuggerAction()
                    {
                        Action     = action,
                        SourceID   = int.Parse(xdoc.DocumentElement.GetAttribute("src")),
                        SourceLine = int.Parse(xdoc.DocumentElement.GetAttribute("line")),
                        SourceCol  = int.Parse(xdoc.DocumentElement.GetAttribute("col")),
                    });
                    break;
                }
            }
        }
Esempio n. 2
0
 static void m_Server_DataReceivedAny(object sender, Utf8TcpPeerEventArgs e)
 {
     Console.WriteLine("RCVD: {0}", e.Message);
     e.Peer.Send(e.Message.ToUpper());
 }
Esempio n. 3
0
		void m_Server_ClientConnected(object sender, Utf8TcpPeerEventArgs e)
		{
			Log("Client Connected {0}", e.Peer.Id);
			LogStatus("{0} connected clients", m_Server.GetConnectedClients());
		}
Esempio n. 4
0
		void m_Server_DataReceived(object sender, Utf8TcpPeerEventArgs e)
		{
			Log("Client {0} sent: '{1}'", e.Peer.Id, e.Message);
		}
Esempio n. 5
0
		void m_Client_ClientConnected(object sender, Utf8TcpPeerEventArgs e)
		{
			LogStatus("Client Connected");
		}
Esempio n. 6
0
		void m_Client_DataReceived(object sender, Utf8TcpPeerEventArgs e)
		{
			Log("Server sent: '{0}'", e.Message);
		}