Esempio n. 1
0
        public MyQueryable <T> Where(Expression <Func <T, bool> > expr)
        {
            if (_hasInitWhere)
            {
                throw new ArgumentException("每个查询只能调用一次Where方法");
            }
            _hasInitWhere = true;

            //var whereExpressionVisitor = new WhereExpressionVisitor<T>(_masterEntity);
            //whereExpressionVisitor.Visit(expr);
            //_where = whereExpressionVisitor.GetCondition();
            //_whereParameters = whereExpressionVisitor.GetParameters();
            //_whereProperties = whereExpressionVisitor.GetJoinPropertyList();

            var condition = new ConditionResolver(_masterEntity);

            condition.Resolve(expr.Body);
            _where           = condition.GetCondition();
            _whereParameters = condition.GetParameters();
            _whereProperties = condition.GetJoinPropertyList();

            return(this);
        }
Esempio n. 2
0
 public void RegisterConditionResolver(string field, ConditionResolver resolver)
 {
 }
Esempio n. 3
0
        private void Run(CancellationToken ct)
        {
            var scourCost = _currencyFactory.Currency.First(x => x.Name == CurrencyNames.ScouringOrb).Value;

            for (var progress = 0d; progress < 100; progress = _craftingTree.GetCurrencySpent(ScourCount, BaseItemCount, BaseItemCost) / Currency * 100)
            {
                if (ct.IsCancellationRequested)
                {
                    ct.ThrowIfCancellationRequested();
                }

                var newItem = _equipmentFactory.CreateEquipment();
                var result  = _craftingTree.Craft(newItem, ct);
                EquipmentList.Add(result);

                if (!result.Corrupted && result.Rarity == EquipmentRarity.Normal)
                {
                    continue;
                }

                bool added = false;

                ConditionResolver resolver = new ConditionResolver();

                foreach (var prototype in _itemPrototypes)
                {
                    if (resolver.IsValid(prototype.Condition, result))
                    {
                        MatchingItems[prototype].Add(result);
                        added = true;
                        BaseItemCount++;
                        break;
                    }
                }

                if (!added)
                {
                    if (!result.Corrupted && result.Rarity != EquipmentRarity.Normal && scourCost < BaseItemCost)
                    {
                        ScourCount++;
                    }
                    else
                    {
                        BaseItemCount++;
                    }
                }

                Progress = progress;
                OnPropertyChanged(nameof(Progress));
            }

            Progress   = 100;
            IsCrafting = false;
            OnPropertyChanged(nameof(Progress));


            App.Current.Dispatcher.Invoke((Action) delegate
            {
                OnCompletion?.Invoke();
            });
        }