Пример #1
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.Ibet)
            {
                IbetEngine.UpdateAvailabeCredit();
            }
            else
            {
                SboEngine.UpdateAvailabeCredit();
            }

            //if (OnLogBetEvent != null)
            //{
            //    var msg = new LogBetMessage()
            //    {
            //        HomeTeamName = match.HomeTeamName,
            //        AwayTeamName = match.AwayTeamName,
            //        OddType = match.OddType,
            //        ServerType = match.ServerType,
            //        HomeOdd = match.HomeOdd,
            //        AwayOdd = match.AwayOdd,
            //        BetStake = stake,
            //        BetType = betType
            //    };
            //    OnLogBetEvent(msg);
            //}
        }
Пример #2
0
 private void WaitUpdateCreditCallback(object obj)
 {
     try
     {
         IbetEngine.UpdateAvailabeCredit();
         SboEngine.UpdateAvailabeCredit();
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
     }
 }
        private void WaitUpdateCreditCallback(object obj)
        {
            try
            {
                IbetEngine.UpdateAvailabeCredit();
                SboEngine.UpdateAvailabeCredit();

                if (OnUpdateCredit != null)
                {
                    OnUpdateCredit(null, new EventArgs());
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
        }
Пример #4
0
        private void WaitUpdateCreditCallback(object obj)
        {
            try
            {
                IbetEngine.UpdateAvailabeCredit();
                SboEngine.UpdateAvailabeCredit();
                //if (PiEngine.UpdateAvailabeCredit()==0)
                //{
                //    OnExceptionEvent(new ExceptionMessage(eExceptionType.LoginFail), eServerType.Ibet);
                //}

                //if (SboEngine.UpdateAvailabeCredit()==0)
                //{
                //    OnExceptionEvent(new ExceptionMessage(eExceptionType.LoginFail), eServerType.Sbo);
                //}
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
        }
Пример #5
0
        public eServiceStatus Start(eScanType scanType)
        {
            CompareValueDifferent = ProcessorConfigInfo.CompareValue;
            ScanType           = scanType;
            CountBet           = 1;
            MaxCountBet        = ProcessorConfigInfo.MaxCountBet;
            LastBetTime        = DateTime.Now.AddMinutes(-10);
            LastBetIbetSuccess = DateTime.Now.AddMinutes(-10);

            BetStakeType     = ProcessorConfigInfo.BetStakeType;
            BetStake         = ProcessorConfigInfo.BetStake;
            TimeOffStakeOdds = ProcessorConfigInfo.TimeOffStakeOdds;
            MinOddDefBet     = ProcessorConfigInfo.MinOddDefBet;
            MinTimeToBet     = ProcessorConfigInfo.MinTimeToBet;

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

            if (ProcessorConfigInfo.AccountFirst.ServerType == eServerType.Ibet)
            {
                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 = IbetEngine.UserName + " - " + SboEngine.UserName;
                //EngineLogger engineLogger = new EngineLogger(engineName);

                //if (SboEngine.CheckLogin() && IbetEngine.CheckLogin())
                //{
                SboEngine.EngineName = ProcessorName;
                //SboEngine.EngineLogger = engineLogger;
                SboEngine.Rebet = ProcessorConfigInfo.RebetSbo;
                //SboEngine.InitEngine();
                SboEngine.UpdateAvailabeCredit();
                SboEngine.StartScanEngine(scanType);

                //IbetEngine.InitEngine();
                IbetEngine.EngineName = ProcessorName;
                //IbetEngine.EngineLogger = engineLogger;
                IbetEngine.UpdateAvailabeCredit();
                IbetEngine.StartScanEngine(scanType);

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

                //IbetSboDriver.OnSboScanUpdate += IbetSboDriverOnUpdateScan;
                ServerCallback.OnSboScanUpdate  += OnSboUpdateScan;
                ServerCallback.OnIbetScanUpdate += OnIbetUpdateScan;
                FireProcessStateChange(eServiceStatus.Started, ProcessorName);
                Status = eServiceStatus.Started;
                //}

                // return eServiceStatus.Unknown;
            }
            catch (Exception ex)
            {
                Logger.Error("Start Processor Fail !", ex);

                StartFailCount++;

                SboEngine.Dispose();
                SboEngine.Dispose();
                Status = eServiceStatus.Unknown;
            }

            return(Status);
        }
Пример #6
0
        public eServiceStatus Start(eScanType scanType)
        {
            CompareValueDifferent = ProcessorConfigInfo.CompareValue;
            ScanType           = scanType;
            CountBet           = 1;
            MaxCountBet        = ProcessorConfigInfo.MaxCountBet;
            LastBetTime        = DateTime.Now.AddMinutes(-10);
            LastBetIbetSuccess = 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;
            //WaitingTimeRebetIbet = ProcessorConfigInfo.WaitingTimeRebetIbet;
            AcceptMinLossIbet = ProcessorConfigInfo.AcceptMinLossIbet;

            if (ProcessorConfigInfo.AccountFirst.ServerType == eServerType.Ibet)
            {
                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 = IbetEngine.UserName + " - " + SboEngine.UserName;
                //EngineLogger engineLogger = new EngineLogger(engineName);

                //if (SboEngine.CheckLogin() && PiEngine.CheckLogin())
                //{
                SboEngine.EngineName = ProcessorName;
                //SboEngine.EngineLogger = engineLogger;
                SboEngine.Rebet = ProcessorConfigInfo.RebetSbo;
                //SboEngine.InitEngine();
                SboEngine.UpdateAvailabeCredit();
                SboEngine.StartScanEngine(scanType);

                //PiEngine.InitEngine();
                IbetEngine.EngineName = ProcessorName;
                //PiEngine.EngineLogger = engineLogger;
                IbetEngine.UpdateAvailabeCredit();
                IbetEngine.StartScanEngine(scanType);

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

                _driver.OnSboScanUpdate += OnSboUpdateScan;

                //SboEngine.UpdateLiveDataChange += SboEngineOnUpdateLiveDataChange;
                //IbetSboDriver.OnSboScanUpdate += OnSboUpdateScan;
                //ServerCallback.OnSboScanUpdate += OnSboUpdateScan;
                //ServerCallback.OnIbetScanUpdate += OnIbetUpdateScan;
                ServerCallback.OnTransactionStatic += ServerCallback_OnTransaction;
                FireProcessStateChange(eServiceStatus.Started, ProcessorName);
                Status = eServiceStatus.Started;

                //List<TransactionDTO> transactionDtos;
                //while (TransactionQueue.TryDequeue(out transactionDtos))
                //{
                //    // do nothing
                //}
                //processBetThread = new Thread(DoBetTransaction);
                //processBetThread.Start();
                //}

                // return eServiceStatus.Unknown;
            }
            catch (Exception ex)
            {
                Logger.Error("Start Processor Fail !", ex);

                StartFailCount++;

                SboEngine.Dispose();
                SboEngine.Dispose();
                Status = eServiceStatus.Unknown;
            }

            return(Status);
        }
        public eServiceStatus Start(eScanType scanType)
        {
            CompareValueDifferent = ProcessorConfigInfo.CompareValue;

            CountBet         = 1;
            MaxCountBet      = ProcessorConfigInfo.MaxCountBet;
            LastBetTime      = DateTime.Now;
            BetStakeType     = ProcessorConfigInfo.BetStakeType;
            BetStake         = ProcessorConfigInfo.BetStake;
            TimeOffStakeOdds = ProcessorConfigInfo.TimeOffStakeOdds;
            if (ProcessorConfigInfo.AccountFirst.ServerType == eServerType.Ibet)
            {
                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();
                var engineName = IbetEngine.UserName + " - " + SboEngine.UserName;
                //EngineLogger engineLogger = new EngineLogger(engineName);

                //if (SboEngine.CheckLogin() && IbetEngine.CheckLogin())
                //{
                SboEngine.EngineName = engineName;
                //SboEngine.EngineLogger = engineLogger;
                SboEngine.Rebet = ProcessorConfigInfo.RebetSbo;
                //SboEngine.InitEngine();
                SboEngine.UpdateAvailabeCredit();
                SboEngine.StartScanEngine(scanType);

                //IbetEngine.InitEngine();
                IbetEngine.EngineName = engineName;
                //IbetEngine.EngineLogger = engineLogger;
                IbetEngine.UpdateAvailabeCredit();
                IbetEngine.StartScanEngine(scanType);

                objUpdateCreditTimer = new Timer(WaitUpdateCreditCallback, null, 60000 * 5, 60000 * 5);
                StartFailCount       = 0;
                Status = eServiceStatus.Started;
                //}

                // return eServiceStatus.Unknown;
            }
            catch (Exception ex)
            {
                Logger.Error("Start Processor Fail !", ex);

                StartFailCount++;

                SboEngine.Dispose();
                SboEngine.Dispose();
                Status = eServiceStatus.Unknown;
            }

            return(Status);

            //else
            //{
            //    StartServerFault startServerFault = new StartServerFault();
            //    startServerFault.ServerID = IbetEngine.Account.GuidID;
            //    startServerFault.Message = "Login Fail !";
            //    throw new FaultException<StartServerFault>(startServerFault);
            //}
        }