Example #1
0
        public IEnumerable <IResourceGroup> GetGroups(IEnumerable <IResource> allResources, ResourceMode mode)
        {
            var consolidatedUrls =
                (from resource in allResources
                 let match = GetMatch(resource.VirtualPath)
                             where match.IsMatch() && ConsolidatedUrlTemplate.Matches(match)
                             select ConsolidatedUrlTemplate.Format(match)).Distinct();

            foreach (var consolidatedUrl in consolidatedUrls)
            {
                var resourcesInGroup = (from resource in allResources
                                        let match = GetMatch(resource.VirtualPath)
                                                    let matchingConsolidatedUrl = GetConsolidatedUrl(match)
                                                                                  where match.IsMatch() && consolidatedUrl.EqualsVirtualPath(matchingConsolidatedUrl)
                                                                                  select resource).Sort(IncludePatternOrder());

                yield return(CreateGroup(consolidatedUrl, resourcesInGroup, mode));
            }
        }
Example #2
0
 private string GetConsolidatedUrl(IResourceMatch match)
 {
     return(ConsolidatedUrlTemplate.Format(match));
 }
Example #3
0
 public bool MatchesConsolidatedUrl(string consolidatedUrl)
 {
     return(ConsolidatedUrlTemplate.Matches(consolidatedUrl));
 }