public ITypeDefinition ResolveTypeDefToken(Mono.Cecil.MetadataToken token)
            {
                var td = unresolvedAssembly.GetTypeDefByToken(token);

                if (td != null)
                {
                    return(GetPotentiallyNestedTypeDefinition(td));
                }
                return(null);
            }
Ejemplo n.º 2
0
 public AssemblyNameReference(string name, System.Version version)
 {
     if (name == null)
     {
         throw new ArgumentNullException("name");
     }
     this.name           = name;
     this.version        = version;
     this.hash_algorithm = AssemblyHashAlgorithm.None;
     this.token          = new Mono.Cecil.MetadataToken(TokenType.AssemblyRef);
 }
        internal IUnresolvedTypeDefinition GetTypeDefByToken(Mono.Cecil.MetadataToken token)
        {
            if (token.TokenType != Mono.Cecil.TokenType.TypeDef)
            {
                throw new ArgumentException("Token must be typedef-token.");
            }
            var lookup = LazyInit.VolatileRead(ref allTypesByMetadata);

            if (lookup == null)
            {
                lookup = LazyInit.GetOrSet(ref allTypesByMetadata, BuildMetadataLookup());
            }
            if (token.RID < lookup.Length)
            {
                return(lookup[token.RID]);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 4
0
 public IMetadataTokenProvider LookupToken(Mono.Cecil.MetadataToken token)
 {
     return(this.Read <Mono.Cecil.MetadataToken, IMetadataTokenProvider>(token, (Mono.Cecil.MetadataToken t, MetadataReader reader) => reader.LookupToken(t)));
 }
Ejemplo n.º 5
0
 internal ModuleReference()
 {
     this.token = new Mono.Cecil.MetadataToken(Mono.Cecil.TokenType.ModuleRef);
 }