private IEnumerable <IResourceFile> FilterViewFiles(IResourceDirectory directory)
 {
     return(directory
            .GetFiles()
            .Where(f => !Contains(f.VirtualPath, "_ViewStart") &&
                   f.Name.EndsWith(FILE_EXTENSION, StringComparison.OrdinalIgnoreCase)));
 }
Пример #2
0
        private IEnumerable <PageTemplateFile> SearchDirectoryForPageTemplateFiles(IResourceDirectory directory, string searchText)
        {
            foreach (var file in directory.GetFiles())
            {
                // filename contains the search text and is located in a 'PageTemplates' folder, but not a 'partials' folder and has the extension .cshtml
                if (Contains(file.Name, searchText) &&
                    !Contains(file.VirtualPath, PARTIALS_FOLDER_NAME) &&
                    !Contains(file.VirtualPath, "_ViewStart") &&
                    file.Name.EndsWith(FILE_EXTENSION, StringComparison.OrdinalIgnoreCase))
                {
                    yield return(MapPageTemplateFile(file));
                }
            }

            foreach (var childDirectory in directory.GetDirectories())
            {
                foreach (var file in SearchDirectoryForPageTemplateFiles(childDirectory, searchText))
                {
                    yield return(file);
                }
            }
        }