Esempio n. 1
0
        public static ICirClass toCir(this Type type)
        {
            var cirData          = new CirData();
            var assemblyLocation = type.assemblyLocation();
            var assembly         = CecilUtils.getAssembly(assemblyLocation);
            var cirFactory       = new CirFactory();

            cirFactory.loadAndMapSymbols(assembly, assemblyLocation, false, "");
            var typeDefinition = CecilUtils.getType(assembly, type.Name);
            var cirType        = cirFactory.processTypeDefinition(cirData, typeDefinition);

            cirData.remapXRefs();
            return(cirType);
        }
Esempio n. 2
0
        public void Test_MultipleProcessingOfSameTypesAndAssembly()
        {
            ICirData           cirData      = new CirData();
            AssemblyDefinition testAssembly = getTestAssembly();

            // add assembly Object
            cirFactory.processAssemblyDefinition(cirData, testAssembly, null);
            ICirClass cirClass = cirData.getClass("testType");

            // test it
            Test_processTypeDefinition(cirData, cirClass);

            // add each type individually
            foreach (TypeDefinition typeDefinition in CecilUtils.getTypes(testAssembly))
            {
                cirFactory.processTypeDefinition(cirData, typeDefinition);
            }

            // test it again
            ICirClass cirClass2 = cirData.getClass("testType");

            Test_processTypeDefinition(cirData, cirClass);
            Test_processTypeDefinition(cirData, cirClass2);
        }