Ejemplo n.º 1
0
        public LiftedList <T> LoadDirectChildren <T>(
            MetadataTable childTable,
            GetTokenDelegate tokenSelector,
            CreateObjectDelegateEX <T> factory,
            MetadataTable parentTable,
            void *parentRow
            ) where T : class
        {
            var            firstMemberIndex = (ZeroBasedIndex)tokenSelector(parentRow);
            ZeroBasedIndex lastMemberIndex;
            var            tableIndex = GetRowIndex(parentTable, parentRow);

            if (tableIndex == GetRowCount(parentTable) - 1)
            {
                lastMemberIndex = new ZeroBasedIndex(GetRowCount(childTable));
            }
            else
            {
                lastMemberIndex = (ZeroBasedIndex)tokenSelector(GetRow(tableIndex + 1, parentTable));
            }
            var ret = new LiftedList <T>(
                (lastMemberIndex - firstMemberIndex).Value,
                index => GetRow(firstMemberIndex + index, childTable),
                factory,
                () => IsDisposed
                );

            return(ret);
        }
Ejemplo n.º 2
0
 public HasFieldMarshal(MetadataTable table, ZeroBasedIndex index)
 {
     if (table != MetadataTable.Field && table != MetadataTable.Param)
     {
         throw new ArgumentOutOfRangeException("table");
     }
     m_index = ((OneBasedIndex)index) | ((table == MetadataTable.Param ? 1u : 0u) << 1);
 }
Ejemplo n.º 3
0
        public HasCustomAttribute(MetadataTable table, ZeroBasedIndex index)
        {
            uint value;

            if (!s_inverseTables.TryGetValue(table, out value))
            {
                throw new ArgumentException("HasCustomAttributes does not support the provided meta-data table", "table");
            }
            m_index = (OneBasedIndex)index | (value << 5);
        }
Ejemplo n.º 4
0
        public TypeOrMethodDef(MetadataTable table, ZeroBasedIndex index)
        {
            if (table != MetadataTable.TypeDef && table != MetadataTable.MethodDef)
            {
                throw new ArgumentException("Expected TypeDef or MethodDef", "table");
            }
            var tableId = (table == MetadataTable.TypeDef) ? 0u : 1u;

            m_index = ((OneBasedIndex)index << 1) | tableId;
        }
Ejemplo n.º 5
0
        public void *GetRow(ZeroBasedIndex index, MetadataTable table)
        {
            CheckDisposed();
            table.CheckDefined("table");
            index.CheckGTE(0, "index");
            index.CheckLT(GetRowCount(table), "index");

            if (m_tables == null || m_tables[(int)table] == null)
            {
                throw new InvalidOperationException("Missing meta-data table.");
            }
            return(checked (m_tables[(int)table] + index.Value * GetRowSize(table)));
        }
Ejemplo n.º 6
0
        public ISubList <T> LoadDirectChildren <T>(
            MetadataTable childTable,
            GetTokenDelegate tokenSelector,
            MetadataTable parentTable,
            void *parentRow,
            IReadOnlyList <T> sourceList
            ) where T : class
        {
            var            firstMemberIndex = (ZeroBasedIndex)tokenSelector(parentRow);
            ZeroBasedIndex lastMemberIndex;
            var            tableIndex = GetRowIndex(parentTable, parentRow);

            if (tableIndex == GetRowCount(parentTable) - 1)
            {
                lastMemberIndex = new ZeroBasedIndex(GetRowCount(childTable));
            }
            else
            {
                lastMemberIndex = (ZeroBasedIndex)tokenSelector(GetRow(tableIndex + 1, parentTable));
            }
            return(sourceList.SubList(firstMemberIndex.Value, (lastMemberIndex - firstMemberIndex).Value));
        }
Ejemplo n.º 7
0
 public Type ResolveTypeRef(ZeroBasedIndex index, Module module)
 {
     //TODO: Implement this
     throw new NotImplementedException();
 }
Ejemplo n.º 8
0
 public Type ParseTypeSpec(ZeroBasedIndex index, Module module)
 {
     //TODO: Implement this
     throw new NotImplementedException();
 }
Ejemplo n.º 9
0
 private IntPtr GetRowSafe(ZeroBasedIndex index, MetadataTable table)
 {
     return((IntPtr)GetRow(index, table));
 }