Exemplo n.º 1
0
 private void ResultPage_OnGenerateResultItem(ResultItem result)
 {
     this.AddResultItem(result);
 }
Exemplo n.º 2
0
        public bool FilterItem(ResultItem item)
        {
            bool flag = true;

            if (this.Filter.SizeStart != null ||
                this.Filter.SizeEnd != null)
            {
                int?size = item.GetSizeKB();

                if (size != null)
                {
                    if (this.Filter.SizeStart != null &&
                        this.Filter.SizeEnd != null)
                    {
                        flag = size >= this.Filter.SizeStart &&
                               size <= this.Filter.SizeEnd;
                    }
                    else if (this.Filter.SizeStart != null)
                    {
                        flag = size >= this.Filter.SizeStart;
                    }
                    else if (this.Filter.SizeEnd != null)
                    {
                        flag = size <= this.Filter.SizeEnd;
                    }
                }
            }


            if (flag)
            {
                if (this.Filter.DateStart != null ||
                    this.Filter.DateEnd != null)
                {
                    DateTime?date = item.GetDate();
                    if (date != null)
                    {
                        if (this.Filter.DateStart != null &&
                            this.Filter.DateEnd != null)
                        {
                            flag = date >= this.Filter.DateStart &&
                                   date <= this.Filter.DateEnd;
                        }
                        else if (this.Filter.DateStart != null)
                        {
                            flag = date >= this.Filter.DateStart;
                        }
                        else if (this.Filter.DateEnd != null)
                        {
                            flag = date <= this.Filter.DateEnd;
                        }
                        else
                        {
                            flag = true;
                        }
                    }
                }
            }


            if (flag)
            {
                switch (this.Filter.ItemType)
                {
                case ItemType.All:
                    return(true);

                case ItemType.Magnet:
                    return(item is MagnetItem ||
                           item is TitleItem);

                case ItemType.BaiduShare:
                    return(item is BaiduNetDiskItem ||
                           item is TitleItem);

                case ItemType.Magnet_Baidu:
                    return(item is MagnetItem ||
                           item is BaiduNetDiskItem ||
                           item is TitleItem);

                case ItemType.Subtitle:
                    return(item is SubTitleItem ||
                           item is TitleItem);
                }
            }

            return(flag);
        }