private void btCreateAssessmentRun_WithSelectedFindingsType_Click(object sender, EventArgs e)
        {
            //           if (lbSearchResults_SearchCriteria.Items.Count > 0)
            //           {
            var dFilteredFindings = new Dictionary <string, List <FindingViewItem> >();

            foreach (TreeNode tnTreeNode in tv_CreateSavedAssessment_PerFindingsType.Nodes)
            {
                if (tnTreeNode.Checked)
                {
                    dFilteredFindings.Add(tnTreeNode.Text, (List <FindingViewItem>)tnTreeNode.Tag);
                }
            }

            var targetDir = tbSavedAssessment_FolderName.Text.Replace(@"\\", @"\");

            Files.checkIfDirectoryExistsAndCreateIfNot(targetDir);
            var targetfileName = tbSavedAssessmentFileName.Text.Replace('|', '_').Replace(':', '_').Replace('\\', '_').Replace('/', '_');

            String sTargetPath = Path.Combine(targetDir, targetfileName);//tbSavedAssessment_FolderName.Text, tbSavedAssessmentFileName.Text);

            AnalysisSearch.SavedAssessmentSearch sasSavedAssessmentSearch =
                ascx_FindingsSearchViewer1.sasSavedAssessmentSearch;
            // (AnalysisSearch.SavedAssessmentSearch)lbSearchResults_SearchCriteria.Items[0];
            CustomAssessmentFile.create_CustomSavedAssessmentRunFile_From_FindingsResult_Dictionary(dFilteredFindings,
                                                                                                    sTargetPath);
            //         }*/
        }
Пример #2
0
        private void btCreateAssessmentRunWithSearchResults_Click(object sender, EventArgs e)
        {
            var sasSavedAssessmentSearch = new AnalysisSearch.SavedAssessmentSearch();

            // foreach (o2.analysis.FindingViewItem FindingViewItem in lbSearchResults_Findings.Items)
            // {
            //     o2.analysis.FindingViewItem fviFindingViewItem = (o2.analysis.FindingViewItem)oFindingViewItem;
            //     sasSavedAssessmentSearch.lfrFindingsResults.Add(fviFindingViewItem.frFindingResult);
            // }
            sasSavedAssessmentSearch.lfrFindingsResults = getListOfFindingsResultsFromCurrentListOfViewSearchItems();
            CustomAssessmentFile.saveAssessmentSearchResultsAsNewAssessmentRunFile(sasSavedAssessmentSearch, "",
                                                                                   cbCreateFileWithAllTraces.Checked,
                                                                                   cbCreateFileWithUniqueTraces.Checked,
                                                                                   cbDropDuplicateSmartTraces.Checked,
                                                                                   cbIgnoreRootCallInvocation.Checked);
        }
Пример #3
0
        public static string createAssessmentFileFromSavedAssessmentSearchObject(
            AnalysisSearch.SavedAssessmentSearch sasSavedAssessmentSearch, string targetFolder, string fileNamePrefix, bool bCreateFileWithAllTraces,
            bool bCreateFileWithUniqueTraces, bool bDropDuplicateSmartTraces, bool bIgnoreRootCallInvocation)
        {
            String sTargetFile = "";

            if (Directory.Exists(targetFolder))
            {
                sTargetFile = Path.Combine(targetFolder, fileNamePrefix + "_ALLTRACES");
            }


            return(CustomAssessmentFile.saveAssessmentSearchResultsAsNewAssessmentRunFile(
                       sasSavedAssessmentSearch,
                       sTargetFile,
                       bCreateFileWithAllTraces, bCreateFileWithUniqueTraces, bDropDuplicateSmartTraces, bIgnoreRootCallInvocation));
        }
 private void btCreateAssessmentRunWithSearchResults_Click(object sender, EventArgs e)
 {
     //       if (lbSearchResults_SearchCriteria.Items.Count > 0)
     {
         var targetDir = tbSavedAssessment_FolderName.Text.Replace(@"\\", @"\");
         Files.checkIfDirectoryExistsAndCreateIfNot(targetDir);
         var    targetfileName = tbSavedAssessmentFileName.Text.Replace('|', '_').Replace(':', '_').Replace('\\', '_').Replace('/', '_');
         String sTargetPath    = Path.Combine(targetDir, targetfileName);
         AnalysisSearch.SavedAssessmentSearch sasSavedAssessmentSearch =
             ascx_FindingsSearchViewer1.sasSavedAssessmentSearch;
         // (AnalysisSearch.SavedAssessmentSearch)lbSearchResults_SearchCriteria.Items[0];
         CustomAssessmentFile.saveAssessmentSearchResultsAsNewAssessmentRunFile(sasSavedAssessmentSearch,
                                                                                sTargetPath,
                                                                                cbCreateFileWithAllTraces.Checked,
                                                                                cbCreateFileWithUniqueTraces.
                                                                                Checked,
                                                                                cbDropDuplicateSmartTraces.
                                                                                Checked,
                                                                                cbIgnoreRootCallInvocation.
                                                                                Checked);
     }
 }
        public static String createFindingsFromVMFiles(ConsolidatedProcessedVelocityFiles cpvfVelocityFiles,
                                                       ascx_TraceViewer ascxTraceViewer)
        {
            String sTemplateSpringModeMapName =
                "org.springframework.ui.ModelMap.addAttribute_{0}(java.lang.String;java.lang.Object):org.springframework.ui.ModelMap";
            var lfrFindingsResult = new List <AnalysisSearch.FindingsResult>();

            foreach (ProcessedVelocityFile pvFile in cpvfVelocityFiles.getListWithProcessedLoadedFilesObjects())
            {
                foreach (String sMethod in pvFile.getFunctions())
                {
                    var fsFilteredSignature = new FilteredSignature(sMethod, ',');
                    if (fsFilteredSignature.sParameters == "")
                    // if there are no parameters just add them method as both source and sink
                    {
                        lfrFindingsResult.Add(createFindingsResultForSourceAndSink(sMethod, sMethod,
                                                                                   "Velocity.Finding.Function_noParam",
                                                                                   pvFile.getNormalizedFileName(),
                                                                                   "Velocity.Finding.Function_noParam",
                                                                                   pvFile.getNormalizedFileName(),
                                                                                   pvFile.sFullPathToOriginalFile
                                                                                   ));
                    }
                    else
                    {
                        foreach (String sParameter in fsFilteredSignature.lsParameters_Parsed)
                        {
                            String sVelocityVariableName =
                                sParameter.Replace("$", "").Replace("!", "").Replace("{", "").Replace("}", "");

                            String sSourceSignature = String.Format(sTemplateSpringModeMapName, sVelocityVariableName);
                            String sSinkSignature   = sMethod;
                            lfrFindingsResult.Add(createFindingsResultForSourceAndSink(sSourceSignature, sSinkSignature,
                                                                                       "Velocity.Finding.Function_withParam",
                                                                                       pvFile.getNormalizedFileName(),
                                                                                       "Velocity.Finding.Function_withParam",
                                                                                       pvFile.getNormalizedFileName(),
                                                                                       pvFile.sFullPathToOriginalFile
                                                                                       ));
                        }
                    }
                }

                foreach (String sVar in pvFile.getVars())
                {
                    String sVelocityVariableName = sVar.Replace("$", "").Replace("!", "").Replace("{", "").Replace("}",
                                                                                                                   "");
                    String sSourceSignature = String.Format(sTemplateSpringModeMapName, sVelocityVariableName);
                    String sSinkSignature   = sVar;
                    lfrFindingsResult.Add(createFindingsResultForSourceAndSink(sSourceSignature, sSinkSignature,
                                                                               "Velocity.Finding.Variable",
                                                                               pvFile.getNormalizedFileName(),
                                                                               "Velocity.Finding.Variable",
                                                                               pvFile.getNormalizedFileName(),
                                                                               pvFile.sFullPathToOriginalFile
                                                                               ));
                    //FindingViewItem fviFindingViewItem = new FindingViewItem(nfNewFinding.fFinding, nfNewFinding.oadNewO2AssessmentData);
                    //ascxTraceViewer.setTraceDataAndRefresh(fviFindingViewItem);
                }
            }
            String sNewAssessmentFile = DI.config.TempFileNameInTempDirectory;

            CustomAssessmentFile.create_CustomSavedAssessmentRunFile_From_FindingsResult_List(lfrFindingsResult,
                                                                                              sNewAssessmentFile);
            return(sNewAssessmentFile);
        }