Exemplo n.º 1
0
            internal static WildcardElement Create(string pattern, ref int patternIndex)
            {
                if (patternIndex >= pattern.Length)
                {
                    return(null);
                }

                switch (pattern[patternIndex])
                {
                case '*':
                    return(WildcardAsteriskElement.Create(pattern, ref patternIndex));

                case '?':
                    return(WildcardQuestionElement.Create(pattern, ref patternIndex));

                case '#':
                    return(WildcardSharpElement.Create(pattern, ref patternIndex));

                case '[':
                {
                    int             startIndex = patternIndex;
                    WildcardElement element    = WildcardRangeElement.Create(pattern, ref patternIndex);
                    if (element == null)
                    {
                        patternIndex = startIndex;
                        element      = WildcardStringElement.Create(pattern, ref patternIndex);
                    }

                    return(element);
                }

                default:
                    return(WildcardStringElement.Create(pattern, ref patternIndex));
                }
            }
Exemplo n.º 2
0
            internal new static WildcardAsteriskElement Create(string pattern, ref int patternIndex)
            {
                patternIndex++;

                var element = new WildcardAsteriskElement();

                element.Next = WildcardElement.Create(pattern, ref patternIndex);

                return(element);
            }