Ejemplo n.º 1
0
        public void StartSbo(string url)
        {
            var sboScanAccs = System.IO.File.ReadAllLines(@"Config/SboScanAccs.txt");
            Dictionary <string, string> sboAccdics = new Dictionary <string, string>();

            foreach (var sboScanAcc in sboScanAccs)
            {
                var leagues = sboScanAcc.Split(new[] { "<>" }, StringSplitOptions.None);
                sboAccdics[leagues[0]] = leagues[1];
            }

            //sboAccdics.AsParallel().ForAll(item =>
            //{

            //});

            foreach (var sboAcc in sboAccdics)
            {
                SboEngine sbo1 = new SboEngine();
                sbo1.OnFakeRequest += OnFakeRequest;

                while (sbo1.AccountStatus == eAccountStatus.Offline)
                {
                    sbo1.TryLogin(url, sboAcc.Key, sboAcc.Value);
                }

                sbo1.UpdateLiveDataChange += sbobetUpdateChange_Event;
                sbo1.OnExceptionEvent     += OnExceptionEvent;
                sbo1.StartScanLiveDriver();
                SboScanEngines.Add(sbo1);
            }

            var timeSboLiveSleep = SystemConfig.TIME_GET_UPDATE_LIVE_SBOBET / sboAccdics.Count;
            int oType            = 0;

            foreach (var sboScanEngine in SboScanEngines)
            {
                sboScanEngine.TypeGetScan = oType;
                sboScanEngine.StartUpdateLiveDriver();
                //Thread.Sleep(1000);
                Thread.Sleep(timeSboLiveSleep);

                oType = oType == 0 ? 1 : 0;
            }

            Logger.Info("START SBO SCAN THANH CONG>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
        }
        private void ReStartSbo(object obj)
        {
            SboEngine s = obj as SboEngine;

            Logger.Info("TAM DUNG SBO SCAN<<<<<<<<<<<<<<<<<<");
            s.OnExceptionEvent     -= OnExceptionEvent;
            s.UpdateLiveDataChange -= sbobetUpdateChange_Event;
            s.LogOff();

            if (s.ReLogin())
            {
                s.UpdateLiveDataChange += sbobetUpdateChange_Event;
                s.OnExceptionEvent     += OnExceptionEvent;
                s.StartScanLiveDriver();
                s.StartUpdateLiveDriver();
            }
        }
        public void StartSbo()
        {
            int sboCount = DataContainer.SboScanAccounts.Count;

            foreach (var sboAcc in DataContainer.SboScanAccounts)
            {
                Random r   = new Random();
                string url = DataContainer.SboScanServers[r.Next(DataContainer.SboScanServers.Count())];

                SboEngine sbo1 = new SboEngine();
                sbo1.IpFake         = IpHelper.GetRandomIp();
                sbo1.OnFakeRequest += OnFakeRequest;

                sbo1.TryLoginScan(url, sboAcc.Username, sboAcc.Password);
                if (sbo1.AccountStatus == eAccountStatus.Online)
                {
                    sbo1.UpdateLiveDataChange += sbobetUpdateChange_Event;
                    sbo1.OnExceptionEvent     += OnExceptionEvent;
                    sbo1.StartScanLiveDriver();
                    SboScanEngines.Add(sbo1);
                }
            }
            var timeSboLiveSleep = SystemConfig.TIME_GET_UPDATE_LIVE_SBOBET / sboCount;
            int oType            = 0;

            foreach (var sboScanEngine in SboScanEngines)
            {
                sboScanEngine.TypeGetScan = oType;
                sboScanEngine.StartUpdateLiveDriver();
                //Thread.Sleep(1000);
                Thread.Sleep(timeSboLiveSleep);

                oType = oType == 0 ? 1 : 0;
            }

            Logger.Info("START SBO SCAN THANH CONG>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
        }