private Dictionary <string, PageModuleTypeFileLocation> GetModuleTypeFileLocations() { var viewDirectories = _pageModuleViewLocationRegistrations .SelectMany(r => r.GetPathPrefixes()) .Select(p => FormatViewFolder(p)) .Select(p => _resourceLocator.GetDirectory(p)) .Where(d => d != null) ; var templateFiles = new Dictionary <string, PageModuleTypeFileLocation>(); var foldersToExclude = new string[] { TEMPLATES_FOLDER_NAME, PARTIALS_FOLDER_NAME }; foreach (var directory in viewDirectories) { foreach (var viewFile in FilterViewFiles(directory)) { AddTemplateToDictionary(templateFiles, viewFile); } foreach (var viewFile in FilterChildDirectoryFiles(directory, foldersToExclude)) { AddTemplateToDictionary(templateFiles, viewFile); } } return(templateFiles); }
private IEnumerable <PageTemplateFile> GetUnorderedPageTemplateFiles(string searchText) { var templateDirecotryPaths = _pageTemplateViewLocationRegistrations.SelectMany(r => r.GetPathPrefixes()); var templateDirectories = templateDirecotryPaths .Select(p => _resourceLocator.GetDirectory(p)) .Where(d => d.Exists); foreach (var templateDirectoryPath in templateDirecotryPaths) { foreach (var layoutFile in SearchDirectoryForPageTemplateFiles(templateDirectoryPath, searchText)) { yield return(layoutFile); } } }
private Dictionary <string, PageBlockTypeFileLocation> GetPageBlockTypeFileLocations() { var viewDirectoryPaths = _pageBlockTypeViewLocationRegistrations .SelectMany(r => r.GetPathPrefixes()) .Select(p => FormatViewFolder(p)) ; var templateFiles = new Dictionary <string, PageBlockTypeFileLocation>(); var foldersToExclude = new string[] { TEMPLATES_FOLDER_NAME, PARTIALS_FOLDER_NAME }; foreach (var directoryPath in viewDirectoryPaths) { var directory = _resourceLocator.GetDirectory(directoryPath); if (!directory.Exists) { continue; } foreach (var viewFile in FilterViewFiles(directory)) { AddTemplateToDictionary(templateFiles, directoryPath, viewFile); } foreach (var childDirectory in directory .Where(d => d.IsDirectory && !foldersToExclude.Any(f => d.Name.Equals(f, StringComparison.OrdinalIgnoreCase)))) { var childDirectoryPath = FilePathHelper.CombineVirtualPath(directoryPath, childDirectory.Name); foreach (var viewFile in FilterChildDirectoryFiles(childDirectoryPath, directory, foldersToExclude)) { AddTemplateToDictionary(templateFiles, childDirectoryPath, viewFile); } } } return(templateFiles); }
private IEnumerable <PageTemplateFile> GetUnorderedPageTemplateFiles(string searchText) { var viewDirectories = _viewEngine .ViewLocationFormats .Where(f => (f.Contains("{1}") || f.Contains(PAGE_TEMPLATES_FOLDER_NAME)) && !PAGE_TEMPLATE_DIRECTORIES_TO_EXCLUDE.Any(e => f.StartsWith(e))) .Select(f => Path.ChangeExtension(string.Format(f, string.Empty, PAGE_TEMPLATES_FOLDER_NAME), null)); foreach (var directory in viewDirectories) { foreach (var layoutFile in SearchDirectoryForPageTemplateFiles(_resourceLocator.GetDirectory(directory), searchText)) { yield return(layoutFile); } } }