Пример #1
0
 static string EscapeToken(string token, QueryTextDelimiterEscapeOptions requiredEscapeOptions, QueryTextDelimiterEscapeOptions currentEscapeOptions)
 {
     if (currentEscapeOptions.HasAll(requiredEscapeOptions))
     {
         return(Regex.Escape(token));
     }
     return(token);
 }
Пример #2
0
        public QueryTextDelimiter(string openingToken, string closingToken, QueryTextDelimiterEscapeOptions escapeOptions)
        {
            this.escapeOptions = escapeOptions;
            this.openingToken  = openingToken;
            this.closingToken  = closingToken;

            escapedOpeningToken = EscapeToken(openingToken, QueryTextDelimiterEscapeOptions.EscapeOpening, escapeOptions);
            escapedClosingToken = EscapeToken(closingToken, QueryTextDelimiterEscapeOptions.EscapeClosing, escapeOptions);
        }
Пример #3
0
 public static bool HasAll(this QueryTextDelimiterEscapeOptions flags, QueryTextDelimiterEscapeOptions all) => (flags & all) == all;
Пример #4
0
 public static bool HasAny(this QueryTextDelimiterEscapeOptions flags, QueryTextDelimiterEscapeOptions f) => (flags & f) != 0;