Ejemplo n.º 1
0
        public bool GetReupInfoRentPubg()
        {
again:
            try
            {
                System.Threading.Thread.Sleep(100);
                ///html/body
                string idAccount = "";
                string idSteam   = "";
                string pwSteam   = "";
                string npwSteam  = "";

                string[] tmp            = rentpubg.FindElement(By.XPath("/html/body/div[3]/div/div/div/h4[1]")).Text.Split(new char[] { ' ' });
                int      quantityOfReup = int.Parse(tmp[0]);


                for (int i = 1; i <= quantityOfReup; i++)
                {
                    idAccount = rentpubg.FindElement(By.XPath("/html/body/div[3]/div/div/div/div[2]/table/tbody/tr[" + i.ToString() + "]/td[6]/button[1]")).GetAttribute("data-id").ToString();
                    idSteam   = rentpubg.FindElement(By.XPath("/html/body/div[3]/div/div/div/div[2]/table/tbody/tr[" + i.ToString() + "]/td[2]/span")).Text;
                    if (skipList.Contains(idSteam))
                    {
                        continue;
                    }

                    for (int j = 0; j < 13 * ((i - 1) / 10); j++)
                    {
                        rentpubg.FindElement(By.XPath("/html/body")).SendKeys(OpenQA.Selenium.Keys.Down);
                    }

                    pwSteam  = rentpubg.FindElement(By.XPath("/html/body/div[3]/div/div/div/div[2]/table/tbody/tr[" + i.ToString() + "]/td[3]/span")).Text;
                    npwSteam = rentpubg.FindElement(By.XPath("/html/body/div[3]/div/div/div/div[2]/table/tbody/tr[" + i.ToString() + "]/td[4]/span")).Text;

                    // nếu có pass từ list thì lấy pass từ list
                    for (int index = 0; index < idList.Count; index++)
                    {
                        if (idList[index] == idSteam)
                        {
                            pwSteam = pwList[index];
                            break;
                        }
                    }
                    account = new CAccount(idRentAcc, idEmail, pwEmail);
                    Console.WriteLine(idSteam + " " + pwSteam + " " + npwSteam);
                    account.SetReupInfo(idAccount, idSteam, pwSteam, npwSteam);
                    return(true);
                }
                skipList.Clear();
                return(false);
            }
            catch (Exception error)
            {
                string log = String.Format("{0:dd/MM/yyyy HH:mm:ss}", DateTime.Now) + ". Error: " + error.ToString() + "\r\n" + account.GetInfo() + "\r\n";
                WriteBugLog(log);
                goto again;
            }
        }
Ejemplo n.º 2
0
        public void UpdateTotal()
        {
            try
            {
get1:
                try
                {
                    rentpubg.Url = "http://rentpubg.com/pubg";
                    rentpubg.Navigate();

                    //System.Threading.Thread.Sleep(100);
                    string rdw = rentpubg.FindElement(By.XPath("/html/body/div[3]/div/div[1]/div[1]/div[2]/div/a[1]")).Text;
                    readyWeb = rdw.Substring(rdw.IndexOf('(') + 1, rdw.IndexOf(')') - rdw.IndexOf('(') - 1);
                    try
                    {
                        readyWeb = readyWeb.Remove(readyWeb.IndexOf('.'), 1);
                    }
                    catch { }
                    string rtw = rentpubg.FindElement(By.XPath("/html/body/div[3]/div/div[1]/div[1]/div[2]/div/a[2]")).Text;
                    rentWeb = rtw.Substring(rtw.IndexOf('(') + 1, rtw.IndexOf(')') - rtw.IndexOf('(') - 1);
                    try
                    {
                        rentWeb = rentWeb.Remove(rentWeb.IndexOf('.'), 1);
                    }
                    catch { }
                }
                catch
                {
                    goto get1;
                }


get2:
                try
                {
                    rentpubg.Url = "http://rentpubg.com/shop/thong-ke";
                    rentpubg.Navigate();

                    string tmpzz = rentpubg.FindElement(By.XPath("/html/body/div[3]/div/div/div/h4[1]")).Text;
                    revenue      = tmpzz.Substring(tmpzz.IndexOf(':') + 1, tmpzz.IndexOf('-') - tmpzz.IndexOf(':') - 2);
                    numberOfRent = tmpzz.Substring(tmpzz.IndexOf('-') + 1, tmpzz.IndexOf('L') - tmpzz.IndexOf('-') - 2);
                }
                catch { goto get2; }


get3:
                try
                {
                    rentpubg.Url = linkShop;
                    rentpubg.Navigate();


                    string rd = rentpubg.FindElement(By.XPath("/html/body/div[3]/div/div[1]/div[1]/div/div[2]/a[1]")).Text;
                    ready = rd.Substring(rd.IndexOf('(') + 1, rd.IndexOf(')') - rd.IndexOf('(') - 1);

                    string rt = rentpubg.FindElement(By.XPath("/html/body/div[3]/div/div[1]/div[1]/div/div[2]/a[2]")).Text;
                    rent = rt.Substring(rt.IndexOf('(') + 1, rt.IndexOf(')') - rt.IndexOf('(') - 1);
                }
                catch { goto get3; }

get4:
                try
                {
                    rentpubg.Url = "http://rentpubg.com/shop";
                    rentpubg.Navigate();

                    for (int i = 0; i < 25; i++)
                    {
                        rentpubg.FindElement(By.XPath("/html/body")).SendKeys(OpenQA.Selenium.Keys.Down);
                    }

                    string[] tmp = rentpubg.FindElement(By.XPath("/html/body/div[3]/div/div/div/h4[1]")).Text.Split(new char[] { ' ' });
                    end = tmp[0];
                    string tmperror = rentpubg.FindElement(By.XPath("/html/body/div[3]/div/div/div/h4[2]")).Text;
                    error = tmperror.Substring(0, tmperror.IndexOf(" ACC"));
                }
                catch { goto get4; }
            }
            catch (Exception error)
            {
                string log = String.Format("{0:dd/MM/yyyy HH:mm:ss}", DateTime.Now) + ". Error: " + error.ToString() + "\r\n" + account.GetInfo() + "\r\n";
                WriteBugLogC(log);
            }
        }