Esempio n. 1
0
        private setuInfo loadData()
        {
            string r18type = "";

            this.Text = "每日涩图 - 加载信息中...";
            switch (comSetuType.Text)
            {
            case "健康涩图":
                r18type = "0";
                break;

            case "R18-健康混合":
                r18type = "2";
                break;

            case "纯R18涩图":
                r18type = "1";
                break;
            }

            string ret = HttpGet("http://api.lolicon.app/setu?r18=" + r18type);

            if (ret != "")
            {
                setuInfo rt = JsonConvert.DeserializeObject <setuInfo>(ret);
                return(rt);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 2
0
        public void AsyncCallbackImpl(IAsyncResult ar)
        {
            setuInfo re = fh.EndInvoke(ar);

            if (re != null)
            {
                this.Text = re.data[0].title + " by " + re.data[0].author + "(" + re.data[0].uid + ") | tags: ";
                foreach (string s in re.data[0].tags)
                {
                    this.Text = this.Text + s + "  ";
                }

                currTitle      = this.Text;
                currSetuInfo   = re;
                lblStatus.Text = "色图原始分辨率:" + re.data[0].width + "X" + re.data[0].height + ";是否R-18:" +
                                 (re.data[0].r18 == "true" ? "是" : "否");
                btnGKD.Enabled = true;
                btnGKD.Text    = "太慢🌶,给👴停下,下一张";
                picSetu.LoadAsync(re.data[0].url);
                comStyle.Enabled = true;
            }
            else
            {
                comStyle.Enabled = true;
                btnGKD.Enabled   = true;
            }
        }
Esempio n. 3
0
        public void SyncCallBack(setuInfo re)
        {
            picSetu.LoadAsync(re.data[0].url);

            reSetSizeByImage(picSetu);
            container.Width  = this.Width - 25;
            container.Height = this.Height - btnGKD.Height - progress.Height - groupBox1.Height - 50;
        }
Esempio n. 4
0
        public void AsyncCallbackImpl(IAsyncResult ar)
        {
            setuInfo re = fh.EndInvoke(ar);

            if (!string.IsNullOrEmpty(re.msg) && re.msg != "success")
            {
                MessageBox.Show(re.msg);
            }

            if (re != null && re.data != null && re.data.Any() && !string.IsNullOrEmpty(re.data.First().title))
            {
                this.Text = re.data[0].title + " by " + re.data[0].author + "(" + re.data[0].uid + ") | tags: ";
                foreach (string s in re.data[0].tags)
                {
                    this.Text = this.Text + s + "  ";
                }

                currTitle      = this.Text;
                currSetuInfo   = re;
                lblStatus.Text = "色图原始分辨率:" + re.data[0].width + "X" + re.data[0].height + ";是否R-18:" +
                                 (re.data[0].r18 == "true" ? "是" : "否");

                //btnGKD.Text    = "太慢🌶,给👴停下,下一张";

                var getParam = new ReqParams()
                {
                    Timeout = 10000
                };
                if (!string.IsNullOrEmpty(txtProxy.Text))
                {
                    getParam.ProxyToUse = new WebProxy(txtProxy.Text);
                }

                var task = Requests.GetAsync(re.data[0].url, getParam)
                           .ContinueWith((resp) =>
                {
                    btnGKD.Enabled = true;
                    if (resp.IsCompleted)
                    {
                        Image res     = Image.FromStream(resp.Result.RawStream);
                        picSetu.Image = res;
                    }
                });

                //picSetu.LoadAsync();
                comStyle.Enabled = true;
            }
            else
            {
                MessageBox.Show("色图加载失败咯,请重试");
                comStyle.Enabled = true;
                btnGKD.Enabled   = true;
            }
        }
Esempio n. 5
0
        private setuInfo loadData()
        {
            string r18type = "";

            this.Text = "每日涩图 - 加载信息中...";
            switch (comSetuType.Text)
            {
            case "健康涩图":
                r18type = "0";
                break;

            case "R18-健康混合":
                r18type = "2";
                break;

            case "纯R18涩图":
                r18type = "1";
                break;
            }
            var getParam = new ReqParams()
            {
                Timeout = 10000
            };

            if (!string.IsNullOrEmpty(txtProxy.Text))
            {
                getParam.ProxyToUse = new WebProxy(txtProxy.Text);
            }
            string ret = Requests.Get(setuDomain + "/setu?r18=" + r18type, getParam).ToString();

            if (ret != "")
            {
                setuInfo rt = JsonConvert.DeserializeObject <setuInfo>(ret);

                return(rt);
            }
            else
            {
                return(null);
            }
        }