예제 #1
0
            private bool ZMatchHere(sCursor pPattern, sCursor pMailboxPath)
            {
                while (true)
                {
                    if (pPattern.AtEnd)
                    {
                        return(pMailboxPath.AtEnd);
                    }
                    char lPatternCurrent = pPattern.Current;
                    pPattern.MoveNext();

                    if (lPatternCurrent == '*')
                    {
                        return(ZMatchWildcard(true, pPattern, pMailboxPath));
                    }
                    if (lPatternCurrent == '%')
                    {
                        return(ZMatchWildcard(mNoDelimiter, pPattern, pMailboxPath));
                    }

                    if (pMailboxPath.AtEnd)
                    {
                        return(false);
                    }
                    if (lPatternCurrent != pMailboxPath.Current)
                    {
                        return(false);
                    }
                    pMailboxPath.MoveNext();
                }
            }
예제 #2
0
 private bool ZMatchWildcard(bool pMatchDelimiter, sCursor pPattern, sCursor pMailboxPath)
 {
     while (true)
     {
         if (ZMatchHere(pPattern, pMailboxPath))
         {
             return(true);
         }
         if (pMailboxPath.AtEnd)
         {
             return(false);
         }
         if (!pMatchDelimiter && pMailboxPath.Current == mDelimiter)
         {
             return(false);
         }
         pMailboxPath.MoveNext();
     }
 }
예제 #3
0
            public cMailboxPathPattern(string pPrefix, string pPattern, char?pDelimiter)
            {
                if (pPattern == null)
                {
                    throw new ArgumentNullException(pPattern);
                }

                mPrefix  = pPrefix ?? throw new ArgumentNullException(pPrefix);
                mPattern = new sCursor(pPattern);

                if (pDelimiter == null)
                {
                    mNoDelimiter = true;
                }
                else
                {
                    mNoDelimiter = false;
                    mDelimiter   = pDelimiter.Value;
                }
            }