Exemplo n.º 1
0
        XmlReportRawEntityCount(XmlTextWriter stream)
        {
            BlockCount tmpBlockCount = null;
            ObjCount   tmpObjCount   = null;

            stream.WriteStartElement("RawCount");

            ArrayList classNames   = new ArrayList();
            ArrayList displayNames = new ArrayList();
            ArrayList objCounts    = new ArrayList();;

            // walk through all the entries and file out the stats
            int len = m_entities.Count;

            for (int i = 0; i < len; i++)
            {
                tmpBlockCount = (BlockCount)m_entities[i];

                int len2 = tmpBlockCount.m_objCounts.Count;
                for (int j = 0; j < len2; j++)
                {
                    tmpObjCount = (ObjCount)tmpBlockCount.m_objCounts[j];

                    int index;
                    if (FindClassName(classNames, tmpObjCount.m_className, out index))
                    {
                        objCounts[index] = ((long)objCounts[index]) + tmpObjCount.m_count;
                    }
                    else
                    {
                        classNames.Add(tmpObjCount.m_className);
                        displayNames.Add(tmpObjCount.m_displayName);
                        objCounts.Add(tmpObjCount.m_count);
                    }
                }
            }

            // now push out to XML
            len = classNames.Count;
            for (int i = 0; i < len; i++)
            {
                stream.WriteStartElement("ObjectType");
                stream.WriteAttributeString("class", (string)classNames[i]);
                stream.WriteAttributeString("displayName", (string)displayNames[i]);
                stream.WriteAttributeString("count", objCounts[i].ToString());
                stream.WriteEndElement();
            }

            stream.WriteEndElement();
        }
Exemplo n.º 2
0
        GetCount(string className, string displayName, bool addIfNotThere)
        {
            foreach (ObjCount tmpNode in m_objCounts)
            {
                if (tmpNode.m_className == className)
                {
                    return(tmpNode);
                }
            }

            if (addIfNotThere)
            {
                ObjCount tmpNode = new ObjCount();
                tmpNode.m_className   = className;
                tmpNode.m_displayName = displayName;

                m_objCounts.Add(tmpNode);

                return(tmpNode);
            }

            return(null);    // didn't find it
        }