private static void FindAllItemsBody(ICodebaseService codebaseService , BranchInfo branchInfo, string path, Func <SourceItemInfo, bool> resultCondition , Func <IEnumerable <SourceItemInfo>, bool> escapeFolderCondition, bool includeResultsFromEscapingFolder , ref List <SourceItemInfo> results, ProgressObserver progressObserver) { var itemsList = codebaseService.GetSourceItemsList(branchInfo, path); if (!itemsList.Any()) { return; } if (progressObserver != null) { progressObserver.ProgressData = $"[{branchInfo.Repo.Project.Name}/{branchInfo.Repo.Name}: {branchInfo.Name}]/{path}"; } bool escaping = escapeFolderCondition(itemsList); if (escaping && !includeResultsFromEscapingFolder) { return; } var resultItemsList = itemsList.Where(i => resultCondition(i)); foreach (var item in resultItemsList) { results.Add(item); } if (!escaping) { var folderList = itemsList.Where(i => i.Name?.Substring(0, 1) != "." && i.Type == SourceItemTypes.Directory); if (!folderList.Any()) { return; } var pathPrefix = !string.IsNullOrEmpty(path) ? $"{path}/" : string.Empty; foreach (var folder in folderList) { FindAllItemsBody(codebaseService, branchInfo, $"{pathPrefix}{folder.Name}", resultCondition , escapeFolderCondition, includeResultsFromEscapingFolder, ref results, progressObserver); } } }
public static IEnumerable <SourceItemInfo> GetSourceItemsList(this ICodebaseService codebaseService, BranchInfo branchInfo) { return(codebaseService.GetSourceItemsList(branchInfo, string.Empty)); }