Exemplo n.º 1
0
 public static String saveAssessmentSearchResultsAsNewAssessmentRunFile(
     AnalysisSearch.SavedAssessmentSearch sasSavedAsssessmentSearch)
 {
     bool bCreateFileWithAllTraces = true;
     bool bCreateFileWithUniqueTraces = false;
     // the next two are only used if bCreateFileWithUniqueTraces is set to true
     bool bDropDuplicateSmartTraces = true;
     bool bIgnoreRootCallInvocation = false;
     return saveAssessmentSearchResultsAsNewAssessmentRunFile(sasSavedAsssessmentSearch, "",
                                                              bCreateFileWithAllTraces,
                                                              bCreateFileWithUniqueTraces,
                                                              bDropDuplicateSmartTraces,
                                                              bIgnoreRootCallInvocation);
 }
Exemplo n.º 2
0
        public static String saveAssessmentSearchResultsAsNewAssessmentRunFile(
            AnalysisSearch.SavedAssessmentSearch sasSavedAsssessmentSearch, String sPathToNewAssessmentFile,
            bool bCreateFileWithAllTraces, bool bCreateFileWithUniqueTraces, bool bDropDuplicateSmartTraces,
            bool bIgnoreRootCallInvocation)
        {
            String sTargetFilename = "";
            if (bCreateFileWithAllTraces || bCreateFileWithUniqueTraces) // see if we have something to do 
            {
                sPathToNewAssessmentFile = createAssessmentRunFileWithAllTracesFromSavedAssessmentSearch(sPathToNewAssessmentFile, sasSavedAsssessmentSearch, out sTargetFilename);


                if (bCreateFileWithUniqueTraces)                
                    sTargetFilename = fromAssessmentRunFileCreateNewFileWithUniqueTraces(sPathToNewAssessmentFile, bDropDuplicateSmartTraces, bIgnoreRootCallInvocation);                

                if (bCreateFileWithAllTraces == false)
                    // delete it if we said we were only interested on bCreateFileWithUniqueTraces                
                    File.Delete(sPathToNewAssessmentFile);                
                
            }
            return sTargetFilename; // sPathToNewAssessmentFile;
        }
Exemplo n.º 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);
        }
Exemplo n.º 4
0
        private static string createAssessmentRunFileWithAllTracesFromSavedAssessmentSearch(string sPathToNewAssessmentFile, AnalysisSearch.SavedAssessmentSearch sasSavedAsssessmentSearch, out string sTargetFilename)
        {
            DI.log.debug("Creating SavedAssessmentFile from traces calculated");
            if (sPathToNewAssessmentFile == "")
                sPathToNewAssessmentFile = DI.config.TempFileNameInTempDirectory;
                    //if (sPathToNewAssessmentFile.IndexOf(".xml") == -1)
            sPathToNewAssessmentFile += ".ozasmt";
            var maxFindingsToSave = 25000;
            if (sasSavedAsssessmentSearch.lfrFindingsResults.Count > maxFindingsToSave)
            {
                DI.log.debug("NOTE: due to the large number of findings ({0}) multiple assessment files will be created (each with a maximum of {1} findings",
                    sasSavedAsssessmentSearch.lfrFindingsResults.Count, maxFindingsToSave);
                var index = 1;
                var itemsProcessed = 1;
                var lfrFindingsResults = new List<AnalysisSearch.FindingsResult>();

                foreach (AnalysisSearch.FindingsResult frFindingsResult in sasSavedAsssessmentSearch.lfrFindingsResults)
                {
                    //lfrFindingsResults.GetRange(0, 0);
                    lfrFindingsResults.Add(frFindingsResult);
                    if ((itemsProcessed++) % maxFindingsToSave == 0)
                    {
                        sTargetFilename = sPathToNewAssessmentFile.Replace(".ozasmt", string.Format("_part_{0}.ozasmt", index++));
                        DI.log.debug("Saving {0} findings to {1}", lfrFindingsResults.Count, sTargetFilename);
                        create_CustomSavedAssessmentRunFile_From_FindingsResult_List(lfrFindingsResults, sTargetFilename);
                        lfrFindingsResults = new List<AnalysisSearch.FindingsResult>();
                    }                    
                }
                // do the remaining ones
                sTargetFilename = sPathToNewAssessmentFile.Replace(".ozasmt", string.Format("_part_{0}.ozasmt", index));
                DI.log.debug("Saving {0} findings to {1}", lfrFindingsResults.Count, sTargetFilename);
                create_CustomSavedAssessmentRunFile_From_FindingsResult_List(lfrFindingsResults, sTargetFilename);
                sPathToNewAssessmentFile = sTargetFilename;   // assigned the last one to this
            }
            else
            {
                DI.log.debug("There are {0} findings to save", sasSavedAsssessmentSearch.lfrFindingsResults.Count);
                // we always need to create this one    
                //DI.log.debug("Create file with all traces");
                
                //create_CustomSavedAssessmentRunFile_From_FindingsResult_List(lfrFindingsResults_UniqueFindings,
                create_CustomSavedAssessmentRunFile_From_FindingsResult_List(sasSavedAsssessmentSearch.lfrFindingsResults, sPathToNewAssessmentFile);                
            }
            sTargetFilename = sPathToNewAssessmentFile;
            return sPathToNewAssessmentFile;
            /*
            DI.log.debug("Calculate  List of Findings to save");

            var lfUniqueFindings = new List<AssessmentAssessmentFileFinding>();
            var lfrFindingsResults_UniqueFindings = new List<AnalysisSearch.FindingsResult>();
            var itemsProcessed = 0;
            var itemsToProcess = sasSavedAsssessmentSearch.lfrFindingsResults.Count;
            foreach (AnalysisSearch.FindingsResult frFindingsResult in sasSavedAsssessmentSearch.lfrFindingsResults)
            {
                if (false == lfUniqueFindings.Contains(frFindingsResult.fFinding))
                {
                    lfUniqueFindings.Add(frFindingsResult.fFinding);
                    lfrFindingsResults_UniqueFindings.Add(frFindingsResult);
                }
                if ((itemsProcessed++) % 1000 == 0)
                    DI.log.info("Processed [{0}/{1}] - {2}", itemsProcessed, itemsToProcess, lfUniqueFindings.Count);
            }
            DI.log.debug("There are {0} findings to save", lfrFindingsResults_UniqueFindings.Count);*/            
        }
Exemplo n.º 5
0
 public FindingViewItem(AssessmentAssessmentFileFinding fFinding, String sText,
                        AnalysisSearch.FindingsResult frFindingResult, O2AssessmentData_OunceV6 oadO2AssessmentDataOunceV6)
 {
     this.fFinding = fFinding;
     this.sText = sText;
     this.oadO2AssessmentDataOunceV6 = oadO2AssessmentDataOunceV6;
     this.frFindingResult = frFindingResult;
 }
Exemplo n.º 6
0
 public void addSearchToPreviousSearchList(
     AnalysisSearch.SavedAssessmentSearch sasSavedAssessmentSearch_ToAddToList)
 {
     bool bSearchAlreadyOnList = false;
     tbSavedAssessmentFileName.Text =
         sasSavedAssessmentSearch_ToAddToList.ToString().Replace('|', '_').Replace(':', '_').Replace('\\', '_').
             Replace('/', '_') + ".xml";
     foreach (Object oItem in lbPreviousSearches.Items)
     {
         var sasSavedAssessmentSearch = (AnalysisSearch.SavedAssessmentSearch) oItem;
         if (sasSavedAssessmentSearch.ToString() == sasSavedAssessmentSearch_ToAddToList.ToString())
             bSearchAlreadyOnList = true;
     }
     if (false == bSearchAlreadyOnList)
         lbPreviousSearches.Items.Add(sasSavedAssessmentSearch_ToAddToList);
 }
Exemplo n.º 7
0
        public void loadGuiWithSavedAssessmentSearchData(AnalysisSearch.SavedAssessmentSearch sasSavedAssessmentSearch)
        {
            if (sasSavedAssessmentSearch != null)
            {
                String sNumberOfResults = String.Format("There were {0} results",
                                                        sasSavedAssessmentSearch.lfrFindingsResults.Count);
                DI.log.info(sNumberOfResults);
                lbNumberOfSearchResults.Text = sNumberOfResults;

                //AnalysisSearch.GUI.populateFindingsResults_TextMatches(sasSavedAssessmentSearch.lfrFindingsResults, lbSearchResults_TextMatches, cbSearchResults_TextMatches_UniqueList.Checked, cbSearchResults_TextMatches_ShowApplicationAndProjectName.Checked);

                //populateFindingsResults_Findings(sasSavedAssessmentSearch.lfrFindingsResults, cbSearchResults_Findings_Filter.Text, cbSearchResults_Findings_UniqueList.Checked);

                ascx_FindingsSearchViewer1.setSavedAssessmentSearchAndLoadData(sasSavedAssessmentSearch);
                //addSearchDataToListBox(sasSavedAssessmentSearch);
                addSearchToPreviousSearchList(sasSavedAssessmentSearch);

                //AnalysisSearch.GUI.populateWithDictionaryOfFilteredFindings_TreeView(tv_CreateSavedAssessment_PerFindingsType, dFilteredFindings);
            }
        }
Exemplo n.º 8
0
 public void setSavedAssessmentSearchAndLoadData(AnalysisSearch.SavedAssessmentSearch sasSavedAssessmentSearch)
 {
     this.sasSavedAssessmentSearch = sasSavedAssessmentSearch;
     if (tvSearchFilters.Nodes.Count == 0)
         tvSearchFilters.Nodes.Add("Search Text");
     /*
     if (sasSavedAssessmentSearch.lscSearchCriteria.Count > 0)
     {
         tvSearchFilters.Nodes.Clear();
         //tvSearchFilters.Nodes.Add(sasSavedAssessmentSearch.lscSearchCriteria[sasSavedAssessmentSearch.lscSearchCriteria.Count - 1].stSearchType.ToString());
         tvSearchFilters.Nodes.Add("Search Text");
     }*/
     loadTreeViewWithSearchResults();
 }