Пример #1
0
        public void loadFiles(string filesPath, List <string> filesToLoad)
        {
            sourceCode.set_Text("Loading files from: {0}".format(filesPath));
            Path.set_Text(filesPath);
            var filesContent   = new Dictionary <string, string>();
            var nonBinaryFiles = new List <string>();

            foreach (var file in filesToLoad)
            {
                if (file.isBinaryFormat().isFalse())
                {
                    nonBinaryFiles.add(file);
                }
            }

            foreach (var file in nonBinaryFiles)
            {
                filesContent.add(file.remove(filesPath), file.contents());
            }

            searchEngine = new SearchEngine();
            searchEngine.loadFiles(nonBinaryFiles);

            //searchEngine.fixH2FileLoadingIssue();

            leftPanel.clear();
            treeView = leftPanel.add_TreeViewWithFilter(filesContent);
            treeView.afterSelect <string>(
                (fileContents) => {
                sourceCode.open(filesPath + treeView.selected().get_Text());
            });
            sourceCode.colorCodeForExtension(treeView.selected().str());
            sourceCode.set_Text("");
            textSearch_TextBox = leftPanel.controls <TextBox>(true)[1];
            textSearch_TextBox.onEnter(
                (text) => {
                var searchResults = searchEngine.searchFor(text);
                dataGridView.loadInDataGridView_textSearchResults(searchResults);
            });
        }
		public void loadFiles(string filesPath, List<string> filesToLoad)
		{						
			sourceCode.set_Text("Loading files from: {0}".format(filesPath));
			Path.set_Text(filesPath);
			var filesContent = new Dictionary<string,string>();
			var nonBinaryFiles = new List<string>();
			foreach(var file in filesToLoad) 
				if (file.isBinaryFormat().isFalse()) 
					nonBinaryFiles.add(file);
			
			foreach(var file in nonBinaryFiles) 
					filesContent.add(file.remove(filesPath),file.contents());	
					
			searchEngine = new SearchEngine();
			searchEngine.loadFiles(nonBinaryFiles); 			
			
			//searchEngine.fixH2FileLoadingIssue();
			
			leftPanel.clear();
			treeView = leftPanel.add_TreeViewWithFilter(filesContent); 
			treeView.afterSelect<string>(
				(fileContents)=>{					
									sourceCode.open(filesPath + treeView.selected().get_Text());
								});						
			sourceCode.colorCodeForExtension(treeView.selected().str());
			sourceCode.set_Text("");
			textSearch_TextBox = leftPanel.controls<TextBox>(true)[1];
			textSearch_TextBox.onEnter(
				(text)=>{
					var searchResults = searchEngine.searchFor(text);
					dataGridView.loadInDataGridView_textSearchResults(searchResults);  
				});
			
			
		}		
Пример #3
0
 public static List<TextSearchResult> executeSearch(String sRegExToSearch, List<String> lsFileToSearch)
 {
     var searchEngine = new SearchEngine();
     searchEngine.loadFiles(lsFileToSearch);
     return searchEngine.executeSearch(sRegExToSearch);
 }