Example #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();
        }
Example #2
0
        GetEntityNode(ObjectId blkRecId, bool addIfNotThere)
        {
            foreach (BlockCount tmpNode in m_entities)
            {
                if (tmpNode.m_blockDefId == blkRecId)
                {
                    return(tmpNode);
                }
            }

            if (addIfNotThere)
            {
                BlockCount tmpNode = new BlockCount();
                tmpNode.m_blockDefId = blkRecId;
                tmpNode.m_blockName  = m_trHlp.SymbolIdToName(blkRecId);
                m_entities.Add(tmpNode);

                return(tmpNode);
            }

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