Example #1
0
        public static void RegisterPathNode(PathNodeModel pathNodeModel)
        {
            if (pathNodeModel.CurrentCommandStep != CurrentCommandStep.StepInto)
            {
                return;
            }

            for (int i = 0; i < pathNodeModel.StackTrace.Count; i++)
            {
                if (i >= CurrentSession.PathNodes.Count)
                {
                    AddNodeAsOf(i, pathNodeModel.StackTrace, PathNodeOrigin.StepInto);
                    break;
                }
                else if (!pathNodeModel.StackTrace[i].Equals(CurrentSession.PathNodes[i].GetStackTrace()))
                {
                    AddNodeAsOf(i, pathNodeModel.StackTrace, PathNodeOrigin.StepInto);
                    break;
                }
                else if (i == pathNodeModel.StackTrace.Count - 1)
                {
                    AddNodeAsOf(i, pathNodeModel.StackTrace, PathNodeOrigin.StepInto);
                    break;
                }
            }
        }
Example #2
0
        public static void VerifyBreakpointRemovedOne(List <BreakpointModel> breakpoints)
        {
            if (CurrentSession == null)
            {
                return;
            }

            List <BreakpointModel> newBreakpointsList = currentBreakpointsList.Where(n => !breakpoints.Any(o => o.Name == n.Name)).ToList();

            foreach (BreakpointModel item in newBreakpointsList)
            {
                currentBreakpointsList.Remove(item);

                IEventData eventData = new EventData
                {
                    EventKind       = EventKind.BreakpointRemove.ToString(),
                    Detail          = item.Name,
                    Namespace       = PathNodeModel.GeNamespaceName(item.FunctionName),
                    Type            = PathNodeModel.GeTypeName(item.FunctionName),
                    TypeFullPath    = "TODO",
                    Method          = PathNodeModel.GetMethodName(item.FunctionName),
                    MethodKey       = String.Empty,
                    MethodSignature = item.FunctionName,
                    CharStart       = item.StartLineText,
                    CharEnd         = item.DocumentModel.EndLineText,
                    LineNumber      = item.DocumentModel.CurrentLineNumber,
                    LineOfCode      = item.DocumentModel.CurrentLine,
                    Created         = DateTime.Now
                };

                CurrentSession.Events.Add(eventData);
                Repository.Save(CurrentSession);
            }
        }
Example #3
0
        public static void RegisterStartPathNode(PathNodeModel pathNodeModel)
        {
            if (addedPathNode)
            {
                return;
            }

            AddNodeAsOf(0, pathNodeModel.StackTrace, PathNodeOrigin.Breakpoint);

            addedPathNode = true;
        }
Example #4
0
        public static void RegisterAlreadyAddedBreakpoints(List <BreakpointModel> breakpoints)
        {
            if (addedBreakpoints)
            {
                return;
            }

            foreach (BreakpointModel item in breakpoints)
            {
                currentBreakpointsList.Add(item);
                dataBreakpointsList.Add(item);

                IEventData eventData = new EventData
                {
                    EventKind       = EventKind.BreakpointAdd.ToString(),
                    Detail          = item.Name,
                    Namespace       = PathNodeModel.GeNamespaceName(item.FunctionName),
                    Type            = PathNodeModel.GeTypeName(item.FunctionName),
                    TypeFullPath    = "TODO",
                    Method          = PathNodeModel.GetMethodName(item.FunctionName),
                    MethodKey       = String.Empty,
                    MethodSignature = item.FunctionName,
                    CharStart       = item.StartLineText,
                    CharEnd         = item.DocumentModel.EndLineText,
                    LineNumber      = item.DocumentModel.CurrentLineNumber,
                    LineOfCode      = item.DocumentModel.CurrentLine,
                    Created         = DateTime.Now
                };

                BreakpointData breakpointData = new BreakpointData
                {
                    BreakpointKind = BreakpointKind.Line.ToString(),
                    Namespace      = PathNodeModel.GeNamespaceName(item.FunctionName),
                    Type           = PathNodeModel.GeTypeName(item.FunctionName),
                    LineNumber     = item.FileLine,
                    LineOfCode     = item.DocumentModel.CurrentLine,
                    Origin         = BreakpointOrigin.AddedBeforeDebug.ToString(),
                    Created        = DateTime.Now
                };

                CurrentSession.Events.Add(eventData);
                CurrentSession.Breakpoints.Add(breakpointData);
                Repository.Save(CurrentSession);

                addedBreakpoints = true;
            }
        }
Example #5
0
        private static void AddNodeAsOf(int start, List <string> stackTrace, PathNodeOrigin pathNodeOrigin)
        {
            for (int i = start; i < stackTrace.Count; i++)
            {
                CurrentSession.PathNodes.Add(new PathNodeData
                {
                    Method    = PathNodeModel.GetMethodName(stackTrace[i]),
                    Created   = DateTime.Now,
                    Namespace = PathNodeModel.GeNamespaceName(stackTrace[i]),
                    Parent    = i == 0 ? null : PathNodeModel.GetMethodName(stackTrace[i - 1]),
                    Type      = PathNodeModel.GeTypeName(stackTrace[i]),
                    Origin    = i == stackTrace.Count - 1 ? pathNodeOrigin.ToString() : PathNodeOrigin.Trace.ToString()
                });

                Repository.Save(CurrentSession);
            }
        }
Example #6
0
        public static void RegisterStep(StepModel sessionModel)
        {
            IEventData eventData = new EventData
            {
                EventKind       = ((EventKind)sessionModel.CurrentCommandStep).ToString(),
                Detail          = "TODO",
                Namespace       = PathNodeModel.GeNamespaceName(sessionModel.CurrentStackFrameFunctionName),
                Type            = PathNodeModel.GeTypeName(sessionModel.CurrentStackFrameFunctionName),
                TypeFullPath    = "TODO",
                Method          = PathNodeModel.GetMethodName(sessionModel.CurrentStackFrameFunctionName),
                MethodKey       = String.Empty,
                MethodSignature = sessionModel.CurrentStackFrameFunctionName,
                CharStart       = sessionModel.CurrentDocument.StartLineText,
                CharEnd         = sessionModel.CurrentDocument.EndLineText,
                LineNumber      = sessionModel.CurrentDocument.CurrentLineNumber,
                LineOfCode      = sessionModel.CurrentDocument.CurrentLine,
                Created         = DateTime.Now
            };

            CurrentSession.Events.Add(eventData);
            Repository.Save(CurrentSession);
        }