Ejemplo n.º 1
0
 public TableInitInfo(Table table, byte column1, BlobDataKind kind1, sbyte column2, BlobDataKind kind2)
 {
     Table   = table;
     Column1 = column1;
     Kind1   = kind1;
     Column2 = column2;
     Kind2   = kind2;
 }
Ejemplo n.º 2
0
 public TableInitInfo(Table table, byte column1, BlobDataKind kind1)
 {
     Table   = table;
     Column1 = column1;
     Kind1   = kind1;
     Column2 = -1;
     Kind2   = BlobDataKind.None;
 }
Ejemplo n.º 3
0
 public BlobDataInfoPosition(HexPosition position, BlobDataKind kind)
 {
     Position = position;
     Tokens   = new List <uint>();
     Kind     = kind;
 }
Ejemplo n.º 4
0
 public BlobDataInfo(HexSpan span, uint[] tokens, BlobDataKind kind)
 {
     Span   = span;
     Tokens = new ReadOnlyCollection <uint>(tokens);
     Kind   = kind;
 }
Ejemplo n.º 5
0
        void Add(Dictionary <uint, BlobDataInfoPosition> dict, MDTable mdTable, int column1, BlobDataKind kind1, int column2, BlobDataKind kind2)
        {
            var heapStart = Span.Span.Start;
            var heapEnd   = Span.Span.End;
            var buffer    = Span.Buffer;
            var recPos    = mdTable.Span.Start;
            var rows      = mdTable.Rows;
            var colInfo1  = mdTable.Columns[column1];
            var colInfo2  = mdTable.Columns[column2];

            Debug.Assert(colInfo1.ColumnSize == ColumnSize.Blob);
            Debug.Assert(colInfo2.ColumnSize == ColumnSize.Blob);
            uint recSize   = mdTable.RowSize;
            bool bigBlob   = colInfo1.Size == 4;
            uint tokenBase = new MDToken(mdTable.Table, 0).Raw;

            for (uint rid = 1; rid <= rows; rid++, recPos += recSize)
            {
                uint offs1 = bigBlob ? buffer.ReadUInt32(recPos + colInfo1.Offset) : buffer.ReadUInt16(recPos + colInfo1.Offset);
                uint offs2 = bigBlob ? buffer.ReadUInt32(recPos + colInfo2.Offset) : buffer.ReadUInt16(recPos + colInfo2.Offset);

                {
                    List <uint>?tokens;
                    if (offs1 == 0)
                    {
                        tokens = null;
                    }
                    else if (dict.TryGetValue(offs1, out var info))
                    {
                        tokens = info.Tokens;
                    }
                    else
                    {
                        var pos = heapStart + offs1;
                        if (pos < heapEnd)
                        {
                            dict[offs1] = info = new BlobDataInfoPosition(pos, kind1);
                            tokens      = info.Tokens;
                        }
                        else
                        {
                            tokens = null;
                        }
                    }
                    tokens?.Add(tokenBase + rid);
                }

                {
                    List <uint>?tokens;
                    if (offs2 == 0)
                    {
                        tokens = null;
                    }
                    else if (dict.TryGetValue(offs2, out var info))
                    {
                        tokens = info.Tokens;
                    }
                    else
                    {
                        var pos = heapStart + offs2;
                        if (pos < heapEnd)
                        {
                            dict[offs2] = info = new BlobDataInfoPosition(pos, kind2);
                            tokens      = info.Tokens;
                        }
                        else
                        {
                            tokens = null;
                        }
                    }
                    tokens?.Add(tokenBase + rid);
                }
            }
        }