Example #1
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);
 }
Example #2
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);
 }
Example #3
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;
 }
Example #4
0
 internal static ZeroBasedIndex CheckLT(this ZeroBasedIndex lhs, int rhs, string parameterName)
 {
     if (lhs.CompareTo(rhs) >= 0)
     {
         throw new ArgumentOutOfRangeException(parameterName, String.Format("Expected a value < {0}", rhs));
     }
     return(lhs);
 }
Example #5
0
        //# Returns a list of MethodSemantic rows associated with the method located at the given index.S
        internal IReadOnlyList <IntPtr> GetAssociations(ZeroBasedIndex methodIndex)
        {
            CheckDisposed();
            if (m_semanticsMap == null)
            {
                lock (m_lockObject) {
                    if (m_semanticsMap == null)
                    {
                        LoadMethodSemantics();
                    }
                }
            }

            IReadOnlyList <IntPtr> ret;

            m_semanticsMap.AssumeNotNull().TryGetValue(methodIndex, out ret);
            return(ret ?? new List <IntPtr>(0).AsReadOnly());
        }
Example #6
0
 //# Returns the set of all types defined in the module, including nested types.
 internal TypeDefinition GetType(ZeroBasedIndex typeDefIndex)
 {
     EnsureTypesLoaded();
     return(m_allTypes[typeDefIndex.Value]);
 }
Example #7
0
 //# Returns the set of all types defined in the module, including nested types.
 internal TypeDefinition GetType(ZeroBasedIndex typeDefIndex)
 {
     EnsureTypesLoaded();
     return m_allTypes[typeDefIndex.Value];
 }
Example #8
0
        //# Returns a list of MethodSemantic rows associated with the method located at the given index.S
        internal IReadOnlyList<IntPtr> GetAssociations(ZeroBasedIndex methodIndex)
        {
            CheckDisposed();
            if (m_semanticsMap == null) {
                lock(m_lockObject) {
                    if (m_semanticsMap == null) {
                        LoadMethodSemantics();
                    }
                }
            }

            IReadOnlyList<IntPtr> ret;
            m_semanticsMap.AssumeNotNull().TryGetValue(methodIndex, out ret);
            return ret ?? new List<IntPtr>(0).AsReadOnly();
        }
Example #9
0
 public static unsafe void *GetRow(this MetadataTable table, ZeroBasedIndex index, PEFile peFile)
 {
     return(peFile.CheckNotNull("peFile").GetRow(index, table));
 }