ProcessObjects() { ObjectIdCollection objIds = new ObjectIdCollection(); ArrayList names = new ArrayList(); // get all the symbol table objects GetSymbolTableEntries(m_db.BlockTableId, ref objIds, ref names); GetSymbolTableEntries(m_db.DimStyleTableId, ref objIds, ref names); GetSymbolTableEntries(m_db.LayerTableId, ref objIds, ref names); GetSymbolTableEntries(m_db.LinetypeTableId, ref objIds, ref names); GetSymbolTableEntries(m_db.RegAppTableId, ref objIds, ref names); GetSymbolTableEntries(m_db.TextStyleTableId, ref objIds, ref names); GetSymbolTableEntries(m_db.ViewTableId, ref objIds, ref names); GetSymbolTableEntries(m_db.ViewportTableId, ref objIds, ref names); GetSymbolTableEntries(m_db.UcsTableId, ref objIds, ref names); // get all the NamedObjectDictionary objects GetRecursiveDictionaryEntries(m_db.NamedObjectsDictionaryId, ref objIds, ref names); // get all the Extension dictionary objects foreach (ObjectId extDictId in m_extDictIds) { GetRecursiveDictionaryEntries(extDictId, ref objIds, ref names); } int len = objIds.Count; // get reference count to these objects int[] countArray = new int[len]; for (int i = 0; i < len; i++) { countArray[i] = 0; // init count values; } m_db.CountHardReferences(objIds, countArray); SymbolCount tmpCount = null; for (int i = 0; i < len; i++) { DBObject tmpObj = m_trHlp.Transaction.GetObject(objIds[i], OpenMode.ForRead); tmpCount = GetObjectNode(GetObjClassName(tmpObj), tmpObj.GetType().Name, true); if (tmpCount != null) { tmpCount.m_count++; tmpCount.m_symbolNames.Add(names[i]); tmpCount.m_references.Add(countArray[i]); } } }
GetObjectNode(string className, string displayName, bool addIfNotThere) { foreach (SymbolCount tmpNode in m_objects) { if (tmpNode.m_className == className) { return(tmpNode); } } if (addIfNotThere) { SymbolCount tmpNode = new SymbolCount(); tmpNode.m_className = className; tmpNode.m_displayName = displayName; m_objects.Add(tmpNode); return(tmpNode); } return(null); // didn't find it }