private void ReadObject(BinaryReader reader) { uint key1 = reader.ReadUInt32(); uint key2 = reader.ReadUInt32(); HeapshotReader.ObjectInfo objectInfo = new HeapshotReader.ObjectInfo(); objectInfo.code = key1; objectInfo.size = reader.ReadUInt32(); if (!this.types.ContainsKey(key2)) { throw new Exception(string.Format("Failed to find type info {0} for object {1}!!!", (object)key2, (object)key1)); } objectInfo.typeInfo = this.types[key2]; uint num; while ((int)(num = reader.ReadUInt32()) != 0) { HeapshotReader.ReferenceInfo referenceInfo = new HeapshotReader.ReferenceInfo(); referenceInfo.code = num; uint key3 = reader.ReadUInt32(); referenceInfo.fieldInfo = (int)key3 != 0 ? (!objectInfo.typeInfo.fields.ContainsKey(key3) ? (HeapshotReader.FieldInfo)null : objectInfo.typeInfo.fields[key3]) : (HeapshotReader.FieldInfo)null; objectInfo.references.Add(referenceInfo); } if (this.objects.ContainsKey(key1)) { throw new Exception(string.Format("Object {0} was already loaded?!", (object)key1)); } objectInfo.type = (int)key1 != (int)key2 ? HeapshotReader.ObjectType.Managed : HeapshotReader.ObjectType.Root; this.objects[key1] = objectInfo; this.allObjects.Add(objectInfo); }
private void ResolveReferences() { using (Dictionary <uint, HeapshotReader.ObjectInfo> .Enumerator enumerator1 = this.objects.GetEnumerator()) { while (enumerator1.MoveNext()) { using (List <HeapshotReader.ReferenceInfo> .Enumerator enumerator2 = enumerator1.Current.Value.references.GetEnumerator()) { while (enumerator2.MoveNext()) { HeapshotReader.ReferenceInfo current = enumerator2.Current; if (!this.objects.ContainsKey(current.code)) { current.referencedObject = this.kUnmanagedObject; } else { current.referencedObject = this.objects[current.code]; if (current.fieldInfo == null) { current.fieldInfo = new HeapshotReader.FieldInfo(); current.fieldInfo.name = current.referencedObject.typeInfo.name; } } } } } } }
public void Expand() { if (this.IsExpanded || !this.HasChildren) { return; } if (this.inverseReference) { using (List <HeapshotReader.BackReferenceInfo> .Enumerator enumerator = this.obj.inverseReferences.GetEnumerator()) { while (enumerator.MoveNext()) { HeapshotReader.BackReferenceInfo current = enumerator.Current; this.children.Add(new HeapshotWindow.HeapshotUIObject(current.fieldInfo.name, current.parentObject, true)); } } } else { using (List <HeapshotReader.ReferenceInfo> .Enumerator enumerator = this.obj.references.GetEnumerator()) { while (enumerator.MoveNext()) { HeapshotReader.ReferenceInfo current = enumerator.Current; this.children.Add(new HeapshotWindow.HeapshotUIObject(current.fieldInfo.name, current.referencedObject, false)); } } } }
private void RefreshHeapshotUIObjects() { this.hsRoots.Clear(); this.hsAllObjects.Clear(); using (List <HeapshotReader.ReferenceInfo> .Enumerator enumerator = this.heapshotReader.Roots.GetEnumerator()) { while (enumerator.MoveNext()) { HeapshotReader.ReferenceInfo current = enumerator.Current; this.hsRoots.Add(new HeapshotWindow.HeapshotUIObject(current.fieldInfo.name, current.referencedObject, false)); } } SortedDictionary <string, List <HeapshotReader.ObjectInfo> > sortedDictionary = new SortedDictionary <string, List <HeapshotReader.ObjectInfo> >(); using (List <HeapshotReader.ObjectInfo> .Enumerator enumerator = this.heapshotReader.Objects.GetEnumerator()) { while (enumerator.MoveNext()) { HeapshotReader.ObjectInfo current = enumerator.Current; if (current.type == HeapshotReader.ObjectType.Managed) { string name = current.typeInfo.name; if (!sortedDictionary.ContainsKey(name)) { sortedDictionary.Add(name, new List <HeapshotReader.ObjectInfo>()); } sortedDictionary[name].Add(current); } } } using (SortedDictionary <string, List <HeapshotReader.ObjectInfo> > .Enumerator enumerator1 = sortedDictionary.GetEnumerator()) { while (enumerator1.MoveNext()) { KeyValuePair <string, List <HeapshotReader.ObjectInfo> > current1 = enumerator1.Current; HeapshotReader.ObjectInfo refObject = new HeapshotReader.ObjectInfo(); HeapshotReader.FieldInfo field = new HeapshotReader.FieldInfo("(Unknown)"); using (List <HeapshotReader.ObjectInfo> .Enumerator enumerator2 = current1.Value.GetEnumerator()) { while (enumerator2.MoveNext()) { HeapshotReader.ObjectInfo current2 = enumerator2.Current; refObject.references.Add(new HeapshotReader.ReferenceInfo(current2, field)); } } this.hsAllObjects.Add(new HeapshotWindow.HeapshotUIObject(current1.Key + " x " + (object)current1.Value.Count, refObject, false) { IsDummyObject = true }); } } }
private void ReadObject(BinaryReader reader) { uint num = reader.ReadUInt32(); uint num2 = reader.ReadUInt32(); HeapshotReader.ObjectInfo objectInfo = new HeapshotReader.ObjectInfo(); objectInfo.code = num; objectInfo.size = reader.ReadUInt32(); if (!this.types.ContainsKey(num2)) { throw new Exception(string.Format("Failed to find type info {0} for object {1}!!!", num2, num)); } objectInfo.typeInfo = this.types[num2]; uint code; while ((code = reader.ReadUInt32()) != 0u) { HeapshotReader.ReferenceInfo referenceInfo = new HeapshotReader.ReferenceInfo(); referenceInfo.code = code; uint num3 = reader.ReadUInt32(); if (num3 == 0u) { referenceInfo.fieldInfo = null; } else { if (objectInfo.typeInfo.fields.ContainsKey(num3)) { referenceInfo.fieldInfo = objectInfo.typeInfo.fields[num3]; } else { referenceInfo.fieldInfo = null; } } objectInfo.references.Add(referenceInfo); } if (this.objects.ContainsKey(num)) { throw new Exception(string.Format("Object {0} was already loaded?!", num)); } objectInfo.type = ((num != num2) ? HeapshotReader.ObjectType.Managed : HeapshotReader.ObjectType.Root); this.objects[num] = objectInfo; this.allObjects.Add(objectInfo); }
private void ResolveInverseReferences() { using (Dictionary <uint, HeapshotReader.ObjectInfo> .Enumerator enumerator1 = this.objects.GetEnumerator()) { while (enumerator1.MoveNext()) { KeyValuePair <uint, HeapshotReader.ObjectInfo> current1 = enumerator1.Current; using (List <HeapshotReader.ReferenceInfo> .Enumerator enumerator2 = current1.Value.references.GetEnumerator()) { while (enumerator2.MoveNext()) { HeapshotReader.ReferenceInfo current2 = enumerator2.Current; current2.referencedObject.inverseReferences.Add(new HeapshotReader.BackReferenceInfo() { parentObject = current1.Value, fieldInfo = current2.fieldInfo }); } } } } }
private void ReadObject(BinaryReader reader) { uint key1 = reader.ReadUInt32(); uint key2 = reader.ReadUInt32(); HeapshotReader.ObjectInfo objectInfo = new HeapshotReader.ObjectInfo(); objectInfo.code = key1; objectInfo.size = reader.ReadUInt32(); if (!this.types.ContainsKey(key2)) throw new Exception(string.Format("Failed to find type info {0} for object {1}!!!", (object) key2, (object) key1)); objectInfo.typeInfo = this.types[key2]; uint num; while ((int) (num = reader.ReadUInt32()) != 0) { HeapshotReader.ReferenceInfo referenceInfo = new HeapshotReader.ReferenceInfo(); referenceInfo.code = num; uint key3 = reader.ReadUInt32(); referenceInfo.fieldInfo = (int) key3 != 0 ? (!objectInfo.typeInfo.fields.ContainsKey(key3) ? (HeapshotReader.FieldInfo) null : objectInfo.typeInfo.fields[key3]) : (HeapshotReader.FieldInfo) null; objectInfo.references.Add(referenceInfo); } if (this.objects.ContainsKey(key1)) throw new Exception(string.Format("Object {0} was already loaded?!", (object) key1)); objectInfo.type = (int) key1 != (int) key2 ? HeapshotReader.ObjectType.Managed : HeapshotReader.ObjectType.Root; this.objects[key1] = objectInfo; this.allObjects.Add(objectInfo); }