コード例 #1
0
        internal bool GetMatchingValue(Message message, out TFilterData data, out bool addressMatched)
        {
            bool dataSet = false;
            int  pri     = int.MinValue;

            data           = default(TFilterData);
            addressMatched = false;
            for (int i = 0; i < this.tables.Count; ++i)
            {
                // Watch for the end of a bucket
                if (pri > this.tables[i].priority && dataSet)
                {
                    break;
                }
                pri = this.tables[i].priority;

                bool        matchResult;
                TFilterData currentData;
                IMessageFilterTable <TFilterData>   table    = this.tables[i].table;
                AndMessageFilterTable <TFilterData> andTable = table as AndMessageFilterTable <TFilterData>;
                if (andTable != null)
                {
                    bool addressResult;
                    matchResult     = andTable.GetMatchingValue(message, out currentData, out addressResult);
                    addressMatched |= addressResult;
                }
                else
                {
                    matchResult = table.GetMatchingValue(message, out currentData);
                }

                if (matchResult)
                {
                    if (dataSet)
                    {
                        throw TraceUtility.ThrowHelperError(new MultipleFilterMatchesException(SR.GetString(SR.FilterMultipleMatches), null, null), message);
                    }

                    addressMatched = true;
                    data           = currentData;
                    dataSet        = true;
                }
            }

            return(dataSet);
        }
コード例 #2
0
        internal bool GetMatchingValue(Message message, out TFilterData data, out bool addressMatched)
        {
            bool flag     = false;
            int  priority = -2147483648;

            data           = default(TFilterData);
            addressMatched = false;
            for (int i = 0; i < this.tables.Count; i++)
            {
                bool        matchingValue;
                TFilterData local;
                if ((priority > this.tables[i].priority) && flag)
                {
                    return(flag);
                }
                priority = this.tables[i].priority;
                IMessageFilterTable <TFilterData>   table  = this.tables[i].table;
                AndMessageFilterTable <TFilterData> table2 = table as AndMessageFilterTable <TFilterData>;
                if (table2 != null)
                {
                    bool flag3;
                    matchingValue   = table2.GetMatchingValue(message, out local, out flag3);
                    addressMatched |= flag3;
                }
                else
                {
                    matchingValue = table.GetMatchingValue(message, out local);
                }
                if (matchingValue)
                {
                    if (flag)
                    {
                        throw TraceUtility.ThrowHelperError(new MultipleFilterMatchesException(System.ServiceModel.SR.GetString("FilterMultipleMatches"), null, null), message);
                    }
                    addressMatched = true;
                    data           = local;
                    flag           = true;
                }
            }
            return(flag);
        }