Пример #1
0
 private static WildcardItem[] ParseWildcard(string Mask)
 {
     string[]       Parts  = Mask.Split(Separators, StringSplitOptions.RemoveEmptyEntries);
     WildcardItem[] Result = new WildcardItem[Parts.Length];
     for (int i = 0; i < Parts.Length; ++i)
     {
         string Part = Parts[i];
         if (Part == "**")
         {
             Result[i] = new WildcardItem(EMatch.MatchSubtree, null);
         }
         else
         {
             string Escaped = Regex.Escape(Part);
             string Pattern = Escaped.Replace("\\*", ".*").Replace("\\?", ".");
             if (Pattern != Escaped)
             {
                 Result[i] = new WildcardItem(EMatch.MatchRegex, Pattern);
             }
             else
             {
                 Result[i] = new WildcardItem(EMatch.MatchEquals, Part);
             }
         }
     }
     return(Result);
 }
Пример #2
0
 private static WildcardItem[] ParseWildcard(string Mask)
 {
     string[] Parts = Mask.Split(Separators, StringSplitOptions.RemoveEmptyEntries);
     WildcardItem[] Result = new WildcardItem[Parts.Length];
     for (int i = 0; i < Parts.Length; ++i)
     {
         string Part = Parts[i];
         if (Part == "**")
         {
             Result[i] = new WildcardItem(EMatch.MatchSubtree, null);
         }
         else
         {
             string Escaped = Regex.Escape(Part);
             string Pattern = Escaped.Replace("\\*", ".*").Replace("\\?", ".");
             if (Pattern != Escaped)
             {
                 Result[i] = new WildcardItem(EMatch.MatchRegex, Pattern);
             }
             else
             {
                 Result[i] = new WildcardItem(EMatch.MatchEquals, Part);
             }
         }
     }
     return Result;
 }