Exemplo n.º 1
0
        private IbetEngine InitLoginIbet(string domain, string username, string pass, object ipFake, int rate)
        {
            UpdateLogText(string.Format("Bắt đầu đăng nhập tài khoản IBET [{0}]......", username), eLogTextType.Warning);

            IbetEngine ibetEngine = new IbetEngine();

            if (ckProxyIbet.Checked)
            {
                ibetEngine.ProxyLogin    = true;
                ibetEngine.ProxyEndpoint = string.Concat("net.tcp://", txtIpProxyIbet.Text, ":9998/bcwinsupservice");
            }

            if (ipFake != null)
            {
                if (!string.IsNullOrEmpty(ipFake.ToString()))
                {
                    ibetEngine.IpFake = ipFake.ToString();
                }
            }

            if (ibetEngine.Login(domain, username, pass))
            {
                ibetEngine.EngineId     = Guid.NewGuid().ToString();
                ibetEngine.ExchangeRate = rate * 10;
                ibetEngine.StartScanEngine(eScanType.Live);
                UpdateLogText(string.Format("Đăng nhập [{0}] thành công! Số dư khả dụng là {1}", username, ibetEngine.UpdateAvailabeCredit()));
                return(ibetEngine);
            }
            else
            {
                UpdateLogText(string.Format("Đăng nhập ibet [{0}] không thành công!", username), eLogTextType.Error);
                return(null);
            }
        }
Exemplo n.º 2
0
        private void LoginIbet()
        {
            IbetEngine.ProxyLogin    = ClientData.ProxyIbet;
            IbetEngine.ProxyEndpoint = ClientData.ProxyIbetEndpoint;

            if (IbetEngine.Login(cboIBetDomain.Text, txtIbetAccountName.Text.Trim(), txtIbetPassword.Text.Trim()))
            {
                DataContainer.FirstAccounts.Add(txtSboAccountName.Text.Trim());
                //Show tien cuoc, thong tin user
                this.Invoke((MethodInvoker) delegate()
                {
                    ibetLoginFailCount     = 0;
                    lblIbetRealDomain.Text = IbetEngine.Host;
                    //var sboProfile = SboEngine.GetAccountProfile();
                    lblIbetStatus.Text = IbetEngine.AccountStatus.ToString();
                    //lblSboCreadit.Text = sboProfile.AvailabeCredit.ToString();
                    //lblSboCashBalance.Text = sboProfile.CashBalance.ToString();
                    IbetLoginUrl = cboIBetDomain.Text;
                });
            }
            else
            {
                this.Invoke((MethodInvoker) delegate()
                {
                    ibetLoginFailCount++;
                    lblIbetStatus.Text = "FAIL " + ibetLoginFailCount;
                });
            }
        }
Exemplo n.º 3
0
        private void OnBtnRefeshClick(object sender, EventArgs e)
        {
            var btn = (PictureBox)sender;

            this.Invoke((MethodInvoker) delegate()
            {
                if (btn.Name == "btnRefeshIbet")
                {
                    var ibetProfile         = IbetEngine.GetAccountProfile();
                    lblIbetStatus.Text      = IbetEngine.AccountStatus.ToString();
                    lblIbetRealDomain.Text  = ibetProfile.UrlHost;
                    lblIbetCreadit.Text     = ibetProfile.AvailabeCredit.ToString();
                    lblIbetCashBalance.Text = ibetProfile.CashBalance.ToString();
                    lblPingSbo.Text         = "SKIPPED";
                    lblPingIbet.Text        = "SKIPPED";
                }
                else
                {
                    var sboProfile         = SboEngine.GetAccountProfile();
                    lblSboStatus.Text      = SboEngine.AccountStatus.ToString();
                    lblSboRealDomain.Text  = sboProfile.UrlHost;
                    lblSboCreadit.Text     = sboProfile.AvailabeCredit.ToString();
                    lblSboCashBalance.Text = sboProfile.CashBalance.ToString();
                    lblPingSbo.Text        = "SKIPPED";
                    lblPingIbet.Text       = "SKIPPED";
                }
            });
        }
Exemplo n.º 4
0
 private void btnHistory_Click(object sender, EventArgs e)
 {
     this.Invoke((MethodInvoker) delegate()
     {
         var ibetBetList = IbetEngine.GetStatement(dateHistoryPick.Value);
         var sboBetList  = SboEngine.GetStatement(dateHistoryPick.Value);
         webIbetStatement.DocumentText = ibetBetList;
         webSboStatement.DocumentText  = RemoveHTMLTagsText(sboBetList, "<head>");
     });
 }
Exemplo n.º 5
0
        public static void Initialize()
        {
            IbetEngineObj       = new IbetEngine();
            SboEngineObj        = new SboEngine();
            IbetSboProcessorObj = new IbetSboProcessor();

            //DataContainer.IbetAccounts = new List<AccountDTO>()
            //{
            //    new AccountDTO() {Username = "******", Password = "******"}
            //};

            //DataContainer.SboAccounts = new List<AccountDTO>()
            //{
            //    new AccountDTO() {Username = "******", Password = "******"}
            //};

            //DataContainer.CookieContainer = new CookieContainer();
        }
Exemplo n.º 6
0
        private void Init(IbetSboDriver driver, ServerCallback serverCallback)
        {
            if (!this.IsHandleCreated)
            {
                this.CreateHandle();
            }

            ID = Guid.NewGuid();
            SetDefaultStyle();
            Processor = new IbetSboProcessor(driver, serverCallback);
            //DataContainer.TransactionProcess.Add(Processor.TransactionQueue);
            IbetEngine = new IbetEngine();
            IbetEngine.RealIpAddress = IpReal;
            SboEngine = new SboEngine();
            SboEngine.RealIpAddress = IpReal;
            IbetEngine.TabCode      = Code;
            SboEngine.TabCode       = Code;

            cboIBetDomain.DataSource      = DataContainer.IbetServers;
            cboSboDomain.DataSource       = DataContainer.SboServers;
            dgvLeaguesSetting.DataSource  = DataContainer.LeaguesSettings;
            cboMarket.SelectedIndex       = 0;
            cboCompareValue.SelectedIndex = 0;
            cboMinOddDef.SelectedIndex    = 1;

            BindConvertStakeInfo();

            lblSboStatus.TextChanged  += OnStatusTextChanged;
            lblIbetStatus.TextChanged += OnStatusTextChanged;

            IbetEngine.OnLogOffEvent += OnLogOffEvent;
            SboEngine.OnLogOffEvent  += OnLogOffEvent;

            Processor.OnProcessStateChange     += ProcessorOnOnProcessStateChange;
            Processor.OnPingEvent              += ProcessorOnOnPingEvent;
            webIbetStatement.DocumentCompleted += OnIbetStatementDocumentCompleted;
            webSboStatement.DocumentCompleted  += OnSboStatementDocumentCompleted;

            timerCheck          = new System.Timers.Timer(60000 * 2);
            timerCheck.Elapsed += CheckInfoStatus;
        }
Exemplo n.º 7
0
        public Guid InitProcessor(IbetEngine ibetEngine, SboEngine sboEngine, ProcessorConfigInfoDTO secondAccountDto)
        {
            try
            {
                Guid       ni        = Guid.NewGuid();
                IProcessor processor = new IbetSboProcessor();
                processor.IbetEngine = ibetEngine;
                processor.SboEngine  = sboEngine;

                //processor.IbetEngine.InitEngine();
                //processor.SboEngine.InitEngine();
                //processor.Initialize();
                //processor.Start();
                ProcessorContainer.Add(ni, processor);
                return(ni);
            }
            finally
            {
                //RemoveTab(firstAccountDto.GuidID);
                //RemoveTab(secondAccountDto.GuidID);
            }

            //Object.ReferenceEquals(n1.GetType(), n2.GetType()));
        }
Exemplo n.º 8
0
        private void ProcessorOnOnProcessStateChange(eServiceStatus status, string processState)
        {
            TabControl tabMain    = MainIbetSboForm.Controls.Find("tabMain", true).FirstOrDefault() as TabControl;
            TabPage    currentTab = tabMain.TabPages[ID.ToString()];

            this.Invoke((MethodInvoker) delegate()
            {
                currentTab.Text = processState;
                if (processState != "reconnecting...")
                {
                    var sboProfile         = SboEngine.GetAccountProfile();
                    lblSboStatus.Text      = SboEngine.AccountStatus.ToString();
                    lblSboRealDomain.Text  = sboProfile.UrlHost;
                    lblSboCreadit.Text     = sboProfile.AvailabeCredit.ToString();
                    lblSboCashBalance.Text = sboProfile.CashBalance.ToString();

                    var ibetProfile         = IbetEngine.GetAccountProfile();
                    lblIbetStatus.Text      = IbetEngine.AccountStatus.ToString();
                    lblIbetRealDomain.Text  = ibetProfile.UrlHost;
                    lblIbetCreadit.Text     = ibetProfile.AvailabeCredit.ToString();
                    lblIbetCashBalance.Text = ibetProfile.CashBalance.ToString();
                }
            });
        }
Exemplo n.º 9
0
        private void CheckInfoStatus(object sender, ElapsedEventArgs e)
        {
            try
            {
                var ibetProfile = IbetEngine.GetAccountProfile();

                if (ibetProfile.AvailabeCredit == 0)
                {
                    this.StopProcessor();
                    this.SetStartClickStyle();

                    Thread thread = new Thread(() => this.Processor.ReStart());
                    thread.SetApartmentState(ApartmentState.STA);
                    thread.Start();

                    return;
                }
                else
                {
                    this.Invoke((MethodInvoker) delegate
                    {
                        lblIbetStatus.Text      = IbetEngine.AccountStatus.ToString();
                        lblIbetRealDomain.Text  = IbetEngine.Host;
                        lblIbetCreadit.Text     = ibetProfile.AvailabeCredit.ToString();
                        lblIbetCashBalance.Text = ibetProfile.CashBalance.ToString();
                    });
                }
            }
            catch (Exception ex)
            {
                this.StopProcessor();
            }

            try
            {
                var sboProfile = SboEngine.GetAccountProfile();

                if (sboProfile.AvailabeCredit == 0)
                {
                    this.StopProcessor();
                    this.SetStartClickStyle();
                    Thread thread = new Thread(() => this.Processor.ReStart());
                    thread.SetApartmentState(ApartmentState.STA);
                    thread.Start();
                }
                else
                {
                    this.Invoke((MethodInvoker) delegate
                    {
                        lblSboStatus.Text      = SboEngine.AccountStatus.ToString();
                        lblSboRealDomain.Text  = SboEngine.Host;
                        lblSboCreadit.Text     = sboProfile.AvailabeCredit.ToString();
                        lblSboCashBalance.Text = sboProfile.CashBalance.ToString();
                    });
                }
            }
            catch (Exception ex)
            {
                this.StopProcessor();
            }
        }
Exemplo n.º 10
0
        public void StartProcessor()
        {
            if (!rdoMax.Checked && string.IsNullOrEmpty(txtBetStake.Text))
            {
                return;
            }

            SetProcessingStyle();

            if (IbetEngine.AccountStatus == eAccountStatus.Offline)
            {
                LoginIbet();
            }

            if (SboEngine.AccountStatus == eAccountStatus.Offline)
            {
                LoginSbo();
            }

            TabControl tabMain    = MainIbetSboForm.Controls.Find("tabMain", true).FirstOrDefault() as TabControl;
            TabPage    currentTab = tabMain.TabPages[ID.ToString()];

            if (SboEngine.AccountStatus == eAccountStatus.Online &&
                IbetEngine.AccountStatus == eAccountStatus.Online)
            {
                this.Invoke((MethodInvoker) delegate()
                {
                    scanType                      = (eScanType)cboMarket.SelectedIndex;
                    Processor.IbetEngine          = IbetEngine;
                    Processor.SboEngine           = SboEngine;
                    Processor.ProcessorConfigInfo = ProcessBindData();

                    if (Processor.Start(scanType) == eServiceStatus.Started)
                    {
                        //currentTab.Text = Processor.ProcessorName;

                        var sboProfile         = SboEngine.GetAccountProfile();
                        lblSboStatus.Text      = SboEngine.AccountStatus.ToString();
                        lblSboRealDomain.Text  = sboProfile.UrlHost;
                        lblSboCreadit.Text     = sboProfile.AvailabeCredit.ToString();
                        lblSboCashBalance.Text = sboProfile.CashBalance.ToString();

                        var ibetProfile         = IbetEngine.GetAccountProfile();
                        lblIbetStatus.Text      = IbetEngine.AccountStatus.ToString();
                        lblIbetRealDomain.Text  = ibetProfile.UrlHost;
                        lblIbetCreadit.Text     = ibetProfile.AvailabeCredit.ToString();
                        lblIbetCashBalance.Text = ibetProfile.CashBalance.ToString();
                        StartCheckStatus();
                        SetStartClickStyle();

                        ////TODO:QUOCLE: REM TO TEST
                        if (_driver.Status != eServiceStatus.Started && DataContainer.HasLocalScan)
                        {
                            Thread thread = new Thread(StartDriver);
                            thread.SetApartmentState(ApartmentState.STA);
                            thread.Start();
                        }

                        if (OnAccountSatus != null)
                        {
                            OnAccountSatus(Code, true);
                        }
                    }
                    else
                    {
                        //Quang msgbox start ko thanh cong
                        if (Processor.StartFailCount >= 3)
                        {
                            currentTab.Text = "FAIL (Force STOP)";
                            StopProcessor();
                        }
                        else
                        {
                            currentTab.Text = "FAIL";
                            SetDefaultStyle();
                        }
                    }
                });

                //Processor.OnLogScanEvent += dashboard.OnLogScanEvent;
                //Processor.OnProcessExceptionEvent += dashboard.OnProcessorExceptionEvent;
                //Processor.OnUpdateCredit += dashboard.OnUpdateCredit;
            }
            else
            {
                SetDefaultStyle();
            }
        }