private int GetItemCount(List <HeapshotWindow.HeapshotUIObject> objects) { int num = 0; using (List <HeapshotWindow.HeapshotUIObject> .Enumerator enumerator = objects.GetEnumerator()) { while (enumerator.MoveNext()) { HeapshotWindow.HeapshotUIObject current = enumerator.Current; ++num; if (current.IsExpanded) { num += this.GetItemCount(current.Children); } } } return(num); }
private void RefreshHeapshotUIObjects() { this.hsRoots.Clear(); this.hsAllObjects.Clear(); foreach (HeapshotReader.ReferenceInfo current in this.heapshotReader.Roots) { string name = current.fieldInfo.name; this.hsRoots.Add(new HeapshotWindow.HeapshotUIObject(name, current.referencedObject, false)); } SortedDictionary <string, List <HeapshotReader.ObjectInfo> > sortedDictionary = new SortedDictionary <string, List <HeapshotReader.ObjectInfo> >(); foreach (HeapshotReader.ObjectInfo current2 in this.heapshotReader.Objects) { if (current2.type == HeapshotReader.ObjectType.Managed) { string name2 = current2.typeInfo.name; if (!sortedDictionary.ContainsKey(name2)) { sortedDictionary.Add(name2, new List <HeapshotReader.ObjectInfo>()); } sortedDictionary[name2].Add(current2); } } foreach (KeyValuePair <string, List <HeapshotReader.ObjectInfo> > current3 in sortedDictionary) { HeapshotReader.ObjectInfo objectInfo = new HeapshotReader.ObjectInfo(); HeapshotReader.FieldInfo field = new HeapshotReader.FieldInfo("(Unknown)"); foreach (HeapshotReader.ObjectInfo current4 in current3.Value) { objectInfo.references.Add(new HeapshotReader.ReferenceInfo(current4, field)); } HeapshotWindow.HeapshotUIObject heapshotUIObject = new HeapshotWindow.HeapshotUIObject(current3.Key + " x " + current3.Value.Count, objectInfo, false); heapshotUIObject.IsDummyObject = true; this.hsAllObjects.Add(heapshotUIObject); } }
private void OnSelectObject(HeapshotWindow.HeapshotUIObject o) { this.hsBackTraceObjects.Clear(); this.hsBackTraceObjects.Add(new HeapshotWindow.HeapshotUIObject(o.Name, o.ObjectInfo, true)); }
private void RefreshHeapshotUIObjects() { this.hsRoots.Clear(); this.hsAllObjects.Clear(); foreach (HeapshotReader.ReferenceInfo current in this.heapshotReader.Roots) { string name = current.fieldInfo.name; this.hsRoots.Add(new HeapshotWindow.HeapshotUIObject(name, current.referencedObject, false)); } SortedDictionary<string, List<HeapshotReader.ObjectInfo>> sortedDictionary = new SortedDictionary<string, List<HeapshotReader.ObjectInfo>>(); foreach (HeapshotReader.ObjectInfo current2 in this.heapshotReader.Objects) { if (current2.type == HeapshotReader.ObjectType.Managed) { string name2 = current2.typeInfo.name; if (!sortedDictionary.ContainsKey(name2)) { sortedDictionary.Add(name2, new List<HeapshotReader.ObjectInfo>()); } sortedDictionary[name2].Add(current2); } } foreach (KeyValuePair<string, List<HeapshotReader.ObjectInfo>> current3 in sortedDictionary) { HeapshotReader.ObjectInfo objectInfo = new HeapshotReader.ObjectInfo(); HeapshotReader.FieldInfo field = new HeapshotReader.FieldInfo("(Unknown)"); foreach (HeapshotReader.ObjectInfo current4 in current3.Value) { objectInfo.references.Add(new HeapshotReader.ReferenceInfo(current4, field)); } HeapshotWindow.HeapshotUIObject heapshotUIObject = new HeapshotWindow.HeapshotUIObject(current3.Key + " x " + current3.Value.Count, objectInfo, false); heapshotUIObject.IsDummyObject = true; this.hsAllObjects.Add(heapshotUIObject); } }
private void DoHeapshotObjects(List <HeapshotWindow.HeapshotUIObject> objects, SplitterState splitter, int indent, HeapshotWindow.OnSelect onSelect) { if (objects == null) { return; } Event current1 = Event.current; using (List <HeapshotWindow.HeapshotUIObject> .Enumerator enumerator = objects.GetEnumerator()) { while (enumerator.MoveNext()) { HeapshotWindow.HeapshotUIObject current2 = enumerator.Current; Rect position = new Rect(14f * (float)indent, this.guiRect.y, 14f, this.guiRect.height); Rect[] rectArray = new Rect[this.titleNames.Length]; float x = 14f * (float)(indent + 1); for (int index = 0; index < rectArray.Length; ++index) { float width = index != 0 ? (float)splitter.realSizes[index] : (float)splitter.realSizes[index] - x; rectArray[index] = new Rect(x, this.guiRect.y, width, this.guiRect.height); x += width; } if (current1.type == EventType.Repaint) { ((this.itemIndex & 1) != 0 ? HeapshotWindow.Styles.entryOdd : HeapshotWindow.Styles.entryEven).Draw(new Rect(0.0f, 16f * (float)this.itemIndex, this.position.width, 16f), GUIContent.none, false, false, this.itemIndex == this.selectedItem, false); } if (current2.HasChildren) { GUI.changed = false; bool flag = GUI.Toggle(position, current2.IsExpanded, GUIContent.none, HeapshotWindow.Styles.foldout); if (GUI.changed) { if (flag) { current2.Expand(); } else { current2.Collapse(); } } } GUI.changed = false; bool flag1 = GUI.Toggle(rectArray[0], this.itemIndex == this.selectedItem, current2.Name, HeapshotWindow.Styles.numberLabel); if (!current2.IsDummyObject) { GUI.Toggle(rectArray[1], this.itemIndex == this.selectedItem, current2.TypeName, HeapshotWindow.Styles.numberLabel); GUI.Toggle(rectArray[2], this.itemIndex == this.selectedItem, "0x" + current2.Code.ToString("X"), HeapshotWindow.Styles.numberLabel); GUI.Toggle(rectArray[3], this.itemIndex == this.selectedItem, current2.Size.ToString(), HeapshotWindow.Styles.numberLabel); GUI.Toggle(rectArray[4], this.itemIndex == this.selectedItem, string.Format("{0} / {1}", (object)current2.ReferenceCount, (object)current2.InverseReferenceCount), HeapshotWindow.Styles.numberLabel); if (GUI.changed && flag1 && onSelect != null) { this.selectedItem = this.itemIndex; onSelect(current2); } } ++this.itemIndex; this.guiRect.y += 16f; this.DoHeapshotObjects(current2.Children, splitter, indent + 1, onSelect); } } }