Esempio n. 1
0
        public override void VisitModuleReferenceCollection(ModuleReferenceCollection modules)
        {
            if (!m_tHeap.HasTable(ModuleRefTable.RId))
            {
                return;
            }

            ModuleRefTable mrTable = m_tableReader.GetModuleRefTable();

            for (int i = 0; i < mrTable.Rows.Count; i++)
            {
                ModuleRefRow    mrRow = mrTable [i];
                ModuleReference mod   = new ModuleReference(ReadString(mrRow.Name));
                mod.MetadataToken = MetadataToken.FromMetadataRow(TokenType.ModuleRef, i);
                modules.Add(mod);
            }
        }
Esempio n. 2
0
        public TypeDefinition Resolve(TypeReference type)
        {
            type = type.GetOriginalType();

            if (type is TypeDefinition)
            {
                return((TypeDefinition)type);
            }

            AssemblyNameReference reference = type.Scope as AssemblyNameReference;

            if (reference != null)
            {
                AssemblyDefinition assembly = AssemblyResolver.Resolve(reference);
                if (assembly == null)
                {
                    return(null);
                }

                return(assembly.MainModule.Types [type.FullName]);
            }

            ModuleDefinition module = type.Scope as ModuleDefinition;

            if (module != null)
            {
                return(module.Types [type.FullName]);
            }

            ModuleReference mod_reference = type.Scope as ModuleReference;

            if (mod_reference != null)
            {
                foreach (ModuleDefinition netmodule in type.Module.Assembly.Modules)
                {
                    if (netmodule.Name == mod_reference.Name)
                    {
                        return(netmodule.Types [type.FullName]);
                    }
                }
            }

            throw new NotImplementedException();
        }
 public virtual void VisitModuleReference(ModuleReference module)
 {
 }
 public void Remove(ModuleReference value)
 {
     List.Remove(value);
 }
 public void Insert(int index, ModuleReference value)
 {
     List.Insert(index, value);
 }
 public int IndexOf(ModuleReference value)
 {
     return(List.IndexOf(value));
 }
 public bool Contains(ModuleReference value)
 {
     return(List.Contains(value));
 }
 public void Add(ModuleReference value)
 {
     List.Add(value);
 }