Example #1
0
        private WatchNode Parse(List <NameTime> list)
        {
            WatchNode TopNode = new WatchNode();
            var       current = TopNode;

            foreach (var nameTime in list)
            {
                switch (nameTime.Do)
                {
                case "OnActionExecuting":
                    if (nameTime.Parent == null)
                    {
                        TopNode.IsChild           = false;
                        TopNode.OnActionExecuting = nameTime.Time;
                    }
                    else
                    {
                        var newnode = new WatchNode();
                        newnode.Parent = current;
                        current.Child.Add(newnode);
                        current                   = newnode;
                        current.IsChild           = true;
                        current.OnActionExecuting = nameTime.Time;
                    }

                    current.Name = nameTime.Name;

                    break;

                case "OnActionExecuted":
                    current.OnActionExecuted = nameTime.Time;

                    break;

                case "OnResultExecuting":
                    current.OnResultExecuting = nameTime.Time;
                    break;

                case "OnResultExecuted":
                    current.OnResultExecuted = nameTime.Time;

                    if (current.Parent != null && current.Parent.Name == nameTime.ParentName)
                    {
                        current = current.Parent;
                    }

                    break;
                }
            }

            return(TopNode);
        }
Example #2
0
        private string PrintNode(WatchNode node)
        {
            var s = "name:" + node.Name + " = " + node.All + "  action->" + node.Action + " Result->" + node.Result + " parent->" + node.ParentName + NewLine;

            if (node.Child != null && node.Child.Count > 0)
            {
                s += "c___:" + node.Name + "=" + node.Child.Sum(x => x.All) + "  action->" +
                     node.Child.Sum(x => x.Action) + " Result->" + node.Child.Sum(x => x.Result) + NewLine;
            }

            foreach (var watchData in node.Child)
            {
                var temp = watchData;
                var c    = 0;
                while (temp.Parent != null)
                {
                    temp = temp.Parent;
                    c++;
                }
                s += "".PadLeft(c * 2, '-') + PrintNode(watchData);
            }

            return(s);
        }
Example #3
0
        private WatchNode Parse(List<NameTime> list)
        {
            WatchNode TopNode = new WatchNode();
            var current = TopNode;
            foreach (var nameTime in list)
            {

                switch (nameTime.Do)
                {
                    case "OnActionExecuting":
                        if (nameTime.Parent == null)
                        {
                            TopNode.IsChild = false;
                            TopNode.OnActionExecuting = nameTime.Time;
                        }
                        else
                        {
                            var newnode = new WatchNode();
                            newnode.Parent = current;
                            current.Child.Add(newnode);
                            current = newnode;
                            current.IsChild = true;
                            current.OnActionExecuting = nameTime.Time;
                        }

                        current.Name = nameTime.Name;

                        break;
                    case "OnActionExecuted":
                        current.OnActionExecuted = nameTime.Time;

                        break;
                    case "OnResultExecuting":
                        current.OnResultExecuting = nameTime.Time;
                        break;
                    case "OnResultExecuted":
                        current.OnResultExecuted = nameTime.Time;

                        if (current.Parent != null && current.Parent.Name == nameTime.ParentName)
                        {
                            current = current.Parent;
                        }

                        break;

                }

            }

            return TopNode;
        }
Example #4
0
        private string PrintNode(WatchNode node)
        {

            var s = "name:" + node.Name + " = " + node.All + "  action->" + node.Action + " Result->" + node.Result + " parent->" + node.ParentName + NewLine;

            if (node.Child != null && node.Child.Count > 0)
            {
                s += "c___:" + node.Name + "=" + node.Child.Sum(x => x.All) + "  action->" +
                     node.Child.Sum(x => x.Action) + " Result->" + node.Child.Sum(x => x.Result) + NewLine;
            }

            foreach (var watchData in node.Child)
            {
                var temp = watchData;
                var c = 0;
                while (temp.Parent != null)
                {
                    temp = temp.Parent;
                    c++;
                }
                s += "".PadLeft(c * 2, '-') + PrintNode(watchData);
            }

            return s;

        }