public MetaDataTypeDefinition ResolveName(String refName)
        {
            if (fDebug)
            {
                Console.Out.WriteLine("Attempting to resolve in " + this.GetHashCode() + ": " + refName);
            }
            EntryPair pair = (EntryPair)mapTable[refName];

            if (pair == null)
            {
                if (fDebug)
                {
                    Console.Out.WriteLine("...failed");
                }
                return(null);
            }
            else
            {
                MetaDataTypeDefinition result = pair.Definition;
                if (fDebug)
                {
                    ResolverEntry entry = pair.Entry;
                    Console.Out.WriteLine("...found " + result + " in " + entry);
                }
                return(result);
            }
        }
 private void BuildMap()
 {
     // walk entryList in reverse, adding exports to mapTable
     mapTable = new Hashtable();
     for (int i = entryList.Count - 1; i >= 0; i--)
     {
         ResolverEntry entry    = (ResolverEntry)entryList[i];
         MetaData      metaData = entry.MetaData;
         // export public typedefs
         if (fDebug)
         {
             Console.Out.WriteLine("Registering " + metaData.TypeDefs.Length + " public TypeDefs from '" + entry.Filename + "' in " + this.GetHashCode());
         }
         foreach (MetaDataTypeDefinition def in metaData.TypeDefs)
         {
             TypeAttributes visibility =
                 def.Flags & TypeAttributes.VisibilityMask;
             String fullName = def.FullName;
             if ((visibility == TypeAttributes.Public) ||
                 (visibility == TypeAttributes.NestedPublic) ||
                 ((visibility == TypeAttributes.NotPublic) &&
                  (fullName.StartsWith("System.Runtime.Compiler") ||
                   fullName.StartsWith("Microsoft.Win32.Win32Native"))))
             {
                 if (fDebug)
                 {
                     Console.Out.WriteLine("Registering " + fullName);
                 }
                 mapTable[fullName] = new EntryPair(def, entry);
             }
         }
         // export ExportedTypes
         if (fDebug)
         {
             Console.Out.WriteLine("Registering " + metaData.ExportedTypes.Length + " public ExportTypes from '" + entry.Filename + "'");
         }
         foreach (MetaDataExportedType exportType in metaData.ExportedTypes)
         {
             String fullName = (exportType.Namespace.Length > 0)
               ? exportType.Namespace + "." + exportType.Name
               : exportType.Name;
             if (mapTable[fullName] == null)
             {
                 Console.Out.WriteLine("MetaDataResolver doesn't know how to handle " + fullName + "--" + exportType.ToStringLong());
                 throw new Exception();
             }
             Console.Out.WriteLine("WARNING: assuming that ExportedType " + exportType.ToStringLong() + " matches " + mapTable[fullName]);
         }
     }
 }