HeapShot.Reader.ObjectMapReader.ReadLogFileChunk_Object C# (CSharp) Method

ReadLogFileChunk_Object() private method

private ReadLogFileChunk_Object ( HeapEvent he ) : void
he MonoDevelop.Profiler.HeapEvent
return void
        private void ReadLogFileChunk_Object(HeapEvent he)
        {
            if (he.Type == HeapEvent.EventType.Start) {
                //Console.WriteLine ("ppe: START");
                return;
            }
            else if (he.Type == HeapEvent.EventType.End) {
                //Console.WriteLine ("ppe: END");
                HeapSnapshot shot = new HeapSnapshot ();
                shotCount++;
                shot.Build (shotCount.ToString (), currentData);
                AddShot (shot);
            }
            if (he.Type == HeapEvent.EventType.Object) {
                ObjectInfo ob = new ObjectInfo ();
                ob.Code = currentObjBase + he.Object;
                ob.Size = he.Size;
                ob.RefsIndex = currentData.ReferenceCodes.Count;
                ob.RefsCount = he.ObjectRefs != null ? he.ObjectRefs.Length : 0;
                currentData.ObjectTypeCodes.Add (currentPtrBase + he.Class);
                totalMemory += ob.Size;
                if (ob.Size != 0)
                    currentData.RealObjectCount++;

                // Read referenceCodes

                ulong lastOff = 0;
                for (int n=0; n < ob.RefsCount; n++) {
                    currentData.ReferenceCodes.Add (he.ObjectRefs [n] + currentObjBase);
                    lastOff += he.RelOffset [n];
                    currentData.FieldReferenceCodes.Add (lastOff);
                }
                currentData.ObjectsList.Add (ob);
            }
            else if (he.Type == HeapEvent.EventType.Root) {
                for (int n=0; n<he.RootRefs.Length; n++) {
                    ObjectInfo ob = new ObjectInfo ();
                    ob.Size = 0;
                    ob.RefsIndex = currentData.ReferenceCodes.Count;
                    ob.RefsCount = 1;
                    long type = UnknownTypeId;
                    switch (he.RootRefTypes [n] & HeapEvent.RootType.TypeMask) {
                    case HeapEvent.RootType.Stack: type = StackObjectId; ob.Code = StackObjectId; break;
                    case HeapEvent.RootType.Finalizer: type = FinalizerObjectId; ob.Code = --rootId; break;
                    case HeapEvent.RootType.Handle: type = HandleObjectId; ob.Code = --rootId; break;
                    case HeapEvent.RootType.Other: type = OtherRootObjectId; ob.Code = --rootId; break;
                    case HeapEvent.RootType.Misc: type = MiscRootObjectId; ob.Code = --rootId; break;
                    default:
                        Console.WriteLine ("pp1:"); break;
                    }
                    currentData.ObjectTypeCodes.Add (type);
                    currentData.ReferenceCodes.Add (he.RootRefs [n] + currentObjBase);
                    currentData.FieldReferenceCodes.Add (0);
                    currentData.ObjectsList.Add (ob);
                    currentData.RealObjectCount++;
                }
            }
        }