コード例 #1
0
 private void WaitUpdateCreditCallback(object obj)
 {
     try
     {
         PiEngine.UpdateAvailabeCredit();
         IsnEngine.UpdateAvailabeCredit();
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
     }
 }
コード例 #2
0
 private void UpdateBetPool(eServerType serverType, string matchId, Dictionary <string, int> betPool, int stake)
 {
     if (!betPool.ContainsKey(matchId))
     {
         betPool.Add(matchId, 0);
     }
     betPool[matchId] += stake;
     if (serverType == eServerType.Pina)
     {
         PiEngine.UpdateAvailabeCredit();
     }
     else
     {
         IsnEngine.UpdateAvailabeCredit();
     }
 }
コード例 #3
0
        public eServiceStatus Start(eScanType scanType)
        {
            CompareValueDifferent = ProcessorConfigInfo.CompareValue;
            //CompareValueDifferent = ProcessorConfigInfo.CompareValue + 0.005;
            ScanType    = scanType;
            CountBet    = 1;
            MaxCountBet = ProcessorConfigInfo.MaxCountBet;
            LastBetTime = DateTime.Now.AddMinutes(-10);

            BetStakeType = ProcessorConfigInfo.BetStakeType;
            Stake        = ProcessorConfigInfo.BetStake;

            BetStake = new List <int>();
            var stak = Stake.Split(new[] { '#' });

            foreach (var s in stak)
            {
                if (!string.IsNullOrEmpty(s))
                {
                    int stake;
                    int.TryParse(s, out stake);
                    if (stake != 0)
                    {
                        //Logger.Info("STAKE " + stake);
                        BetStake.Add(stake);
                    }
                }
            }

            BetStake.Shuffle();


            TimeOffStakeOdds = ProcessorConfigInfo.TimeOffStakeOdds;
            MinOddDefBet     = ProcessorConfigInfo.MinOddDefBet;
            MinTimeToBet     = ProcessorConfigInfo.MinTimeToBet;

            BetAgainstIbet    = ProcessorConfigInfo.RebetIbet;
            AcceptMinLossIbet = ProcessorConfigInfo.AcceptMinLossIbet;

            if (ProcessorConfigInfo.AccountFirst.ServerType == eServerType.Pina)
            {
                IbetMaxStakeMatch = ProcessorConfigInfo.AccountFirst.MaxStake;
                IbetRateExchange  = ProcessorConfigInfo.AccountFirst.RateExchange;
                SboMaxStakeMatch  = ProcessorConfigInfo.AccountSecond.MaxStake;
                SboRateExchange   = ProcessorConfigInfo.AccountSecond.RateExchange;
            }
            else
            {
                IbetMaxStakeMatch = ProcessorConfigInfo.AccountSecond.MaxStake;
                IbetRateExchange  = ProcessorConfigInfo.AccountSecond.RateExchange;
                SboMaxStakeMatch  = ProcessorConfigInfo.AccountFirst.MaxStake;
                SboRateExchange   = ProcessorConfigInfo.AccountFirst.RateExchange;
            }

            try
            {
                Initialize();
                ProcessorName = PiEngine.UserName + " - " + IsnEngine.UserName;

                IsnEngine.EngineName = ProcessorName;
                IsnEngine.Rebet      = ProcessorConfigInfo.RebetSbo;
                IsnEngine.UpdateAvailabeCredit();
                IsnEngine.StartScanEngine(scanType);

                PiEngine.Rebet      = ProcessorConfigInfo.RebetSbo;
                PiEngine.EngineName = ProcessorName;
                PiEngine.UpdateAvailabeCredit();
                PiEngine.StartScanEngine(scanType);

                objUpdateCreditTimer = new Timer(WaitUpdateCreditCallback, null, 60000 * 5, 60000 * 5);
                StartFailCount       = 0;

                IsnEngine.UpdateLiveDataChange += OnIsnUpdateScan;

                //tạm đóng
                //PiSboDriver.OnSboScanUpdate += PiSboDriver_OnSboScanUpdate;
                //_driver.OnSboScanUpdate += OnSboUpdateScan;

                FireProcessStateChange(eServiceStatus.Started, ProcessorName);
                Status = eServiceStatus.Started;
            }
            catch (Exception ex)
            {
                Logger.Error("Start Processor Fail !", ex);

                StartFailCount++;

                PiEngine.Dispose();
                IsnEngine.Dispose();
                Status = eServiceStatus.Unknown;
            }

            return(Status);
        }