Пример #1
0
        public static IEnumerable <string> GetAllStyleSheets(string searchFrom, IEnumerable <string> allowedExtensions)
        {
            var project     = ProjectHelpers.GetProject(searchFrom);
            var projectPath = project.Properties.Item("FullPath").Value.ToString();
            var projectUri  = new Uri(projectPath, UriKind.Absolute);
            var projectDir  = Path.GetDirectoryName(projectPath);

            if (projectDir == null)
            {
                return(Enumerable.Empty <string>());
            }

            return(allowedExtensions
                   .SelectMany(e => Directory.EnumerateFiles(projectDir, "*" + e, SearchOption.AllDirectories))
                   .Select(f => GetStyleSheetFileForUrl(f, project, projectUri))
                   .Where(f => f != null));
        }