Exemplo n.º 1
0
 public override bool ShouldIntercept(InterceptInfo e)
 {
     if (e.TypeName == LATE_BINDING && e.MethodName.StartsWith("Late"))
     {
         return true;
     }
     return false;
 }
Exemplo n.º 2
0
        private void OnInterceptExecuted(InterceptInfo input, Exception ex)
        {

        }
Exemplo n.º 3
0
        private async Task InterceptTrade(InterceptInfo info)
        {
            SuplierInfo supplier = info.supplier;
            string spu = info.spuId;
            TopTrade trade = info.trade;
            Statistic statistic = info.statistic;
            AppendText("将拦截订单{0},买家:{1}", trade.Tid, trade.BuyerNick);
            trade.Intercept = true;
            AppDatabase.db.TopTrades.Update(trade);
            var product = AppDatabase.db.ProductItems.FindById(trade.NumIid);

            try
            {
                if (!await this.SetProductProfit(product, (x) => 0, forceModify: true))
                {
                    statistic.InterceptFailed++;
                    AppDatabase.db.Statistics.Upsert(statistic, statistic.Id);
                    OnStatisticUpdate(statistic);
                }
                else
                {
                    AppendText("商品{0}改价已提交", trade.NumIid);

                    //1分钟后关单
                    await Task.Delay(1000 * 60 - 500);

                    AppendText("{0}关闭交易...", trade.Tid);
                    await CloseTradeIfPossible(trade.Tid);
                }
            }
            catch (Exception ex)
            {
                AppendException(ex);
            }
        }
Exemplo n.º 4
0
		public override bool ShouldIntercept (InterceptInfo info) {
			return info.TypeName.EndsWith("SomeTargetClass") && (info.MethodName.StartsWith("SomeMethod") || info.MethodName.EndsWith("ctor")) || info.MethodName == "MethodThatDoesNotExist";
		}
Exemplo n.º 5
0
 public override bool ShouldIntercept(InterceptInfo info)
 {
     return info.TypeName.Contains(Find);
 }