public void login()
        {
            string loginurl = http.FetchResponseUri(link, HttpHelper.HttpMethod.Get, null, null, ip);
            string data     = http.Fetch(loginurl, HttpHelper.HttpMethod.Get, null, null, ip);
            string code     = Util.HtmlGetAttributeValue(data, "value", "//input[@id='txtCode']");
            string tk       = Util.HtmlGetAttributeValue(data, "value", "//input[@id='__tk']");

            data = http.Fetch(link + "/ProcessLogin.aspx", HttpHelper.HttpMethod.Post, link, "selLang=en&txtID=" + username + "&txtPW=" + mylib.MD5(mylib.CFS(password) + code) + "&txtCode=" + code + "&hidubmit=&IEVerison=0&detecResTime=347&__tk=" + tk + "&IsSSL=0&PF=Default&RMME=on&__di=", ip);
            if (data.Contains("Login too often,please wait 5 minutes"))
            {
                message = "Login too often, please wait 5 minutes";
            }
            else
            {
                if (data.Contains("window.location='."))
                {
                    string VerifyInfo_url = Util.GetSubstringByString(data, "window.location='.", "';</script>");
                    sportLink = http.FetchResponseUri(link + VerifyInfo_url, HttpHelper.HttpMethod.Get, link + "/ProcessLogin.aspx", null, ip);
                    mainHost  = sportLink.Replace("/sports", "");
                    data      = http.Fetch(sportLink, HttpHelper.HttpMethod.Get, link + "/ProcessLogin.aspx", null, ip);
                    if (data != "")
                    {
                        message = "LOGIN SUCCESS";
                        //string checkLogin = "******";
                        //Thread tCheckLogin = new Thread(delegate () {
                        //    while (true)
                        //    {
                        //        Thread.Sleep(60000);
                        //        checkLogin = http.Fetch(mainHost + "/LoginCheckin/Index", HttpHelper.HttpMethod.Post, sportLink, null, ip, "ContentLength=0");
                        //        if(checkLogin=="")
                        //        {
                        //            message = "LOG OUT";
                        //            break;
                        //        }
                        //    }
                        //});
                        //tCheckLogin.Start();
                    }
                    else
                    {
                        message = "Data Empty";
                    }
                }
                else
                {
                    string VerifyInfo_url = Util.GetSubstringByString(data, "window.location='", "';</script>");
                    string mainLink       = http.FetchResponseUri(VerifyInfo_url, HttpHelper.HttpMethod.Get, link + "/ProcessLogin.aspx", null, ip);
                    mainHost = mainLink.Replace("/main.aspx", "");
                    data     = http.Fetch(mainLink, HttpHelper.HttpMethod.Get, link + "/ProcessLogin.aspx", null, ip);
                    if (data != "")
                    {
                        data = http.Fetch(mainHost + "/LeftAllInOne.aspx", HttpHelper.HttpMethod.Get, mainLink, null, ip);
                        data = http.Fetch(mainHost + "/GetLoginVerifyInfo.aspx", HttpHelper.HttpMethod.Get, mainHost + "/LeftAllInOne.aspx", null, ip);
                        LoginVerifyInfo o = JsonConvert.DeserializeObject <LoginVerifyInfo>(data);
                        sportLink = http.FetchResponseUri(o.Host + "/ValidateToken/Index?t=" + o.TicketID + "&c=" + o.CustID + "&l=" + o.Lan + "&f=" + o.CountryName + "&v=1&s=" + o.Ssl, HttpHelper.HttpMethod.Get, mainHost + "/LeftAllInOne.aspx", null, ip);
                        mainHost  = o.Host;
                        data      = http.Fetch(sportLink, HttpHelper.HttpMethod.Get, mainHost + "/LeftAllInOne.aspx", null, ip);
                        if (data != "")
                        {
                            message = "Login successfully";
                            string checkLogin  = "******";
                            Thread tCheckLogin = new Thread(delegate()
                            {
                                while (true)
                                {
                                    Thread.Sleep(60000);
                                    //checkLogin = http.Fetch(mainHost + "/LoginCheckin/Index", HttpHelper.HttpMethod.Post, sportLink, null, ip, mainHost, mainHost.Replace("http://", "").Replace("/", ""));
                                    checkLogin = http.Fetch(mainHost + "/LoginCheckin/Index", HttpHelper.HttpMethod.Post, sportLink, null, ip, "ContentLength=0");
                                    if (checkLogin == "")
                                    {
                                        message = "LOG OUT";
                                        break;
                                    }
                                }
                            });
                            tCheckLogin.Start();
                        }
                        else
                        {
                            message = "Data Empty";
                        }
                    }
                }
            }
        }
        public void login()
        {
            string loginurl = http.FetchResponseUri(link, HttpHelper.HttpMethod.Get, null, null, ip);
            string data     = http.Fetch(loginurl, HttpHelper.HttpMethod.Get, null, null, ip);
            string code     = Util.HtmlGetAttributeValue(data, "value", "//input[@id='txtCode']");
            string tk       = Util.HtmlGetAttributeValue(data, "value", "//input[@id='__tk']");

            data = http.Fetch(link + "/ProcessLogin.aspx", HttpHelper.HttpMethod.Post, link, "selLang=en&txtID=" + username + "&txtPW=" + mylib.MD5(mylib.CFS(password) + code) + "&txtCode=" + code + "&hidubmit=&IEVerison=0&detecResTime=347&__tk=" + tk + "&IsSSL=0&PF=Default&RMME=on&__di=", ip);
            if (data.Contains("Login too often,please wait 5 minutes"))
            {
                message = "IBET: [" + username + "] Login too often, please wait 5 minutes";
            }
            else
            {
                if (data.Contains("window.location='."))
                {
                    string VerifyInfo_url = Util.GetSubstringByString(data, "window.location='.", "';</script>");
                    sportLink = http.FetchResponseUri(link + VerifyInfo_url, HttpHelper.HttpMethod.Get, link + "/ProcessLogin.aspx", null, ip);
                    if (sportLink.Contains("ChangePasswordPage"))
                    {
                        string passDefault        = "Vvvv6868@";
                        string passNew            = "Vvvv1111";
                        string postChangePassData = "OldPassword="******"&OldLowerCasePassword="******"&NewPassword="******"&ReTypePassword="******"/ChangeAccountPassword/ChangePasswordPage", "");
                        data      = http.Fetch(mainHost + "/ChangeAccountPassword/ChangePasswordPage", HttpHelper.HttpMethod.Get, link + "/ProcessLogin.aspx", null, ip);
                        data      = http.Fetch(mainHost + "/_Incapsula_Resource?SWKMTFSR=1&e=0.021669474353265494", HttpHelper.HttpMethod.Get, mainHost + "/ChangeAccountPassword/ChangePasswordPage", null, ip);
                        data      = http.Fetch(mainHost + "/Preferences/ChangePassWord", HttpHelper.HttpMethod.Post, mainHost + "/ChangeAccountPassword/ChangePasswordPage", postChangePassData, ip);
                        data      = http.Fetch(mainHost + "/", HttpHelper.HttpMethod.Get, mainHost + "/ChangeAccountPassword/ChangePasswordPage", null, ip);
                        sportLink = mainHost + "/";
                        data      = http.Fetch(mainHost + "/Preferences/AccountAndStatememt", HttpHelper.HttpMethod.Get, sportLink, null, ip);
                        data      = http.Fetch(mainHost + "/Preferences/ChangePassWord", HttpHelper.HttpMethod.Post, sportLink, "OldPassword="******"&OldLowerCasePassword="******"&NewPassword="******"&ReTypePassword="******"/Preferences/AccountAndStatememt", HttpHelper.HttpMethod.Get, mainHost + "/Preferences/AccountAndStatememt", null, ip);
                        if (data != "")
                        {
                            message = "IBET: [" + username + "] Need to change password";
                            string checkLogin  = "******";
                            Thread tCheckLogin = new Thread(delegate()
                            {
                                while (checkLogin != "")
                                {
                                    Thread.Sleep(60000);
                                    checkLogin = http.Fetch(mainHost + "/LoginCheckin/Index", HttpHelper.HttpMethod.Post, sportLink, null, ip, mainHost, mainHost.Replace("http://", "").Replace("/", ""));
                                }
                            });
                            tCheckLogin.Start();
                        }
                        else
                        {
                            message = "IBET: LOGIN FAILED [" + username + "] Data Empty";
                        }
                    }
                    else
                    {
                        mainHost = sportLink.Replace("/sports", "");
                        data     = http.Fetch(sportLink, HttpHelper.HttpMethod.Get, link + "/ProcessLogin.aspx", null, ip);
                        if (data != "")
                        {
                            message = "IBET: [" + username + "] Login successfully";
                            string checkLogin  = "******";
                            Thread tCheckLogin = new Thread(delegate()
                            {
                                while (checkLogin != "")
                                {
                                    Thread.Sleep(60000);
                                    checkLogin = http.Fetch(mainHost + "/LoginCheckin/Index", HttpHelper.HttpMethod.Post, sportLink, null, ip, mainHost, mainHost.Replace("http://", "").Replace("/", ""));
                                }
                            });
                            tCheckLogin.Start();
                        }
                        else
                        {
                            message = "IBET: LOGIN FAILED [" + username + "] Data Empty";
                        }
                    }
                }
                else
                {
                    string VerifyInfo_url = Util.GetSubstringByString(data, "window.location='", "';</script>");
                    string mainLink       = http.FetchResponseUri(VerifyInfo_url, HttpHelper.HttpMethod.Get, link + "/ProcessLogin.aspx", null, ip);
                    mainHost = mainLink.Replace("/main.aspx", "");
                    data     = http.Fetch(mainLink, HttpHelper.HttpMethod.Get, link + "/ProcessLogin.aspx", null, ip, "", mainHost.Replace("http://", "").Replace("/", ""));
                    if (data != "")
                    {
                        data = http.Fetch(mainHost + "/LeftAllInOne.aspx", HttpHelper.HttpMethod.Get, mainLink, null, ip);
                        data = http.Fetch(mainHost + "/GetLoginVerifyInfo.aspx", HttpHelper.HttpMethod.Get, mainHost + "/LeftAllInOne.aspx", null, ip);
                        LoginVerifyInfo o = JsonConvert.DeserializeObject <LoginVerifyInfo>(data);
                        sportLink = http.FetchResponseUri(o.Host + "/ValidateToken/Index?t=" + o.TicketID + "&c=" + o.CustID + "&l=" + o.Lan + "&f=" + o.CountryName + "&v=1&s=" + o.Ssl, HttpHelper.HttpMethod.Get, mainHost + "/LeftAllInOne.aspx", null, ip);
                        mainHost  = o.Host;
                        data      = http.Fetch(sportLink, HttpHelper.HttpMethod.Get, mainHost + "/LeftAllInOne.aspx", null, ip);
                        if (data != "")
                        {
                            message = "IBET: [" + username + "] Login successfully";
                            string checkLogin  = "******";
                            Thread tCheckLogin = new Thread(delegate()
                            {
                                while (checkLogin != "")
                                {
                                    Thread.Sleep(60000);
                                    checkLogin = http.Fetch(mainHost + "/LoginCheckin/Index", HttpHelper.HttpMethod.Post, sportLink, null, ip, mainHost, mainHost.Replace("http://", "").Replace("/", ""));
                                }
                            });
                            tCheckLogin.Start();
                        }
                        else
                        {
                            message = "IBET: LOGIN FAILED [" + username + "] Data Empty";
                        }
                    }
                }
            }
        }