public void SetSolutionFiles(List <string> solution_file_paths) { FileFinder.SolutionFiles solution_files = new FileFinder.SolutionFiles(); solution_files.m_SolutionFilePaths = new List <string>(solution_file_paths); foreach (string file in solution_files.m_SolutionFilePaths) { solution_files.m_SolutionFileNames.Add(Path.GetFileName(file)); } solution_files.m_SolutionFilePathsLowerCase = Utils.ToLower(solution_files.m_SolutionFilePaths); solution_files.m_SolutionFileNamesLowercase = Utils.ToLower(solution_files.m_SolutionFileNames); object @lock = this.m_Lock; lock (@lock) { this.m_SolutionFiles = solution_files; } }
private List <FindFileResult> FindFilesInSolution(FileFinder.Job job, AsyncTask.Context context) { FileFinder.SolutionFiles solution_files = null; object @lock = this.m_Lock; lock (@lock) { solution_files = this.m_SolutionFiles; } string pattern = job.m_TextBoxValue; if (!this.m_Settings.GetSolutionFilesMatchCase(job.m_IsModal)) { pattern = pattern.ToLower(); } SettingsDialogPage arg_5D_0 = VSAnythingPackage.Inst.GetSettingsDialogPage(); bool match_case = job.m_MatchCase; if (arg_5D_0.SpacesAsWildcardsForFindFile && pattern.Contains(' ')) { pattern = "*" + pattern.Replace(' ', '*') + "*"; } bool use_wildacrd = job.m_UseWildcards && pattern.Contains('*'); if (use_wildacrd) { if (!pattern.StartsWith("*")) { pattern = "*" + pattern; } if (!pattern.EndsWith("*")) { pattern += "*"; } } bool use_full_paths = pattern.Contains("\\"); IEnumerable <string> arg_121_0 = this.m_Settings.GetSolutionFilesMatchCase(job.m_IsModal) ? (use_full_paths ? solution_files.m_SolutionFilePaths : solution_files.m_SolutionFileNames) : (use_full_paths ? solution_files.m_SolutionFilePathsLowerCase : solution_files.m_SolutionFileNamesLowercase); List <FindFileResult> found_files = new List <FindFileResult>(); int i = 0; foreach (string file in arg_121_0) { bool match; if (use_wildacrd) { match = Wildcard.Match(file, pattern); } else if (match_case) { match = file.Contains(pattern); } else { match = Utils.StrStr(file, pattern); } if (match) { string file_path = solution_files.m_SolutionFilePaths[i]; string file_name = solution_files.m_SolutionFileNames[i]; FindFileResult found_file = default(FindFileResult); found_file.m_FilePath = file_path; found_file.m_FileName = file_name; if (Path.IsPathRooted(job.m_RootPath) && Path.IsPathRooted(file_path) && Path.GetPathRoot(job.m_RootPath) == Path.GetPathRoot(file_path) && !Utils.IsSolutionFile(file_path)) { found_file.m_RelativeFilePath = Misc.GetRelativePath(job.m_RootPath, file_path); } else { found_file.m_RelativeFilePath = file_path; } found_file.m_PathMatch = false; found_files.Add(found_file); } i++; if (context.Cancelled) { break; } } return(found_files); }