예제 #1
0
        public DNContext(string asmToLoad)
        {
            var pa = AssemblyDef.Load(asmToLoad);

            reflectionOnlyAsm = Assembly.ReflectionOnlyLoadFrom(asmToLoad);

            var refs = reflectionOnlyAsm.GetReferencedAssemblies();

            References = refs.Select(r => new AssemblyNameInfo(r)).ToArray();

            //stdLibAsms = refs.Where(n =>
            //{
            //    try
            //    {
            //        return Assembly.ReflectionOnlyLoad(n.FullName).GlobalAssemblyCache;
            //    }
            //    catch
            //    {
            //        return false;
            //    }
            //}).Select(TranslateReference).Select(n => new AsmInfo(pa.MainModule.AssemblyResolver.Resolve(n))).ToList();

            primaryAssembly = new AsmInfo(pa); // load types after stdlib/gac references are loaded

            SigComparer = new SigComparer(SigComparerOptions.PrivateScopeIsComparable);
            RefComparer = new DNReflectionComparer(this);
            Resolver    = new MemberResolver(this);
        }
예제 #2
0
        public CecilContext(string asmToLoad)
        {
            var pa = AssemblyDefinition.ReadAssembly(asmToLoad);

            reflectionOnlyAsm = Assembly.ReflectionOnlyLoadFrom(asmToLoad);

            var refs = reflectionOnlyAsm.GetReferencedAssemblies();

            References = refs.Select(TranslateReference).ToArray();

            //stdLibAsms = refs.Where(n =>
            //{
            //    try
            //    {
            //        return Assembly.ReflectionOnlyLoad(n.FullName).GlobalAssemblyCache;
            //    }
            //    catch
            //    {
            //        return false;
            //    }
            //}).Select(TranslateReference).Select(n => new AsmInfo(pa.MainModule.AssemblyResolver.Resolve(n))).ToList();

            primaryAssembly = new AsmInfo(pa); // load types after stdlib/gac references are loaded

            Comparer = new CecilReflectionComparer(this);
            Resolver = new MemberResolver(this);
        }