Exemple #1
0
 protected static bool match(SearchingMode _searchMode, String _typedString, StringList _list)
 {
     if (_typedString == null || _typedString.isEmpty())
     {
         return(true);
     }
     if (_searchMode == SearchingMode.WHOLE_STRING)
     {
         bool contained_ = false;
         foreach (String s in _list)
         {
             if (s == null)
             {
                 continue;
             }
             if (s.Equals(_typedString))
             {
                 contained_ = true;
                 break;
             }
         }
         if (!contained_)
         {
             return(false);
         }
     }
     if (_searchMode == SearchingMode.SUBSTRING)
     {
         bool contained_ = false;
         foreach (String s in _list)
         {
             if (s == null)
             {
                 continue;
             }
             if (s.Contains(_typedString))
             {
                 contained_ = true;
                 break;
             }
         }
         if (!contained_)
         {
             return(false);
         }
     }
     if (_searchMode == SearchingMode.REG_EXP)
     {
         if (_list.filter(_typedString).isEmpty())
         {
             return(false);
         }
     }
     if (_searchMode == SearchingMode.META_CHARACTER)
     {
         if (_list.filterByMultiWords(_typedString).isEmpty())
         {
             return(false);
         }
     }
     return(true);
 }