/// <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;
 }
示例#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;
 }
示例#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);
                }
            }
        }
示例#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);
                }
            }
        }