예제 #1
0
        public ConfigFilterChainManager AddFilter(IConfigFilter filter)
        {
            // 根据order大小顺序插入
            int i = 0;

            while (i < this.filters.Count)
            {
                IConfigFilter currentValue = this.filters[i];
                if (currentValue.GetFilterName().Equals(filter.GetFilterName()))
                {
                    break;
                }

                if (filter.GetOrder() >= currentValue.GetOrder() && i < this.filters.Count)
                {
                    i++;
                }
                else
                {
                    this.filters.Insert(i, filter);
                    break;
                }
            }

            if (i == this.filters.Count)
            {
                this.filters.Insert(i, filter);
            }

            return(this);
        }
예제 #2
0
        public ConfigFilterChainManager AddFilter(IConfigFilter filter)
        {
            lock (_filters)
            {
                int i = 0;
                while (i < _filters.Count)
                {
                    var currentValue = _filters[i];
                    if (currentValue.GetFilterName() == filter.GetFilterName())
                    {
                        break;
                    }
                    if (filter.GetOrder() >= currentValue.GetOrder() && i < _filters.Count)
                    {
                        i++;
                    }
                    else
                    {
                        _filters.Insert(i, filter);
                        break;
                    }
                }

                if (i == _filters.Count)
                {
                    _filters.Add(filter);
                }

                return(this);
            }
        }
예제 #3
0
 public void DoFilter(IConfigRequest request, IConfigResponse response)
 {
     if (this.currentPosition != this.additionalFilters.Count)
     {
         this.currentPosition++;
         IConfigFilter nextFilter = this.additionalFilters[this.currentPosition - 1];
         nextFilter.DoFilter(request, response, this);
     }
 }