// Token: 0x0600002B RID: 43 RVA: 0x0000345C File Offset: 0x0000165C private static bool CheckFieldEqualsConstantCondition(LogCondition condition, List <IndexedSearch> searches, CsvField[] indexedFields) { LogOrCondition logOrCondition = condition as LogOrCondition; IndexedSearch indexedSearch; if (logOrCondition != null) { List <IndexedSearch> list = new List <IndexedSearch>(); foreach (LogCondition condition2 in logOrCondition.Conditions) { indexedSearch = LogEvaluator.CheckSimpleFieldEqualsConstantCondition(condition2, indexedFields); if (indexedSearch == null) { return(false); } list.Add(indexedSearch); } searches.AddRange(list); return(true); } indexedSearch = LogEvaluator.CheckSimpleFieldEqualsConstantCondition(condition, indexedFields); if (indexedSearch != null) { searches.Add(indexedSearch); return(true); } return(false); }
// Token: 0x0600005E RID: 94 RVA: 0x00003FEC File Offset: 0x000021EC public LogFilter(Log log, Version clientSchemaVersion, LogEvaluator evaluator, DateTime begin, DateTime end) { ExTraceGlobals.ServiceTracer.TraceDebug <string, string>((long)this.GetHashCode(), "MsExchangeLogSearch constructs LogFilter with begin time {0} and end time {1}", begin.ToString(), end.ToString()); this.clientSchemaVersion = clientSchemaVersion; this.cursor = log.GetCursor(begin, end, clientSchemaVersion); this.searchContext = new SearchContext(evaluator, this.cursor); this.firstReadRequest = true; }
// Token: 0x06000028 RID: 40 RVA: 0x000033A8 File Offset: 0x000015A8 public static LogEvaluator FromCondition(LogCondition condition, CsvTable table) { Dictionary <string, LogVariableEvaluator> variables = new Dictionary <string, LogVariableEvaluator>(); LogEvaluator logEvaluator = LogEvaluator.FromCondition(condition, table, variables, 100); LogEvaluator.CheckOptimization(condition, logEvaluator.searches, table.IndexedFields, 0); return(logEvaluator); }
// Token: 0x060000F0 RID: 240 RVA: 0x00006E80 File Offset: 0x00005080 public void SetQuery(LogQuery query) { ExTraceGlobals.ServiceTracer.TraceDebug((long)this.GetHashCode(), "MsExchangeLogSearch LogSession SetQuery"); LogEvaluator evaluator = LogEvaluator.FromCondition(query.Filter, this.log.Table); LogFilter filter = new LogFilter(this.log, this.schemaVersion, evaluator, query.Beginning, query.End); this.search = new LogBackgroundReader(filter, 32768); }
// Token: 0x0600011F RID: 287 RVA: 0x00008D18 File Offset: 0x00006F18 public SearchContext(LogEvaluator evaluator, LogCursor cursor) { this.evaluator = evaluator; if (evaluator.Searches != null && evaluator.Searches.Count != 0) { this.searchEnumerator = evaluator.Searches.GetEnumerator(); this.searchEnumerator.MoveNext(); } this.cursor = cursor; }
// Token: 0x0600002A RID: 42 RVA: 0x000033DC File Offset: 0x000015DC private static bool CheckOptimization(LogCondition condition, List <IndexedSearch> searches, CsvField[] indexedFields, int optimizationCheckRecursionDepth) { if (optimizationCheckRecursionDepth > 2) { return(false); } LogAndCondition logAndCondition = condition as LogAndCondition; if (logAndCondition != null) { foreach (LogCondition condition2 in logAndCondition.Conditions) { if (LogEvaluator.CheckOptimization(condition2, searches, indexedFields, optimizationCheckRecursionDepth + 1)) { return(true); } } return(false); } return(LogEvaluator.CheckFieldEqualsConstantCondition(condition, searches, indexedFields)); }
// Token: 0x0600002D RID: 45 RVA: 0x000035B8 File Offset: 0x000017B8 private static LogEvaluator FromCondition(LogCondition condition, CsvTable table, Dictionary <string, LogVariableEvaluator> variables, int depthAllowed) { if (depthAllowed == 0) { throw new LogSearchException(LogSearchErrorCode.LOGSEARCH_E_QUERY_TOO_COMPLEX); } if (condition == null) { throw new LogSearchException(LogSearchErrorCode.LOGSEARCH_E_MISSING_QUERY_CONDITION); } if (condition is LogTrueCondition) { return(LogEvaluator.True); } if (condition is LogFalseCondition) { return(LogEvaluator.False); } LogCompoundCondition logCompoundCondition = condition as LogCompoundCondition; if (logCompoundCondition != null) { LogCompoundEvaluator logCompoundEvaluator; if (logCompoundCondition is LogAndCondition) { logCompoundEvaluator = new LogAndEvaluator(); } else { if (!(logCompoundCondition is LogOrCondition)) { throw new LogSearchException(LogSearchErrorCode.LOGSEARCH_E_INVALID_QUERY_CONDITION); } logCompoundEvaluator = new LogOrEvaluator(); } foreach (LogCondition condition2 in logCompoundCondition.Conditions) { logCompoundEvaluator.Conditions.Add(LogEvaluator.FromCondition(condition2, table, variables, depthAllowed - 1)); } return(logCompoundEvaluator); } LogUnaryCondition logUnaryCondition = condition as LogUnaryCondition; if (logUnaryCondition != null) { LogUnaryEvaluator logUnaryEvaluator = null; LogQuantifierCondition logQuantifierCondition = condition as LogQuantifierCondition; if (logQuantifierCondition != null) { LogQuantifierEvaluator logQuantifierEvaluator; if (logQuantifierCondition is LogForAnyCondition) { logQuantifierEvaluator = new LogForAnyEvaluator(); } else { if (!(logQuantifierCondition is LogForEveryCondition)) { throw new LogSearchException(LogSearchErrorCode.LOGSEARCH_E_INVALID_QUERY_CONDITION); } logQuantifierEvaluator = new LogForEveryEvaluator(); } if (logQuantifierCondition.Field.Name == null) { throw new LogSearchException(LogSearchErrorCode.LOGSEARCH_E_UNRECOGNIZED_QUERY_FIELD); } logQuantifierEvaluator.FieldIndex = table.NameToIndex(logQuantifierCondition.Field.Name); if (logQuantifierEvaluator.FieldIndex == -1) { throw new LogSearchException(LogSearchErrorCode.LOGSEARCH_E_UNRECOGNIZED_QUERY_FIELD); } Type type = table.Fields[logQuantifierEvaluator.FieldIndex].Type; if (!type.IsArray) { throw new LogSearchException(LogSearchErrorCode.LOGSEARCH_E_INCOMPATIBLE_QUERY_OPERAND_TYPES); } if (logQuantifierCondition.Variable.Name == null) { throw new LogSearchException(LogSearchErrorCode.LOGSEARCH_E_MISSING_BOUND_VARIABLE_NAME); } if (variables.ContainsKey(logQuantifierCondition.Variable.Name)) { throw new LogSearchException(LogSearchErrorCode.LOGSEARCH_E_DUPLICATE_BOUND_VARIABLE_DECLARATION); } logQuantifierEvaluator.Variable = new LogVariableEvaluator(); logQuantifierEvaluator.Variable.BoundFieldIndex = logQuantifierEvaluator.FieldIndex; variables.Add(logQuantifierCondition.Variable.Name, logQuantifierEvaluator.Variable); logUnaryEvaluator = logQuantifierEvaluator; } else if (logUnaryCondition is LogNotCondition) { logUnaryEvaluator = new LogNotEvaluator(); } logUnaryEvaluator.Condition = LogEvaluator.FromCondition(logUnaryCondition.Condition, table, variables, depthAllowed - 1); if (logQuantifierCondition != null) { variables.Remove(logQuantifierCondition.Variable.Name); } return(logUnaryEvaluator); } LogBinaryOperatorCondition logBinaryOperatorCondition = condition as LogBinaryOperatorCondition; if (logBinaryOperatorCondition != null) { bool convertToUppercase = false; LogComparisonCondition logComparisonCondition = logBinaryOperatorCondition as LogComparisonCondition; LogBinaryOperatorEvaluator logBinaryOperatorEvaluator; if (logComparisonCondition != null) { LogStringComparisonCondition logStringComparisonCondition = logComparisonCondition as LogStringComparisonCondition; LogComparisonEvaluator logComparisonEvaluator; if (logStringComparisonCondition != null) { LogStringComparisonEvaluator logStringComparisonEvaluator = new LogStringComparisonEvaluator(); convertToUppercase = logStringComparisonCondition.IgnoreCase; logStringComparisonEvaluator.IgnoreCase = logStringComparisonCondition.IgnoreCase; logComparisonEvaluator = logStringComparisonEvaluator; } else { logComparisonEvaluator = new LogComparisonEvaluator(); } logComparisonEvaluator.Operator = logComparisonCondition.Operator; logBinaryOperatorEvaluator = logComparisonEvaluator; } else { if (!(logBinaryOperatorCondition is LogBinaryStringOperatorCondition)) { throw new LogSearchException(LogSearchErrorCode.LOGSEARCH_E_INVALID_QUERY_CONDITION); } LogBinaryStringOperatorEvaluator logBinaryStringOperatorEvaluator; if (logBinaryOperatorCondition is LogStringStartsWithCondition) { logBinaryStringOperatorEvaluator = new LogStringStartsWithEvaluator(); } else if (logBinaryOperatorCondition is LogStringEndsWithCondition) { logBinaryStringOperatorEvaluator = new LogStringEndsWithEvaluator(); } else { if (!(logBinaryOperatorCondition is LogStringContainsCondition)) { throw new LogSearchException(LogSearchErrorCode.LOGSEARCH_E_INVALID_QUERY_CONDITION); } logBinaryStringOperatorEvaluator = new LogStringContainsEvaluator(); } convertToUppercase = ((LogBinaryStringOperatorCondition)logBinaryOperatorCondition).IgnoreCase; logBinaryStringOperatorEvaluator.IgnoreCase = ((LogBinaryStringOperatorCondition)logBinaryOperatorCondition).IgnoreCase; logBinaryOperatorEvaluator = logBinaryStringOperatorEvaluator; } logBinaryOperatorEvaluator.Left = LogEvaluator.FromConditionOperand(logBinaryOperatorCondition.Left, table, variables, convertToUppercase); logBinaryOperatorEvaluator.Right = LogEvaluator.FromConditionOperand(logBinaryOperatorCondition.Right, table, variables, convertToUppercase); Type valueType = logBinaryOperatorEvaluator.Left.GetValueType(table); Type valueType2 = logBinaryOperatorEvaluator.Right.GetValueType(table); if (valueType != valueType2) { throw new LogSearchException(LogSearchErrorCode.LOGSEARCH_E_INCOMPATIBLE_QUERY_OPERAND_TYPES); } return(logBinaryOperatorEvaluator); } else { LogUnaryOperatorCondition logUnaryOperatorCondition = condition as LogUnaryOperatorCondition; if (logUnaryOperatorCondition == null) { throw new LogSearchException(LogSearchErrorCode.LOGSEARCH_E_INVALID_QUERY_CONDITION); } if (logUnaryOperatorCondition is LogIsNullOrEmptyCondition) { return(new LogIsNullOrEmptyEvaluator { Operand = LogEvaluator.FromConditionOperand(logUnaryOperatorCondition.Operand, table, variables, false) }); } throw new LogSearchException(LogSearchErrorCode.LOGSEARCH_E_INVALID_QUERY_CONDITION); } }