コード例 #1
0
ファイル: AutoBuyBack.cs プロジェクト: Pecneb/AQW_Grimoire
        private async Task <string[]> GetItemHtml(string lastRequestedPage, string item, int cap)
        {
            string[] ret = new string[2];

            for (int i = 1; i <= cap; i++)
            {
                BuyBackPage p    = new BuyBackPage(lastRequestedPage);
                string      data = $"__EVENTTARGET={BuyBackPage.EventTarget}&__EVENTARGUMENT=Page%24{i}&" +
                                   $"__VIEWSTATE={p.ViewState}&__VIEWSTATEGENERATOR={p.ViewStateGenerator}&" +
                                   $"__VIEWSTATEENCRYPTED=&__EVENTVALIDATION={p.EventValidation}";

                string response = await SendPost(UrlBuyBack, data);

                lastRequestedPage = response;

                foreach (string line in response.Split('\n'))
                {
                    if (line.IndexOf(item, StringComparison.OrdinalIgnoreCase) > -1)
                    {
                        ret[0] = line;
                        ret[1] = response;
                        return(ret);
                    }
                }
            }

            return(ret);
        }
コード例 #2
0
ファイル: AutoBuyBack.cs プロジェクト: dwiki08/grimli
        // Token: 0x06000136 RID: 310 RVA: 0x00010AF8 File Offset: 0x0000ECF8
        private async Task <string[]> GetItemHtml(string lastRequestedPage, string item, int cap)
        {
            string[] ret = new string[2];
            for (int i = 1; i <= cap; i++)
            {
                BuyBackPage buyBackPage = new BuyBackPage(lastRequestedPage);
                string      postData    = string.Concat(new string[]
                {
                    string.Format("__EVENTTARGET={0}&__EVENTARGUMENT=Page%24{1}&", "GridBuyBack", i),
                    "__VIEWSTATE=",
                    buyBackPage.ViewState,
                    "&__VIEWSTATEGENERATOR=",
                    buyBackPage.ViewStateGenerator,
                    "&__VIEWSTATEENCRYPTED=&__EVENTVALIDATION=",
                    buyBackPage.EventValidation
                });
                string text = await this.SendPost("inventory.aspx?tab=buyback", postData);

                lastRequestedPage = text;
                foreach (string text2 in text.Split(new char[]
                {
                    '\n'
                }))
                {
                    if (text2.IndexOf(item, StringComparison.OrdinalIgnoreCase) > -1)
                    {
                        ret[0] = text2;
                        ret[1] = text;
                        return(ret);
                    }
                }
            }
            return(ret);
        }
コード例 #3
0
ファイル: AutoBuyBack.cs プロジェクト: dwiki08/grimli
 // Token: 0x06000135 RID: 309 RVA: 0x00010AA0 File Offset: 0x0000ECA0
 public async Task Perform(string item, int pageCap)
 {
     if (!string.IsNullOrEmpty(this.Username) && !string.IsNullOrEmpty(this.Password))
     {
         string lastRequestedPage;
         if (!string.IsNullOrEmpty(lastRequestedPage = await this.SendPost(string.Empty, string.Concat(new string[]
         {
             "uuu=",
             this.Username,
             "&pps=",
             this.Password,
             "&submit="
         }))))
         {
             string[] array;
             if ((array = await this.GetItemHtml(lastRequestedPage, item, pageCap)).Length >= 2)
             {
                 BuyBackPage buyBackPage  = new BuyBackPage(array[0]);
                 BuyBackPage buyBackPage2 = new BuyBackPage(array[1]);
                 string      postData     = string.Concat(new string[]
                 {
                     "__EVENTTARGET=GridBuyBack&__EVENTARGUMENT=",
                     buyBackPage.EventArgument,
                     "&__VIEWSTATE=",
                     buyBackPage2.ViewState,
                     "&__VIEWSTATEGENERATOR=",
                     buyBackPage2.ViewStateGenerator,
                     "&__VIEWSTATEENCRYPTED=&__EVENTVALIDATION=",
                     buyBackPage2.EventValidation
                 });
                 string html;
                 if (!string.IsNullOrEmpty(html = await this.SendPost("inventory.aspx?tab=buyback", postData)))
                 {
                     BuyBackPage buyBackPage3 = new BuyBackPage(html);
                     string      postData2    = string.Concat(new string[]
                     {
                         "__VIEWSTATE=",
                         buyBackPage3.ViewState,
                         "&__VIEWSTATEGENERATOR=",
                         buyBackPage3.ViewStateGenerator,
                         "&__VIEWSTATEENCRYPTED=&__EVENTVALIDATION=",
                         buyBackPage3.EventValidation,
                         "&btnConfirmYes=YES%2c+GET+NOW+FOR+FREE"
                     });
                     await this.SendPost("inventory.aspx?tab=buyback", postData2);
                 }
             }
         }
     }
 }
コード例 #4
0
ファイル: AutoBuyBack.cs プロジェクト: Pecneb/AQW_Grimoire
        public async Task Perform(string item, int pageCap)
        {
            if (string.IsNullOrEmpty(Username) || string.IsNullOrEmpty(Password))
            {
                return;
            }

            string buyBackPage;

            if (string.IsNullOrEmpty(buyBackPage = await SendPost(string.Empty, $"uuu={Username}&pps={Password}&submit=")))
            {
                return;
            }

            string[] itemInfo;
            if ((itemInfo = await GetItemHtml(buyBackPage, item, pageCap)).Length < 2)
            {
                return;
            }

            BuyBackPage itemArgs     = new BuyBackPage(itemInfo[0]);
            BuyBackPage itemSelected = new BuyBackPage(itemInfo[1]);

            string reqPurchase = $"__EVENTTARGET={BuyBackPage.EventTarget}&__EVENTARGUMENT={itemArgs.EventArgument}&" +
                                 $"__VIEWSTATE={itemSelected.ViewState}&__VIEWSTATEGENERATOR={itemSelected.ViewStateGenerator}&" +
                                 "__VIEWSTATEENCRYPTED=&" +
                                 $"__EVENTVALIDATION={itemSelected.EventValidation}";

            string reqResponse;

            if (string.IsNullOrEmpty(reqResponse = await SendPost(UrlBuyBack, reqPurchase)))
            {
                return;
            }

            BuyBackPage itemConfirm = new BuyBackPage(reqResponse);

            string reqConfirm = $"__VIEWSTATE={itemConfirm.ViewState}&__VIEWSTATEGENERATOR={itemConfirm.ViewStateGenerator}&" +
                                "__VIEWSTATEENCRYPTED=&" +
                                $"__EVENTVALIDATION={itemConfirm.EventValidation}&btnConfirmYes={BuyBackPage.Confirm}";

            await SendPost(UrlBuyBack, reqConfirm);
        }