示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RegexFileFilter"/> class.
        /// </summary>
        /// <param name="pattern">The wildcard pattern.</param>
        public WildcardFileFilter(string pattern)
        {
            // Since there is no native support for globbing in C#, we will just build it using Regex
            var s = Regex.Escape(pattern);
            s = s.Replace(@"\*", ".*");
            s = s.Replace(@"\?", ".?");
            s = "^" + s + "$";

            if (log.IsDebugEnabled)
                log.DebugFormat("Creating WildcardFileFilter. Input pattern: {0} Output Regex pattern: {1}", pattern, s);

            _filter = new RegexFileFilter(s);
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RegexFileFilter"/> class.
        /// </summary>
        /// <param name="pattern">The wildcard pattern.</param>
        public WildcardFileFilter(string pattern)
        {
            // Since there is no native support for globbing in C#, we will just build it using Regex
            var s = Regex.Escape(pattern);

            s = s.Replace(@"\*", ".*");
            s = s.Replace(@"\?", ".?");
            s = "^" + s + "$";

            if (log.IsDebugEnabled)
            {
                log.DebugFormat("Creating WildcardFileFilter. Input pattern: {0} Output Regex pattern: {1}", pattern, s);
            }

            _filter = new RegexFileFilter(s);
        }