Exemplo n.º 1
0
        /// <summary>
        /// Returns the set of resources whose name matches the specified regular expression.
        /// </summary>
        /// <param name="regex">A regular expression to be used to select matching resources.</param>
        /// <returns>An array of fully qualified resource names that match the specified regular expression.</returns>
        public string[] FindResources(Regex regex)
        {
            Platform.CheckForNullReference(regex, @"regex");

            var matches = new List <string>();

            foreach (var asm in _assemblies)
            {
                matches.AddRange(CollectionUtils.Select(asm.GetManifestResourceNames(), result => regex.Match(result).Success));
            }

            // include the fallback
            if (_fallbackResolver != null)
            {
                matches.AddRange(_fallbackResolver.FindResources(regex));
            }

            return(CollectionUtils.Unique(matches).ToArray());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns the set of resources whose name matches the specified regular expression.
        /// </summary>
        /// <param name="regex"></param>
        /// <returns></returns>
        public string[] FindResources(Regex regex)
        {
            List <string> matches = new List <string>();

            foreach (Assembly asm in _assemblies)
            {
                matches.AddRange(
                    CollectionUtils.Select(asm.GetManifestResourceNames(),
                                           delegate(string res) { return(regex.Match(res).Success); }));
            }

            // include the fallback
            if (_fallbackResovler != null)
            {
                matches.AddRange(_fallbackResovler.FindResources(regex));
            }

            return(CollectionUtils.Unique(matches).ToArray());
        }