Exemplo n.º 1
0
        DotNetHeap[] CreateCompressedHeaps()
        {
            var         list        = new List <DotNetHeap>();
            StringsHeap stringsHeap = null;
            USHeap      usHeap      = null;
            BlobHeap    blobHeap    = null;
            GUIDHeap    guidHeap    = null;
            TablesHeap  tablesHeap  = null;
            PdbHeap     pdbHeap     = null;

            for (int i = storageStreamHeaders.Length - 1; i >= 0; i--)
            {
                var ssh  = storageStreamHeaders[i];
                var span = new HexBufferSpan(file.Buffer, ssh.DataSpan);

                switch (ssh.Name)
                {
                case "#Strings":
                    if (stringsHeap == null)
                    {
                        stringsHeap = new StringsHeapImpl(span);
                        list.Add(stringsHeap);
                        continue;
                    }
                    break;

                case "#US":
                    if (usHeap == null)
                    {
                        usHeap = new USHeapImpl(span);
                        list.Add(usHeap);
                        continue;
                    }
                    break;

                case "#Blob":
                    if (blobHeap == null)
                    {
                        blobHeap = new BlobHeapImpl(span);
                        list.Add(blobHeap);
                        continue;
                    }
                    break;

                case "#GUID":
                    if (guidHeap == null)
                    {
                        guidHeap = new GUIDHeapImpl(span);
                        list.Add(guidHeap);
                        continue;
                    }
                    break;

                case "#~":
                    if (tablesHeap == null && span.Length >= TablesHeapImpl.MinimumSize)
                    {
                        tablesHeap = new TablesHeapImpl(span, TablesHeapType.Compressed);
                        list.Add(tablesHeap);
                        continue;
                    }
                    break;

                case "#!":
                    list.Add(new HotHeapImpl(span));
                    continue;

                case "#Pdb":
                    if (pdbHeap == null && span.Length >= PdbHeapImpl.MinimumSize)
                    {
                        pdbHeap = new PdbHeapImpl(span);
                        list.Add(pdbHeap);
                        continue;
                    }
                    break;
                }
                list.Add(new UnknownHeapImpl(span));
            }

            list.Reverse();
            return(list.ToArray());
        }
Exemplo n.º 2
0
        DotNetHeap[] CreateENCHeaps()
        {
            var         list        = new List <DotNetHeap>();
            StringsHeap stringsHeap = null;
            USHeap      usHeap      = null;
            BlobHeap    blobHeap    = null;
            GUIDHeap    guidHeap    = null;
            TablesHeap  tablesHeap  = null;

            foreach (var ssh in storageStreamHeaders)
            {
                var span = new HexBufferSpan(file.Buffer, ssh.DataSpan);

                switch (ssh.Name.ToUpperInvariant())
                {
                case "#STRINGS":
                    if (stringsHeap == null)
                    {
                        stringsHeap = new StringsHeapImpl(span);
                        list.Add(stringsHeap);
                        continue;
                    }
                    break;

                case "#US":
                    if (usHeap == null)
                    {
                        usHeap = new USHeapImpl(span);
                        list.Add(usHeap);
                        continue;
                    }
                    break;

                case "#BLOB":
                    if (blobHeap == null)
                    {
                        blobHeap = new BlobHeapImpl(span);
                        list.Add(blobHeap);
                        continue;
                    }
                    break;

                case "#GUID":
                    if (guidHeap == null)
                    {
                        guidHeap = new GUIDHeapImpl(span);
                        list.Add(guidHeap);
                        continue;
                    }
                    break;

                case "#~":                      // Only if #Schema is used
                case "#-":
                    if (tablesHeap == null && span.Length >= TablesHeapImpl.MinimumSize)
                    {
                        tablesHeap = new TablesHeapImpl(span, TablesHeapType.ENC);
                        list.Add(tablesHeap);
                        continue;
                    }
                    break;
                }
                list.Add(new UnknownHeapImpl(span));
            }
            return(list.ToArray());
        }