Beispiel #1
0
        void RefreshView()
        {
            if (!Visible)
            {
                return;
            }

            CurrentDisplay = SelectedNode;

            SummaryLabel.Text      = "";
            SummaryLabel.ForeColor = ColorProfile.MethodColor;

            if (SelectedNode != null)
            {
                SummaryLabel.Text = Utilities.GetMethodName(SelectedNode, SelectedNode.ID);

                if (SelectedNode.External)
                {
                    DetailsLabel.Text = "Not XRayed";
                }
                else
                {
                    DetailsLabel.Text = "";
                }
            }

            RefreshMsilView();
            RefreshCSharpView();
        }
Beispiel #2
0
        public void NavigateTo(NodeModel node)
        {
            if (node.ObjType != XObjType.Method)
            {
                return;
            }

            var xNode = node.XNode;

            if (xNode == SelectedNode)
            {
                return;
            }

            SelectedNode = xNode;
            ProfileView.NavigateTo(node);

            RefreshView();
        }
        string RunCommand(string input)
        {
            StringBuilder output = new StringBuilder();

            if (string.Compare(input, "help", true) == 0)
            {
                return
                    (@"Commands: 
calls
datpath
eval Nodes, Main
findid <name>
help
id <#>
inits
log
network
settings
stacks");
            }

            else if (input.StartsWith("eval "))
            {
                string exp = input.Replace("eval ", "");
                return(Eval(exp));
            }

            else if (string.Compare(input, "datpath", true) == 0)
            {
                return(XRay.DatPath);
            }

            else if (string.Compare(input, "settings", true) == 0)
            {
                output.AppendLine("InstanceTracking: " + XRay.InstanceTracking);
                output.AppendLine("ThreadTracking: " + XRay.ThreadTracking);
                output.AppendLine("FlowTracking: " + XRay.FlowTracking);

                return(output.ToString());
            }

            else if (string.Compare(input, "stacks", true) == 0)
            {
                foreach (ThreadFlow flow in XRay.FlowMap)
                {
                    if (flow == null)
                    {
                        continue;
                    }

                    output.AppendFormat("Thread: {0}\r\n", flow.ThreadID);

                    for (int x = 0; x <= flow.Pos; x++)
                    {
                        XNodeIn node = XRay.Nodes[flow.Stack[x].NodeID];
                        if (node != null)
                        {
                            output.AppendFormat("{0}: ID: {1}, Inside: {2}\r\n", x, node.ID, node.StillInside);//, (XRay.NodeMap[flow.Stack[x]].StillInside > 0));
                        }
                    }
                }

                return(output.ToString());
            }
            else if (string.Compare(input, "calls", true) == 0)
            {
                // function calls
                output.AppendLine("Method Call Map:");
                foreach (var call in XRay.CallMap)
                {
                    output.AppendFormat("{0} -> {1}: Hit: {2}, Inside: {3}\r\n", call.Source, call.Destination, call.Hit, call.StillInside);
                }

                output.AppendLine("");
                output.AppendLine("Class Call Map:");
                foreach (var call in XRay.ClassCallMap)
                {
                    output.AppendFormat("{0} -> {1}: Hit: {2}, Inside: {3}\r\n", call.Source, call.Destination, call.Hit, call.StillInside);
                }

                return(output.ToString());
            }

            else if (string.Compare(input, "inits", true) == 0)
            {
                foreach (var init in XRay.InitMap)
                {
                    output.AppendFormat("{0} -> {1}\r\n", init.Source, init.Destination);
                }

                return(output.ToString());
            }

            else if (string.Compare(input, "log", true) == 0)
            {
                foreach (string error in XRay.ErrorLog)
                {
                    output.AppendLine(error);
                }

                return(output.ToString());
            }

            else if (input.StartsWith("id "))
            {
                int id = int.Parse(input.Replace("id ", ""));

                return(XRay.Nodes[id].FullName());
            }

            else if (input.StartsWith("findid "))
            {
                string find = input.Replace("findid ", "");

                var results = XRay.Nodes.Where(n => n.Name.Contains(find)).Select(n => n.ID + ": " + n.Name);

                return(String2.Join("\r\n", results));
            }

            else if (string.Compare(input, "network", true) == 0)
            {
                if (XRay.Remote != null)
                {
                    lock (XRay.Remote.DebugLog)
                        foreach (string error in XRay.Remote.DebugLog)
                        {
                            output.AppendLine(error);
                        }
                }

                return(output.ToString());
            }

            else
            {
                return("Unrecognized commands, try help");
            }
        }
Beispiel #4
0
        public void NavigateTo(NodeModel node)
        {
            if (node.ObjType != XObjType.Method)
                return;

            var xNode = node.XNode;

            if (xNode == SelectedNode)
                return;

            SelectedNode = xNode;
            ProfileView.NavigateTo(node);

            RefreshView();
        }
Beispiel #5
0
        void RefreshView()
        {
            if (!Visible)
                return;

            CurrentDisplay = SelectedNode;

            SummaryLabel.Text = "";
            SummaryLabel.ForeColor = ColorProfile.MethodColor;

            if (SelectedNode != null)
            {
                SummaryLabel.Text = Utilities.GetMethodName(SelectedNode, SelectedNode.ID);

                if (SelectedNode.External)
                    DetailsLabel.Text = "Not XRayed";
                else
                    DetailsLabel.Text = "";
            }

            RefreshMsilView();
            RefreshCSharpView();
        }