Exemple #1
0
        ClassData getOrCreateClassData(MethodEvent mev)
        {
            String hash = mev.getHash();

            if (!classData.ContainsKey(hash))
            {
                ClassData c = new ClassData();
                c.instanceObjectID = mev.InstanceObjectID;
                c.columnNumber = nextFreeColumn++;
                this.classData[hash] = c;
            }

            return (ClassData) this.classData[hash];
        }
Exemple #2
0
        ArrayList readFromXML()
        {
            XPathDocument doc = new XPathDocument("C:\\Documents and Settings\\mat\\Desktop\\yo.xml.txt");
            XPathNavigator nav = doc.CreateNavigator();

            XPathExpression functionInfosExpression = nav.Compile("infos/functionInfos/functionInfo");
            XPathNodeIterator functionInfosIterator = nav.Select(functionInfosExpression);

            XPathExpression eventsExpression = nav.Compile("infos/events/*");
            XPathNodeIterator eventsIterator = nav.Select(eventsExpression);

            Hashtable functionInfos = new Hashtable();

            while (functionInfosIterator.MoveNext())
            {
                XPathNavigator node = functionInfosIterator.Current.Clone();

                MethodInfo m = new MethodInfo();
                m.FunctionID = node.GetAttribute("functionId", String.Empty);
                m.ClassName = node.GetAttribute("className", String.Empty);
                m.MethodName = node.GetAttribute("methodName", String.Empty);
                if (node.GetAttribute("static", String.Empty).Length > 0)
                m.IsStatic = Convert.ToBoolean(node.GetAttribute("static", String.Empty));
                m.ReturnType = node.GetAttribute("returnType", String.Empty);

                functionInfos[m.FunctionID] = m;
            }

            ArrayList events = new ArrayList();

            while (eventsIterator.MoveNext())
            {
                XPathNavigator node = eventsIterator.Current.Clone();

                if (node.Name == "methodEvent")
                {
                    MethodEvent m = new MethodEvent();
                    m.InstanceObjectID = node.GetAttribute("objectId", String.Empty);
                    m.MethodInfo = (MethodInfo)functionInfos[node.GetAttribute("functionId", String.Empty)];
                    m.ThreadID = node.GetAttribute("threadId", String.Empty);
                    m.timestamp = Convert.ToDouble(node.GetAttribute("timestamp", String.Empty));

                    String type = node.GetAttribute("type", String.Empty);

                    if (type == "Enter")
                        m.EventType = MethodEvent.EventTypeEnum.EnterEvent;
                    else if (type == "Leave")
                        m.EventType = MethodEvent.EventTypeEnum.LeaveEvent;

                    events.Add(m);
                }
                if (node.Name == "threadEvent")
                {
                    ThreadEvent t = new ThreadEvent();
                    t.timestamp = Convert.ToDouble(node.GetAttribute("timestamp", String.Empty));
                    t.ThreadID = node.GetAttribute("threadId", String.Empty);

                    String type = node.GetAttribute("type", String.Empty);
                    if (type == "Create")
                        t.EventType = ThreadEvent.EventTypeEnum.CreateEvent;
                    else if (type == "Destroy")
                        t.EventType = ThreadEvent.EventTypeEnum.DestroyEvent;

                    events.Add(t);
                }
                if (node.Name == "exceptionEvent")
                {
                    ExceptionEvent t = new ExceptionEvent();
                    t.timestamp = Convert.ToDouble(node.GetAttribute("timestamp", String.Empty));
                    events.Add(t);
                }
            }

            return events;
        }
Exemple #3
0
        void drawHeader(Graphics g, MethodEvent e, float x, float y)
        {
            String title = e.MethodInfo.ClassName;
            Pen blackBorderPen = new Pen(Color.Gray);
            Font textFont = new Font("Tahoma", 8 * zoomScale);

            if (!e.MethodInfo.IsStatic)
                title += "\nInst. " + e.InstanceObjectID.ToString();

            StringFormat f = new StringFormat();
            f.Alignment = StringAlignment.Center;
            f.LineAlignment = StringAlignment.Center;

            SizeF stringSize = new SizeF();
            stringSize = g.MeasureString(title, textFont, new SizeF(colWidth * zoomScale, 50));

            int boxHeight = (int) (stringSize.Height + 20);

            if (e.MethodInfo.IsStatic)
            {
                g.DrawRectangle(blackBorderPen, x, y - boxHeight - 20, colWidth * zoomScale, boxHeight);
            }
            else
            {
                RoundedCornerRectangle(g, blackBorderPen, x, y - boxHeight - 20, colWidth * zoomScale, boxHeight, boxHeight * 0.3f);
            }

            g.DrawString(title, textFont, Brushes.Black, x + colWidth * 0.5f * zoomScale, y + 10 + stringSize.Height * 0.5f - boxHeight - 20, f);
        }