示例#1
0
        // Token: 0x0600002C RID: 44 RVA: 0x000034F4 File Offset: 0x000016F4
        private static IndexedSearch CheckSimpleFieldEqualsConstantCondition(LogCondition condition, CsvField[] indexedFields)
        {
            LogStringComparisonCondition logStringComparisonCondition = condition as LogStringComparisonCondition;

            if (logStringComparisonCondition == null || logStringComparisonCondition.Operator != LogComparisonOperator.Equals)
            {
                return(null);
            }
            LogConditionField    logConditionField    = logStringComparisonCondition.Left as LogConditionField;
            LogConditionConstant logConditionConstant = logStringComparisonCondition.Right as LogConditionConstant;

            if (logConditionField == null || logConditionConstant == null)
            {
                logConditionField    = (logStringComparisonCondition.Right as LogConditionField);
                logConditionConstant = (logStringComparisonCondition.Left as LogConditionConstant);
            }
            if (logConditionField == null || logConditionConstant == null)
            {
                return(null);
            }
            string text = logConditionConstant.Value as string;

            foreach (CsvField csvField in indexedFields)
            {
                if (logConditionField.Name.Equals(csvField.Name, StringComparison.OrdinalIgnoreCase) && text != null)
                {
                    return(new IndexedSearch(csvField.Name, csvField.NormalizeMethod(text)));
                }
            }
            return(null);
        }
示例#2
0
        // Token: 0x0600002E RID: 46 RVA: 0x00003998 File Offset: 0x00001B98
        private static LogOperandEvaluator FromConditionOperand(LogConditionOperand operand, CsvTable table, Dictionary <string, LogVariableEvaluator> variables, bool convertToUppercase)
        {
            LogConditionConstant logConditionConstant = operand as LogConditionConstant;

            if (logConditionConstant != null)
            {
                LogConstantEvaluator logConstantEvaluator = new LogConstantEvaluator();
                logConstantEvaluator.Value = logConditionConstant.Value;
                if (convertToUppercase)
                {
                    string text = logConstantEvaluator.Value as string;
                    if (text != null)
                    {
                        logConstantEvaluator.Value           = text.ToUpperInvariant();
                        logConstantEvaluator.AssumeUppercase = true;
                    }
                }
                return(logConstantEvaluator);
            }
            LogConditionVariable logConditionVariable = operand as LogConditionVariable;

            if (logConditionVariable != null)
            {
                if (logConditionVariable.Name == null)
                {
                    throw new LogSearchException(LogSearchErrorCode.LOGSEARCH_E_MISSING_BOUND_VARIABLE_NAME);
                }
                LogVariableEvaluator result;
                if (!variables.TryGetValue(logConditionVariable.Name, out result))
                {
                    throw new LogSearchException(LogSearchErrorCode.LOGSEARCH_E_UNBOUND_QUERY_VARIABLE);
                }
                return(result);
            }
            else
            {
                LogConditionField logConditionField = operand as LogConditionField;
                if (logConditionField == null)
                {
                    throw new LogSearchException(LogSearchErrorCode.LOGSEARCH_E_INVALID_OPERAND_CLASS);
                }
                if (logConditionField.Name == null)
                {
                    throw new LogSearchException(LogSearchErrorCode.LOGSEARCH_E_UNRECOGNIZED_QUERY_FIELD);
                }
                LogFieldEvaluator logFieldEvaluator = new LogFieldEvaluator();
                logFieldEvaluator.Index = table.NameToIndex(logConditionField.Name);
                if (logFieldEvaluator.Index == -1)
                {
                    throw new LogSearchException(LogSearchErrorCode.LOGSEARCH_E_UNRECOGNIZED_QUERY_FIELD);
                }
                return(logFieldEvaluator);
            }
        }
示例#3
0
        private static LogCondition GetFieldStringContainsComparison(MessageTrackingField field, string value)
        {
            LogConditionField logConditionField = new LogConditionField();

            logConditionField.Name = MessageTrackingSchema.MessageTrackingEvent.Fields[(int)field].Name;
            LogConditionConstant logConditionConstant = new LogConditionConstant();

            logConditionConstant.Value = value;
            return(new LogStringContainsCondition
            {
                Left = logConditionField,
                Right = logConditionConstant,
                IgnoreCase = true
            });
        }
示例#4
0
        private LogStringComparisonCondition GetFieldStringComparison(MessageTrackingField field, string value)
        {
            LogConditionField logConditionField = new LogConditionField();

            logConditionField.Name = base.Table.Fields[(int)field].Name;
            LogConditionConstant logConditionConstant = new LogConditionConstant();

            logConditionConstant.Value = value;
            return(new LogStringComparisonCondition
            {
                Left = logConditionField,
                Right = logConditionConstant,
                IgnoreCase = true,
                Operator = LogComparisonOperator.Equals
            });
        }
示例#5
0
        protected override LogCondition GetCondition()
        {
            LogAndCondition logAndCondition = new LogAndCondition();

            if (this.eventId != null)
            {
                logAndCondition.Conditions.Add(this.GetFieldStringComparison(MessageTrackingField.EventId, this.eventId));
            }
            if (this.sender != null)
            {
                logAndCondition.Conditions.Add(this.GetSenderCondition());
            }
            if (this.recipients != null)
            {
                logAndCondition.Conditions.Add(this.GetRecipientsCondition());
            }
            if (this.messageId != null)
            {
                logAndCondition.Conditions.Add(this.GetFieldStringComparison(MessageTrackingField.MessageId, CsvFieldCache.NormalizeMessageID(this.messageId)));
            }
            if (this.internalMessageId != null)
            {
                logAndCondition.Conditions.Add(this.GetFieldStringComparison(MessageTrackingField.InternalMessageId, this.internalMessageId));
            }
            if (this.subject != null)
            {
                LogConditionField logConditionField = new LogConditionField();
                logConditionField.Name = base.Table.Fields[18].Name;
                LogConditionConstant logConditionConstant = new LogConditionConstant();
                logConditionConstant.Value = this.subject;
                LogStringContainsCondition logStringContainsCondition = new LogStringContainsCondition();
                logStringContainsCondition.Left       = logConditionField;
                logStringContainsCondition.Right      = logConditionConstant;
                logStringContainsCondition.IgnoreCase = true;
                logAndCondition.Conditions.Add(logStringContainsCondition);
            }
            if (this.reference != null)
            {
                logAndCondition.Conditions.Add(this.GetFieldForAnyCondition(MessageTrackingField.Reference, this.reference, "e"));
            }
            return(logAndCondition);
        }
示例#6
0
        private static LogCondition GetSingleRecipientCondition(string address, string variableName)
        {
            LogConditionField logConditionField = new LogConditionField();

            logConditionField.Name = MessageTrackingSchema.MessageTrackingEvent.Fields[12].Name;
            LogConditionVariable logConditionVariable = new LogConditionVariable();

            logConditionVariable.Name = variableName;
            LogConditionConstant logConditionConstant = new LogConditionConstant();

            logConditionConstant.Value = address;
            LogStringComparisonCondition logStringComparisonCondition = new LogStringComparisonCondition();

            logStringComparisonCondition.Left       = logConditionVariable;
            logStringComparisonCondition.Right      = logConditionConstant;
            logStringComparisonCondition.IgnoreCase = true;
            logStringComparisonCondition.Operator   = LogComparisonOperator.Equals;
            return(new LogForAnyCondition
            {
                Field = logConditionField,
                Variable = logConditionVariable,
                Condition = logStringComparisonCondition
            });
        }
示例#7
0
        private LogForAnyCondition GetFieldForAnyCondition(MessageTrackingField field, string value, string variableName)
        {
            LogConditionField logConditionField = new LogConditionField();

            logConditionField.Name = base.Table.Fields[(int)field].Name;
            LogConditionConstant logConditionConstant = new LogConditionConstant();

            logConditionConstant.Value = value;
            LogConditionVariable logConditionVariable = new LogConditionVariable();

            logConditionVariable.Name = variableName;
            LogStringComparisonCondition logStringComparisonCondition = new LogStringComparisonCondition();

            logStringComparisonCondition.Left       = logConditionVariable;
            logStringComparisonCondition.Right      = logConditionConstant;
            logStringComparisonCondition.IgnoreCase = true;
            logStringComparisonCondition.Operator   = LogComparisonOperator.Equals;
            return(new LogForAnyCondition
            {
                Field = logConditionField,
                Variable = logConditionVariable,
                Condition = logStringComparisonCondition
            });
        }