Пример #1
0
        /// <summary>
        /// Find the <see cref="CompiledRegexBase"/> with the same <see cref="CompiledRegexBase.Name"/> and  <see cref="CompiledRegexBase.Namespace"/>.
        /// </summary>
        public T Find(string name, string fullnamespace)
        {
            foreach (var item in Items)
            {
                if (CompiledRegexBase.EqualsFullQualifiedName(item, name, fullnamespace))
                {
                    return((T)item);
                }
            }

            return(null);
        }
Пример #2
0
        /// <summary>
        /// Determines whether <see cref="CompiledRegexList{T}"/> contains the exact same value.
        /// </summary>
        public virtual bool Contains(T value)
        {
            foreach (var item in Items)
            {
                if (CompiledRegexBase.Equals(item, value))
                {
                    return(true);
                }
            }

            return(false);
        }
Пример #3
0
        /// <summary>
        /// Determines the index of a <see cref="CompiledRegexBase"/> with the same <see cref="CompiledRegexBase.Name"/> and  <see cref="CompiledRegexBase.Namespace"/>.
        /// </summary>
        public virtual int IndexOf(string name, string fullnamespace)
        {
            for (int i = 0; i < Items.Count; i++)
            {
                if (CompiledRegexBase.EqualsFullQualifiedName(Items[i], name, fullnamespace))
                {
                    return(i);
                }
            }

            return(-1);
        }
Пример #4
0
        /// <summary>
        /// Determines the index of a <see cref="CompiledRegexBase"/> with the exact same value.
        /// </summary>
        public virtual int IndexOf(T value)
        {
            for (int i = 0; i < Items.Count; i++)
            {
                if (CompiledRegexBase.Equals(Items[i], value))
                {
                    return(i);
                }
            }

            return(-1);
        }
Пример #5
0
        /// <summary>
        /// Initialise on base of the specified <see cref="CompiledRegexEntry"/>, <see cref="RegexOptions"/> and <see cref="TimeSpan"/>
        /// </summary>
        internal CompiledRegexClass(CompiledRegexBase regex, RegexOptions options, TimeSpan matchTimeout) : base(regex.Pattern, regex.Name, regex.Namespace)
        {
            if (!options.HasFlag(RegexOptions.Compiled))
            {
                options |= RegexOptions.Compiled;
            }

            if (regex.MatchTimeout.HasValue)
            {
                matchTimeout = regex.MatchTimeout.Value;
            }

            if (regex.Options.HasValue)
            {
                options = regex.Options.Value;
            }

            _regex = new Regex(regex.Pattern, options, matchTimeout);
        }
Пример #6
0
        /// <summary>
        /// Find the <see cref="CompiledRegexBase"/> with the same <see cref="CompiledRegexBase.FullQualifiedName"/>.
        /// </summary>
        public T Find(string fullqualifiedname)
        {
            KeyValuePair <string, string> pair = CompiledRegexBase.SplitFullQualifiedName(fullqualifiedname);

            return(Find(pair.Key, pair.Value));
        }