Exemple #1
0
        /*private void handleDrop(DragEventArgs e)
         * {
         *  O2Thread.mtaThread(
         *      ()=>
         *  {
         *      var fileOrFolder = Dnd.tryToGetFileOrDirectoryFromDroppedObject(e);
         *
         *      if (false == loadCirDataFile(fileOrFolder))
         *          // if (false == loadReferenceFindings(fileOrFolder))
         *          loadFileOrFolder(fileOrFolder);
         *  });
         * }*/

        private void handleDropOnDropControl(object oObject, bool processJarFiles, bool deleteTempFiles)
        {
            var workingOnTaskFormName = "Running Spring MVC (Annotations) Analysis Engine";

            O2AscxGUI.workingOnTaskForm_open(workingOnTaskFormName);

            O2Thread.mtaThread(
                () =>
            {
                Processes.Sleep(500);
                try
                {
                    O2AscxGUI.workingOnTaskForm_setText(workingOnTaskFormName, "Prepare files for Analysis (unzip zip, jars, etc..)");
                    var pythonStringTargetFileOrFolder = AnnotationsHelper.getPythonStringTargetFileOrFolder(oObject.ToString(), processJarFiles);
                    //var tempFolder = DI.config.getTempFolderInTempDirectory("unzipedDroppedZip");
                    O2AscxGUI.workingOnTaskForm_setText(workingOnTaskFormName, "Converting files (using Jyhton)");
                    var tempFolderForAnnotationsXmlFiles = AnnotationsHelper.createAnnotationsXmlFilesFromJavaClassFileOrFolder(pythonStringTargetFileOrFolder);
                    var javaXmlFilesToProcess            = AnnotationsHelper.calculateFilesToProcess(oObject.ToString(), tempFolderForAnnotationsXmlFiles);
                    O2AscxGUI.workingOnTaskForm_setText(workingOnTaskFormName, "Creating CirData");
                    var cirData = createCirData(javaXmlFilesToProcess);
                    O2AscxGUI.workingOnTaskForm_setText(workingOnTaskFormName, "Mapping Spring Mvc Controllers");

                    var springMvcControllers = createSpringMvcControlersObjectsFromXmlFiles(javaXmlFilesToProcess);

                    springMvcMappings.loadMappedControllers(cirData, springMvcControllers);
                    //showSpringMvcControllers(springMvcControllers);
                    if (deleteTempFiles)
                    {
                        Files.deleteFolder(tempFolderForAnnotationsXmlFiles, true);
                        Files.deleteFolder(pythonStringTargetFileOrFolder, true);
                    }
                    else
                    {
                        DI.log.info(
                            "Temp files were not deleted:   \n    tempFolderForAnnotationsXmlFiles:{0}\n    pythonStringTargetFileOrFolder:{1} ",
                            tempFolderForAnnotationsXmlFiles, pythonStringTargetFileOrFolder);
                    }
                    O2AscxGUI.workingOnTaskForm_close(workingOnTaskFormName);
                }
                catch (Exception ex)
                {
                    DI.log.error("in handleDropOnDropControl: {0}", ex.Message);
                }
            });
        }