Example #1
0
        void LoadMore()
        {
            HttpRequestInformation httpRequestInformation = new HttpRequestInformation()
            {
                Url = "https://pix.ipv4.host/ranks",
                QueryStringParameters =
                {
                    { "page",     Page                                            },
                    { "date",     DateTime.Now.AddDays(-3).ToString("yyyy-MM-dd") },
                    { "mode",     "day"                                           },
                    { "pageSize",                                              30 }
                }
            };

            new Thread(() => {
                string response = Global.Http.Request(httpRequestInformation);
                Console.WriteLine(response);
                JsonObject jsonObject = response;
                JsonArray data        = jsonObject["data"];
                foreach (var current in data)
                {
                    AddItem(JsonConvert.Deserialize <HomeItem> (current));
                }
                IsLoading = false;
            })
            {
                IsBackground = true
            }.Start();
        }
        public static IHttpRequestInformation GetRequestInformationObject(this HttpContextBase context)
        {
            const string itemId = "_benStullHttpRequestInformation";

            if (context.Items[itemId] != null)
            {
                return((IHttpRequestInformation)context.Items[itemId]);
            }

            var requestInformation = new HttpRequestInformation(context);

            context.Items[itemId] = requestInformation;
            return(requestInformation);
        }
Example #3
0
 public void RefreshImage()
 {
     new Thread(() => {
         HttpRequestInformation httpRequestInformation = new HttpRequestInformation()
         {
             Url       = Item.ImageUrls[0].Medium.Replace("i.pximg.net", "o.acgpic.net"),
             OnRequest = httpWebRequest => {
                 httpWebRequest.Referer = $"https://pixivic.com/illusts/{Item.Id}";
                 return(true);
             }
         };
         MemoryStream memoryStream = Global.Http.RequestMemoryStream(httpRequestInformation);
         Invoke(new Action(() => {
             try {
                 PictureBox.Image = Image.FromStream(memoryStream);
             } catch {
             }
         }));
     })
     {
         IsBackground = true
     }.Start();
 }
Example #4
0
        void Login()
        {
            HttpRequestInformation httpRequestInformation = new HttpRequestInformation()
            {
                Url  = "https://pix.ipv4.host/users/token",
                Type = HttpRequestType.Post,
                QueryStringParameters =
                {
                    { "vid",   Global.Vid           },
                    { "value", TextBox_Captcha.Text }
                },
                FormData = new JsonObject()
                {
                    { "username", TextBox_Account.Text },
                    { "password", TextBox_Password.Text }
                }.ToString(),
                                   OnRequest = httpWebRequest => {
                    httpWebRequest.ContentType = "application/json";
                    return(true);
                }
            };

            new Thread(() => {
                string response       = Global.Http.Request(httpRequestInformation);
                JsonObject jsonObject = response;
                if (jsonObject.ContainsKey("data"))
                {
                    return;
                }
                MessageBox.Show(jsonObject["message"]);
                RefreshCaptcha();
            })
            {
                IsBackground = true
            }.Start();
        }