コード例 #1
0
        public override AssemblyName[] GetReferencedAssemblies()
        {
            Token token;
            int   num;
            IMetadataAssemblyImport rawImport     = (IMetadataAssemblyImport)this.m_manifestModule.RawImport;
            List <AssemblyName>     assemblyNames = new List <AssemblyName>();
            HCORENUM hCORENUM = new HCORENUM();

            try
            {
                while (true)
                {
                    int num1 = rawImport.EnumAssemblyRefs(ref hCORENUM, out token, 1, out num);
                    Marshal.ThrowExceptionForHR(num1);
                    if (num == 0)
                    {
                        break;
                    }
                    assemblyNames.Add(AssemblyNameHelper.GetAssemblyNameFromRef(token, this.m_manifestModule, rawImport));
                }
            }
            finally
            {
                hCORENUM.Close(rawImport);
            }
            return(assemblyNames.ToArray());
        }
コード例 #2
0
        internal static IEnumerable <UnresolvedTypeName> GetRawTypeForwardedToAttributes(MetadataOnlyModule manifestModule)
        {
            int                     num;
            uint                    num1;
            int                     num2;
            int                     num3;
            int                     num4;
            CorTypeAttr             corTypeAttr;
            HCORENUM                hCORENUM  = new HCORENUM();
            IMetadataAssemblyImport rawImport = (IMetadataAssemblyImport)manifestModule.RawImport;

            try
            {
                while (true)
                {
                    rawImport.EnumExportedTypes(ref hCORENUM, out num, 1, out num1);
                    if (num1 == 0)
                    {
                        break;
                    }
                    rawImport.GetExportedTypeProps(num, null, 0, out num2, out num3, out num4, out corTypeAttr);
                    Token token = new Token(num3);
                    if (token.TokenType == System.Reflection.Adds.TokenType.AssemblyRef)
                    {
                        StringBuilder stringBuilder = new StringBuilder(num2);
                        rawImport.GetExportedTypeProps(num, stringBuilder, stringBuilder.Capacity, out num2, out num3, out num4, out corTypeAttr);
                        AssemblyName assemblyNameFromRef = AssemblyNameHelper.GetAssemblyNameFromRef(token, manifestModule, rawImport);
                        yield return(new UnresolvedTypeName(stringBuilder.ToString(), assemblyNameFromRef));
                    }
                }
            }
            finally
            {
                hCORENUM.Close(rawImport);
            }
        }