private async Task PlayProject(string script)
        {
            try
            {
                using (var engineSession = new V8EngineSession())
                {                    
                    engineSession.BreakpointEvent += async (obj, exxc) =>
                    {
                        try
                        {
                            await engineSession.Continue(V8ChromeDebugEngine.StepAction.In, 1);
                        }
                        catch (Exception)
                        {
                            //throw;
                        }
                    };

                    var bp = new V8ChromeDebugEngine.Breakpoint
                    {
                        LineNumber = 0,
                        Column = null,
                        Enabled = true,
                        Condition = null,
                        IgnoreCount = 0
                    };

                    var res = await engineSession.SetBreakpoint(bp);

                    await engineSession.Evaluate(script);

                }
            }
            catch (Exception e)
            {
                MessageBox.Show("Exception: "+e.Message);
            }
        }
Exemple #2
0
        private async Task PlayProject(string script)
        {
            try
            {
                using (var engineSession = new V8EngineSession())
                {
                    engineSession.BreakpointEvent += async(obj, exxc) =>
                    {
                        try
                        {
                            await engineSession.Continue(V8ChromeDebugEngine.StepAction.In, 1);
                        }
                        catch (Exception)
                        {
                            //throw;
                        }
                    };

                    var bp = new V8ChromeDebugEngine.Breakpoint
                    {
                        LineNumber  = 0,
                        Column      = null,
                        Enabled     = true,
                        Condition   = null,
                        IgnoreCount = 0
                    };

                    var res = await engineSession.SetBreakpoint(bp);

                    await engineSession.Evaluate(script);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("Exception: " + e.Message);
            }
        }
        private async Task<Response> SetBreakpointInternal(Breakpoint breakpoint)
        {
            var breakPointRequest = new Request("setbreakpoint");

            breakPointRequest.Arguments.type = "script";
            breakPointRequest.Arguments.target = CurrentScriptName;

            breakPointRequest.Arguments.line = breakpoint.LineNumber;

            if (breakpoint.Column.HasValue && breakpoint.Column > 0)
                breakPointRequest.Arguments.column = breakpoint.Column.Value;

            if (breakpoint.Enabled == false)
                breakPointRequest.Arguments.enabled = false;

            if (String.IsNullOrWhiteSpace(breakpoint.Condition) == false)
                breakPointRequest.Arguments.condition = breakpoint.Condition;

            if (breakpoint.IgnoreCount.HasValue && breakpoint.IgnoreCount > 0)
                breakPointRequest.Arguments.ignoreCount = breakpoint.IgnoreCount.Value;

            var breakPointResponse = await SendRequestAsync(breakPointRequest);
            return breakPointResponse;
            
        }
        public async Task<dynamic> SetBreakpoint(Breakpoint breakpoint)
        {
            var response = await SetBreakpointInternal(breakpoint);

            if (response.Success)
                m_breakpoints.Add(breakpoint);

            return response.Body.breakpoint;
        }