Exemplo n.º 1
0
 /// <summary>
 ///     Constructor.
 /// </summary>
 /// <param name="client">Node debugger client.</param>
 public NodeDebuggerManager(NodeDebuggerClient client)
 {
     _client = client;
     _client.BreakpointEvent += OnBreakpointEvent;
     _client.CompileEvent += OnCompileEvent;
     _client.ExceptionEvent += OnExceptionEvent;
 }
Exemplo n.º 2
0
 /// <summary>
 ///     Constructor.
 /// </summary>
 /// <param name="client">Node debugger client.</param>
 public NodeDebuggerManager(NodeDebuggerClient client)
 {
     _client = client;
     _client.BreakpointEvent += OnBreakpointEvent;
     _client.CompileEvent    += OnCompileEvent;
     _client.ExceptionEvent  += OnExceptionEvent;
 }
Exemplo n.º 3
0
        private void OnProcessOutputData(object sender, DataReceivedEventArgs e)
        {
            if (string.IsNullOrEmpty(e.Data))
            {
                return;
            }

            EventHandler <OutputEventArgs> processOutput = ProcessOutput;

            if (processOutput != null)
            {
                string message = string.Format("{0}{1}", e.Data, Environment.NewLine);
                processOutput(this, new OutputEventArgs(this, message));
            }

            if (_debugger != null)
            {
                return;
            }

            Match match = _debuggerPort.Match(e.Data);

            if (match.Success)
            {
                string portValue = match.Groups[1].Value;
                int    port      = int.Parse(portValue);

                var client = new NodeDebuggerClient(new NodeDebuggerConnection("localhost", port));
                _debugger = new NodeDebuggerManager(client);

                var tasks = new List <Task>
                {
                    _debugger.InitializeAsync()
                };

                if (BreakOnAllExceptions)
                {
                    tasks.Add(_debugger.SetExceptionHandlingAsync(BreakOnAllExceptions));
                }

                try
                {
                    Task.WhenAll(tasks).Wait();
                }
                catch (Exception)
                {
                    _debugger.Terminate();
                }

                EventHandler <EventArgs> processLoaded = ProcessLoaded;
                if (processLoaded != null)
                {
                    processLoaded(this, EventArgs.Empty);
                }
            }
        }
Exemplo n.º 4
0
        private void OnProcessOutputData(object sender, DataReceivedEventArgs e)
        {
            if (string.IsNullOrEmpty(e.Data))
            {
                return;
            }

            EventHandler<OutputEventArgs> processOutput = ProcessOutput;
            if (processOutput != null)
            {
                string message = string.Format("{0}{1}", e.Data, Environment.NewLine);
                processOutput(this, new OutputEventArgs(this, message));
            }

            if (_debugger != null)
            {
                return;
            }

            Match match = _debuggerPort.Match(e.Data);
            if (match.Success)
            {
                string portValue = match.Groups[1].Value;
                int port = int.Parse(portValue);

                var client = new NodeDebuggerClient(new NodeDebuggerConnection("localhost", port));
                _debugger = new NodeDebuggerManager(client);

                var tasks = new List<Task>
                    {
                        _debugger.InitializeAsync()
                    };

                if (BreakOnAllExceptions)
                {
                    tasks.Add(_debugger.SetExceptionHandlingAsync(BreakOnAllExceptions));
                }

                try
                {
                    Task.WhenAll(tasks).Wait();
                }
                catch (Exception)
                {
                    _debugger.Terminate();
                }

                EventHandler<EventArgs> processLoaded = ProcessLoaded;
                if (processLoaded != null)
                {
                    processLoaded(this, EventArgs.Empty);
                }
            }
        }