public CirData getO2CirData()
        {
            String  sO2CirDataFile = tbO2CirDataOfProject.Text;
            CirData fadCirData     = CirLoad.loadSerializedO2CirDataObject(sO2CirDataFile);

            return(fadCirData);
        }
        public CirDataAnalysis createCirDataAnalysisObject(List <MethodInfo> methodInfos)
        {
            var      assemblyDefinitions = new Dictionary <Assembly, AssemblyDefinition>();
            ICirData cirData             = new CirData();

            //foreach(var assemblyToLoad in assembliesToLoad)
            foreach (MethodInfo methodInfo in methodInfos)
            {
                var assembly = methodInfo.DeclaringType.Assembly;
                if (false == assemblyDefinitions.ContainsKey(assembly))
                {
                    var assemblyDefinition = CecilUtils.getAssembly(assembly.Location);
                    if (assemblyDefinition != null)
                    {
                        assemblyDefinitions.Add(assembly, assemblyDefinition);
                    }
                }
                if (assemblyDefinitions.ContainsKey(assembly))
                {
                    var methodDefinition = CecilConvert.getMethodDefinitionFromMethodInfo(methodInfo, assemblyDefinitions[assembly]);
                    if (methodDefinition != null)
                    {
                        processMethodDefinition(cirData, methodDefinition, null);
                    }
                }
            }
            return(new CirDataAnalysis(cirData));
        }
        public void showSpringMvcClases(List <String> lsClasses, CirData fadCirData)
        {
            tvSpringMvcClasses.Nodes.Clear();
            foreach (String sClass in lsClasses)
            {
                ICirClass ccCirClass = fadCirData.dClasses_bySignature[sClass];
                var       tnClass    = new TreeNode(ccCirClass.Signature);
                foreach (CirFunction cfCirFunction in ccCirClass.dFunctions.Values)
                {
                    var fsSignature = new FilteredSignature(cfCirFunction.FunctionSignature);
                    var tnFunction  = new TreeNode(fsSignature.sFunctionNameAndParams);
                    foreach (String sFunctionCalled in ViewHelpers.getCirFunctionStringList(cfCirFunction.FunctionsCalledUniqueList))
                    {
                        var tnFunctionCalled = new TreeNode(sFunctionCalled);
                        //if (sFunctionCalled.IndexOf("setCommandName") > -1)
                        String sCommandNameValue = getValueFromControlFlowGraphCall(cfCirFunction.lcfgBasicBlocks,
                                                                                    sFunctionCalled);
                        if (sCommandNameValue != "")
                        {
                            tnFunctionCalled.Nodes.Add(sCommandNameValue);
                        }
                        tnFunction.Nodes.Add(tnFunctionCalled);
                    }

                    tnClass.Nodes.Add(tnFunction);
                }
                tvSpringMvcClasses.Nodes.Add(tnClass);
            }
        }
예제 #4
0
        public void Test_ProcessingAllNetFrameworkAssemblies_V2_0_50727_withVerify()
        {
            ICirData cirData = new CirData();
            var      pathToDotNetFrameworkAssemblies = @"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727";

            Test_ProcessingAllO2AssembliesFromDirectory(cirData, pathToDotNetFrameworkAssemblies, true, true /*verbose*/);
        }
        public void test_CreateCirDataFilesForDotNetFramework()
        {
            var    dotNetFrameworkDirectory    = @"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727";
            string directoryToSaveCidDataFiles = Path.Combine(DI.config.O2TempDir, "_CirDataFilesFor_DotNetFramework2_0_50727");

            Files.checkIfDirectoryExistsAndCreateIfNot(directoryToSaveCidDataFiles);
            List <string> targetAssemblies = Files.getFilesFromDir_returnFullPath(dotNetFrameworkDirectory, "*.dll");
            //targetAssemblies.AddRange(Files.getFilesFromDir_returnFullPath(DI.hardCodedO2DeploymentDir, "*.dll"));
            ICirData cirDataWithAllAssemblies = new CirData();

            foreach (var assemblyToProcess in targetAssemblies)
            {
                if (CecilUtils.isDotNetAssembly(assemblyToProcess))
                {
                    DI.log.info("Processing file: {0}", Path.GetFileName(assemblyToProcess));
                    ICirData cirData = new CirData();
                    cirFactory.processAssemblyDefinition(cirData, assemblyToProcess);
                    cirFactory.processAssemblyDefinition(cirDataWithAllAssemblies, assemblyToProcess);
                    var savedCirDataFile = Path.Combine(directoryToSaveCidDataFiles,
                                                        Path.GetFileName(assemblyToProcess) + ".CirData");
                    CirDataUtils.saveSerializedO2CirDataObjectToFile(cirData, savedCirDataFile);
                }
            }
            DI.log.info("Almost there, now saving cirDataWithAllAssemblies ");
            var fileWithCirDataWithAllAssemblies = Path.Combine(directoryToSaveCidDataFiles, "cirDataWithAllAssemblies.CirData");

            CirDataUtils.saveSerializedO2CirDataObjectToFile(cirDataWithAllAssemblies, fileWithCirDataWithAllAssemblies);
            DI.log.info("Done ..");
        }
예제 #6
0
        public void Test_processAssemblyDefinition()
        {
            ICirData           cirData      = new CirData();
            AssemblyDefinition testAssembly = getTestAssembly();

            cirFactory.processAssemblyDefinition(cirData, testAssembly, null);
            Assert.That(cirData.dClasses_bySignature.Count > 0, "cirData.dClasses_bySignature.Count == 0");

            // check that all functions from this assembly match
            checkThatAllFunctionsMatch(cirData, testAssembly);

            // check that the type is there
            TypeDefinition testTypeDefinition = CecilUtils.getType(testAssembly, "testType");

            Assert.That(
                cirData.dClasses_bySignature.ContainsKey(
                    CirFactoryUtils.getTypeUniqueSignatureFromTypeReference(testTypeDefinition)),
                "testTypeDefinition.FullName was not there");
            Assert.IsNotNull(cirData.getClass(testTypeDefinition.FullName),
                             "when using testTypeDefinition.FullName, cirClass was null");

            ICirClass cirClass = cirData.getClass("testType");

            Assert.IsNotNull(cirClass, "when using 'testType',  cirClass was null");
            Test_processTypeDefinition(cirData, cirClass);
        }
        public void test_SaveAndLoadAllO2Modules()
        {
            var directoryToSaveCidDataFiles = Path.Combine(DI.config.O2TempDir, "_O2_CirData_Files");

            Files.checkIfDirectoryExistsAndCreateIfNot(directoryToSaveCidDataFiles);
            List <string> targetAssemblies = Files.getFilesFromDir_returnFullPath(DI.config.hardCodedO2LocalBuildDir, "*.exe");

            targetAssemblies.AddRange(Files.getFilesFromDir_returnFullPath(DI.config.hardCodedO2LocalBuildDir, "*.dll"));
            foreach (var assemblyToProcess in targetAssemblies)
            {
                DI.log.info("Processing file: {0}", Path.GetFileName(assemblyToProcess));
                ICirData cirData = new CirData();
                cirFactory.processAssemblyDefinition(cirData, assemblyToProcess);
                Assert.That(cirData.dClasses_bySignature.Count > 0 && cirData.dFunctions_bySignature.Count > 0,
                            "There we no CirData results for :" + assemblyToProcess);
                var savedCirDataFile = Path.Combine(directoryToSaveCidDataFiles,
                                                    Path.GetFileName(assemblyToProcess) + ".CirData");
                CirDataUtils.saveSerializedO2CirDataObjectToFile(cirData, savedCirDataFile);
                Assert.That(File.Exists(savedCirDataFile), "Saved CirData file Didn't exist: " + savedCirDataFile);

                ICirData cirData2 = CirLoad.loadFile(savedCirDataFile);
                Assert.That(cirData2 != null, "cirData2 was null");
                Assert.That(cirData.dClasses_bySignature.Count == cirData2.dClasses_bySignature.Count,
                            "dClasses_bySignature Count didnt match");
                Assert.That(cirData.dFunctions_bySignature.Count == cirData2.dFunctions_bySignature.Count,
                            "dFunctions_bySignature Count didnt match");
                // comment this to delete created files
                //File.Delete(savedCirDataFile);
            }
        }
        public static O2RulePack createRules_SourcesAndSinks(String sCirDataFile)
        {
            var rpRulePack = new O2RulePack();

            if (false == File.Exists(sCirDataFile))
            {
                DI.log.error("in createRules_SourcesAndSinks, provide CirData file not found: {0}", sCirDataFile);
            }
            else
            {
                List <String> lsFunctions = MiscUtils.getFunctionsSignaturesFrom02CirData(sCirDataFile);
                // in this type of scan, there are two rules
                // if functions make no calls then they are maked as both Sources and Sinks
                // other cases receive no marking
                // sinks have preference (for the cases there there are no calls into and from

                CirData fcdCirData = CirLoad.loadSerializedO2CirDataObject(sCirDataFile);

                foreach (string sFunction in lsFunctions)
                {
                    ICirFunction cfCirFunction = fcdCirData.dFunctions_bySignature[sFunction];
                    if (cfCirFunction.FunctionsCalledUniqueList.Count == 0)
                    {
                        addRule(createRule(O2RuleType.Sink, sFunction, fcdCirData.sDbId), rpRulePack);
                        addRule(createRule(O2RuleType.Source, sFunction, fcdCirData.sDbId), rpRulePack);
                    }
                }
            }
            return(rpRulePack);
        }
        public void calculateCustomRuleToAdd(CirData fadCirData)
        {
            var lsRulesToAdd = new List <string>();

            fromTreeNodeListCalculateRulesToAdd_recursive(tvCommandNameObjectFields.Nodes, lsRulesToAdd, fadCirData);
            lbRulesToAdd.Items.Clear();
            lbRulesToAdd.Items.AddRange(lsRulesToAdd.ToArray());
        }
예제 #10
0
        public void specificAssemblyTest()
        {
            var      pathToDotNetFrameworkAssemblies = @"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727";
            string   assemblyToTest = Path.Combine(pathToDotNetFrameworkAssemblies, "System.EnterpriseServices.dll");
            ICirData cirData        = new CirData();

            Test_LoadingAssembly(cirData, assemblyToTest, true, true);
        }
예제 #11
0
        public void Test_processTypeDefinition()
        {
            ICirData           cirData            = new CirData();
            AssemblyDefinition testAssembly       = getTestAssembly();
            TypeDefinition     testTypeDefinition = CecilUtils.getType(testAssembly, "testType");
            ICirClass          cirClass           = cirFactory.processTypeDefinition(cirData, testTypeDefinition);

            Test_processTypeDefinition(cirData, cirClass);
        }
        public static ascx_CirDataViewer show(this ICirClass cirClass)
        {
            var cirData = new CirData();

            cirData.dClasses_bySignature.Add(cirClass.Name, cirClass);
            var cirDataViewer = cirData.show(0);

            return(cirDataViewer);
        }
예제 #13
0
        public void Test_ProcessingO2Kernel()
        {
            DI.log.info("Testing with O2Kernel");
            ICirData cirData     = new CirData();
            string   O2KernelExe = DI.config.ExecutingAssembly; // this gets O2_Kernel.Exe

            Test_LoadingAssembly(cirData, O2KernelExe, true /*verify*/, false /*verbose*/);
            CirFactoryUtils.showCirDataStats(cirData);
        }
 private void dgvResolvedCommandName_SelectionChanged(object sender, EventArgs e)
 {
     if (dgvResolvedCommandName.SelectedRows.Count == 1)
     {
         CirData fadCirData = getO2CirData();
         forClassLoadBindableFieldsIntoTreeView(tvCommandNameObjectFields,
                                                dgvResolvedCommandName.SelectedRows[0].Cells["value"].Value.
                                                ToString(), cbHideGetAndSetStrings.Checked, fadCirData);
     }
 }
예제 #15
0
        public static String createOunceProjectForAllReferencesOf_Class(String sNewProjectName, String sSourceProject,
                                                                        String sTargetFolder,
                                                                        String sSourcePathToJavaFiles,
                                                                        String sSourcePathToJspFiles,
                                                                        List <String> lsStartClasses,
                                                                        String sFunctionFilter, String sSourceF1CirData)
        {
            Files.checkIfDirectoryExistsAndCreateIfNot(sTargetFolder);
            String sTargetProject = Path.Combine(sTargetFolder, Path.GetFileName(sSourceProject));

            if (sSourceProject == sTargetProject) // make sure we don't override the Source project
            {
                DI.log.debug("Error: sTargetF1CirDataFile == sSourceProject - {0} ", sTargetProject);
                return("");
            }

            var fcdCirData = new CirData();

            fcdCirData = CirLoad.loadSerializedO2CirDataObject(sSourceF1CirData);

            List <ICirClass> lccTargetCompilationClasses = null; // = new List<CirClass>();
            List <String>    lsFunctionsCalled           = null; // = new List<string>();


            // this might not be needed
            // need to do this since the SymbolDef are not automatically mapped in the Symbols table
            //var dFunctionsNames = new Dictionary<string, string>();
            //foreach (ICirFunction cfCirFunction in fcdCirData.dFunctions_bySignature.Values)
            //    if (cfCirFunction != null && false == dFunctionsNames.ContainsKey(cfCirFunction.FunctionSignature))
            //        dFunctionsNames.Add(cfCirFunction.FunctionSignature, cfCirFunction.SymbolDef);

            // calculate Target classes
            foreach (String sStartClass in lsStartClasses)
            {
                calculateTargetComplilationClassFromStartClassSignature(sStartClass, ref lccTargetCompilationClasses,
                                                                        ref lsFunctionsCalled, sFunctionFilter,
                                                                        /*dFunctionsNames, */ fcdCirData);
            }

            // calculate full paths to class files to include in custom project
            List <String> lsPathsToClassFilesSourceCode =
                getListOfFilesToScanFromListOfClasses_J2EE(sSourcePathToJavaFiles, sSourcePathToJspFiles,
                                                           lccTargetCompilationClasses, fcdCirData);

            DI.log.debug(
                "Completed calculation of class files to include:  there where {0} classes with {1} functions called",
                lccTargetCompilationClasses.Count, lsFunctionsCalled.Count);


            createCustomProject(sNewProjectName, lsPathsToClassFilesSourceCode, sSourceProject, sTargetFolder,
                                sTargetProject, sSourcePathToJavaFiles, sSourcePathToJspFiles);

            return(sTargetProject);
        }
예제 #16
0
        public void Test_processMethodDefinition()
        {
            var cirData = new CirData();
            AssemblyDefinition testAssembly = getTestAssembly();
            TypeDefinition     testType     = CecilUtils.getType(testAssembly, "testType");


            Test_getMemberFunction(cirData, testType, "testMethodA", new Type[0]);
            Test_getMemberFunction(cirData, testType, "testMethodC", new[] { typeof(string) });
            Test_getMemberFunction(cirData, testType, "testMethodD", new[] { typeof(string), typeof(Type) });
        }
예제 #17
0
 public static ICirData toCir(this string _string)
 {
     if (_string.isDotNet())
     {
         var cirData = new CirData();
         new CirFactory().processAssemblyDefinition(cirData, _string);
         cirData.remapXRefs();
         return(cirData);
     }
     return(null);
 }
예제 #18
0
        public void Test_getMemberFunction(CirData cirData, TypeDefinition testType, string methodToTest,
                                           Type[] methodParameters)
        {
            MethodDefinition cecilMethodDefinition = CecilUtils.getMethod(testType, methodToTest, methodParameters);

            Assert.IsNotNull(cecilMethodDefinition, "cecilMethodDefinition was null for method", methodToTest);
            ICirFunction cirFunction = cirFactory.processMethodDefinition(cirData, cecilMethodDefinition, null);

            Assert.IsNotNull(cirFunction, "cecilMethodDefinition was null for method", cecilMethodDefinition);
            Assert.That(CirCecilCompare.areEqual_MethodDefinitionAndCirFunction(cecilMethodDefinition, cirFunction),
                        "areEqual_MethodDefinitionAndCirFunction failed for method: " + cecilMethodDefinition);
        }
        public void loadData()
        {
            CirData fadCirData = getO2CirData();

            ShowBeans();

            List <String> lsClasses = findSpringMvcClasses(fadCirData);

            showSpringMvcClases(lsClasses, fadCirData);
            showSpringSuperClasses(lsClasses, fadCirData);
            mapCommandNamesFromTreeNodes(tvSpringMvcClasses.Nodes);
            calculateCustomRuleToAdd(fadCirData);
        }
예제 #20
0
        public void createCirDataObject()
        {
            var      cirFactory = new CirFactory();
            ICirData cirData    = new CirData();

            DI.log.info("using assembly:{0} and O2_Kernel.dll", Assembly.GetExecutingAssembly().Location);
            cirFactory.processAssemblyDefinition(cirData, Assembly.GetExecutingAssembly().Location);
            cirFactory.processAssemblyDefinition(cirData, DI.config.ExecutingAssembly);
            Assert.That(cirData.dClasses_bySignature.Count > 0, "There were no classes in cirData object");
            Assert.That(cirData.dFunctions_bySignature.Count > 0, "There were no function in cirData object");
            O2Messages.setCirData(cirData);
            //CirFactoryUtils.showCirDataStats();
        }
        public static ICirData createCirDataFromCirDataAnalysis(ICirDataAnalysis cirDataAnalysis)
        {
            if (cirDataAnalysis == null)
            {
                return(null);
            }
            var cirData = new CirData
            {
                dClasses_bySignature   = cirDataAnalysis.dCirClass_bySignature,
                dFunctions_bySignature = cirDataAnalysis.dCirFunction_bySignature,
            };

            return(cirData);
        }
        public void test_SaveCirDataFile()
        {
            ICirData cirData = new CirData();

            cirFactory.processAssemblyDefinition(cirData, DI.config.ExecutingAssembly);
            var savedCirDataFile = DI.config.getTempFileInTempDirectory("CirData");

            Assert.That(false == File.Exists(savedCirDataFile), "savedCirDataFile shouldn't exist here");
            CirDataUtils.saveSerializedO2CirDataObjectToFile(cirData, savedCirDataFile);
            Assert.That(File.Exists(savedCirDataFile), "savedCirDataFile exist here");
            File.Delete(savedCirDataFile);
            Assert.That(false == File.Exists(savedCirDataFile), "savedCirDataFile Should be deleted");
            DI.log.info("all done");
        }
예제 #23
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);
        }
        public CirDataAnalysis createCirDataAnalysisObject(List <string> assembliesToLoad, bool decompileCodeIfNoPdb)
        {
            ICirData cirData = new CirData();

            foreach (var assemblyToLoad in assembliesToLoad)
            {
                processAssemblyDefinition(cirData, assemblyToLoad, decompileCodeIfNoPdb);
            }
            if (cirData.dClasses_bySignature.Count > 0)
            {
                return(new CirDataAnalysis(cirData));
            }
            DI.log.error("in createCirDataAnalysisObject there were no clases in CirData file");
            return(null);
        }
 public static void loadCirDumpXmlFiles_andPopulateDictionariesWithXrefs(List <String> sFilesToProcess,
                                                                         CirData fcdCirData, bool bVerbose)
 {
     for (int iFileIndex = 0; iFileIndex < sFilesToProcess.Count; iFileIndex++)
     {
         O2Timer tO2Timer =
             new O2Timer(String.Format("[{0}/{1}] Loading CirDumpFile : {2}", sFilesToProcess.Count,
                                       iFileIndex, sFilesToProcess[iFileIndex])).start();
         CommonIRDump cidCommonIrDump = loadCirDumpXmlFile_justReturnCommonIRDump(sFilesToProcess[iFileIndex],
                                                                                  bVerbose);
         fcdCirData.bVerbose = true;
         CirDataUtils.populateDictionariesWithXrefs(cidCommonIrDump, fcdCirData);
         tO2Timer.stop();
     }
 }
예제 #26
0
        private void createCirDataForFile(string fileToProcess, bool deleteFileOnCompletion, bool decompileCodeIfNoPdb)
        {
            O2Thread.mtaThread(() =>
            {
                ICirData assemblyCirData = new CirData();
                new CirFactory().processAssemblyAndSaveAsCirDataFile(assemblyCirData, fileToProcess, directory_CreatedCirFiles.getCurrentDirectory(), decompileCodeIfNoPdb);
                if (deleteFileOnCompletion)
                {
                    File.Delete(fileToProcess);
                }
            })
            ;

            //new CirCreatorEngineForDotnet().createCirForAssembly(fileToProcess);
        }
        public static CirData loadSerializedO2CirDataObject(String sTargetFile, bool bUseCachedVersionIfAvailable)
        {
            DI.log.debug("Loading o2CirData file: {0}", sTargetFile);
            // add cache support
            // return cached object (if available)
            if (bUseCachedVersionIfAvailable && vars.get(sTargetFile) != null)
            {
                return((CirData)vars.get(sTargetFile));
            }
            CirData fcdLoadedo2CirData = null;

            try
            {
                O2Timer tO2Timer =
                    new O2Timer("Loading DeSerialized O2CirData from " + Path.GetFileName(sTargetFile)).start();
                var bfBinaryFormatter = new BinaryFormatter();
                var fsFileStream      = new FileStream(sTargetFile, FileMode.Open);
                //ounceLabs.O2.classes.
                Object oObject = bfBinaryFormatter.Deserialize(fsFileStream);

                if (oObject.GetType().Name == "CirData")
                {
                    fcdLoadedo2CirData = (CirData)oObject;
                    if (fcdLoadedo2CirData.sDbId == "")
                    {
                        CirDataUtils.resolveDbId(fcdLoadedo2CirData); // in case was not originally resolved
                    }
                    if (fcdLoadedo2CirData.dClasses_bySignature == null)
                    {
                        DI.log.error("Something is wrong with this file since the dClasses dictionary is null");
                    }

                    // store loaded object as a local o2 var (which will act as a cache)
                    vars.set_(sTargetFile, fcdLoadedo2CirData);
                }
                else
                {
                    DI.log.error("Loaded data is not of type o2CirData");
                }
                fsFileStream.Close();
                tO2Timer.stop();
            }
            catch (Exception ex)
            {
                DI.log.error("In loadSerializedO2CirDataObject: {0}", ex.Message);
            }
            return(fcdLoadedo2CirData);
        }
        public static CirData loadFile(String sPathToFileToLoad)
        {
            CirData cirData;

            if (Path.GetExtension(sPathToFileToLoad) == ".CirData")
            {
                cirData = loadSerializedO2CirDataObject(sPathToFileToLoad);
            }
            else
            {
                DI.log.debug("Loading CirDumpFile file: {0}", sPathToFileToLoad);
                cirData = new CirData();
                // always resolve these xrefs since older o2CirData might have probs (note that this is a one time only effort (per O2 session))
                loadCirDumpXmlFile_andPopulateDictionariesWithXrefs(sPathToFileToLoad, cirData, false);
            }
            fixFunctionsCalledXRefs(cirData);       // required for the new objects added by the CirCreator.CirFactory funtionality
            return(cirData);
        }
 public static bool createConsolidatedCirDataFile(String sPathToCirDumpFiles, String sTargetCirDataFile,
                                                  bool bStoreControlFlowBlockRawDataInsideCirDataFile)
 {
     DI.log.debug("Creating Consolidated CirData file");
     try
     {
         List <String> lsCirDumpFiles = Files.getFilesFromDir_returnFullPath(sPathToCirDumpFiles);
         var           fcdCirData     = new CirData
         {
             bStoreControlFlowBlockRawDataInsideCirDataFile =
                 bStoreControlFlowBlockRawDataInsideCirDataFile
         };
         if (lsCirDumpFiles.Count == 0)
         {
             DI.log.error("No CirDump to process (were created during scan?)");
         }
         else
         {
             DI.log.debug("in loadCirDumpXmlFile_andPopulateDictionariesWithXrefs");
             foreach (String sFile in lsCirDumpFiles)
             {
                 try
                 {
                     fcdCirData.dSymbols = new Dictionary <string, string>();
                     fcdCirData.dTemp_Functions_bySymbolDef = new Dictionary <string, ICirFunction>();
                     CirLoad.loadCirDumpXmlFile_andPopulateDictionariesWithXrefs(sFile, fcdCirData, true);
                 }
                 catch (Exception ex)
                 {
                     DI.log.error("In createConsolidatedCirDataFile, error while processing file {0}: {1}",
                                  sFile, ex.Message);
                 }
             }
             DI.log.debug("in saveSerializedO2CirDataObjectToFile");
             CirDataUtils.saveSerializedO2CirDataObjectToFile(fcdCirData, sTargetCirDataFile);
             return(true);
         }
     }
     catch (Exception ex)
     {
         DI.log.error("In createConsolidatedCirDataFile: {0}:", ex.Message);
     }
     return(false);
 }
예제 #30
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);
        }