Esempio n. 1
0
        //public bool ShowExplicit { get; set; }

        //public virtual bool IsSupportCount { get { return true; } }
        //public virtual bool IsSupportScore { get { return true; } }
        //public virtual bool IsSupportRes { get { return true; } }
        //public virtual bool IsSupportPreview { get { return true; } }
        //public virtual bool IsSupportJpeg { get { return true; } }
        //public virtual bool IsSupportTag { get { return true; } }

        //public virtual System.Drawing.Point LargeImgSize { get { return new System.Drawing.Point(SWIDTH, SWIDTH); } }
        //public virtual System.Drawing.Point SmallImgSize { get { return new System.Drawing.Point(SWIDTH, SHEIGHT); } }

        /// <summary>
        /// get images sync
        /// </summary>
        //public virtual List<Img> GetImages(int page, int count, string keyWord, int maskScore, int maskRes, ViewedID lastViewed, bool maskViewed, System.Net.IWebProxy proxy, bool showExplicit)
        //{
        //    return GetImages(GetPageString(page, count, keyWord, proxy), maskScore, maskRes, lastViewed, maskViewed, proxy, showExplicit);
        //}

        public override string GetPageString(int page, int count, string keyWord, System.Net.IWebProxy proxy)
        {
            string url = string.Format(siteUrl, needMinus ? page - 1 : page, count, keyWord);

            if (keyWord.Length == 0)
            {
                url = url.Substring(0, url.Length - 6);
            }

            /*
             *  System.Net.HttpWebRequest req = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url);
             * req.UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)";
             * req.Proxy = proxy;
             * req.Timeout = 8000;
             * req.Method = "GET";
             * req.ReadWriteTimeout = 8000;
             * req.KeepAlive = true;
             * req.UseDefaultCredentials = true;
             * //prevent 303 See Other
             * req.AllowAutoRedirect = true;
             *          System.Net.WebResponse rsp = req.GetResponse();
             */

            MoeLoader.MyWebClient web = new MoeLoader.MyWebClient();
            web.Proxy = proxy;

            web.Encoding = Encoding.UTF8;
            //Debug.WriteLine("======>DownloadString ==========>" + url);
            url = "https://yande.re/";
            string pageString = web.DownloadString(url);

            web.Dispose();

            return(pageString);
        }
Esempio n. 2
0
        //public bool ShowExplicit { get; set; }

        //public virtual bool IsSupportCount { get { return true; } }
        //public virtual bool IsSupportScore { get { return true; } }
        //public virtual bool IsSupportRes { get { return true; } }
        //public virtual bool IsSupportPreview { get { return true; } }
        //public virtual bool IsSupportJpeg { get { return true; } }
        //public virtual bool IsSupportTag { get { return true; } }

        //public virtual System.Drawing.Point LargeImgSize { get { return new System.Drawing.Point(SWIDTH, SWIDTH); } }
        //public virtual System.Drawing.Point SmallImgSize { get { return new System.Drawing.Point(SWIDTH, SHEIGHT); } }

        /// <summary>
        /// get images sync
        /// </summary>
        //public virtual List<Img> GetImages(int page, int count, string keyWord, int maskScore, int maskRes, ViewedID lastViewed, bool maskViewed, System.Net.IWebProxy proxy, bool showExplicit)
        //{
        //    return GetImages(GetPageString(page, count, keyWord, proxy), maskScore, maskRes, lastViewed, maskViewed, proxy, showExplicit);
        //}

        public override string GetPageString(int page, int count, string keyWord, System.Net.IWebProxy proxy)
        {
            string url = string.Format(siteUrl, needMinus ? page - 1 : page, count, keyWord);
            if (keyWord.Length == 0)
            {
                url = url.Substring(0, url.Length - 6);
            }

            MoeLoader.MyWebClient web = new MoeLoader.MyWebClient();
            web.Proxy = proxy;

            web.Encoding = Encoding.UTF8;
            string pageString = web.DownloadString(url);
            web.Dispose();

            return pageString;
        }
Esempio n. 3
0
        public override List <MoeLoader.TagItem> GetTags(string word, System.Net.IWebProxy proxy)
        {
            List <MoeLoader.TagItem> re = new List <MoeLoader.TagItem>();

            string url = string.Format(tagUrl, 8, word);

            MoeLoader.MyWebClient web = new MoeLoader.MyWebClient();
            web.Timeout  = 8;
            web.Proxy    = proxy;
            web.Encoding = Encoding.UTF8;

            string xml = web.DownloadString(url);


            //<?xml version="1.0" encoding="UTF-8"?>
            //<tags type="array">
            //  <tag type="3" ambiguous="false" count="955" name="neon_genesis_evangelion" id="270"/>
            //  <tag type="3" ambiguous="false" count="335" name="angel_beats!" id="26272"/>
            //  <tag type="3" ambiguous="false" count="214" name="galaxy_angel" id="243"/>
            //  <tag type="3" ambiguous="false" count="58" name="wrestle_angels_survivor_2" id="34664"/>
            //</tags>

            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.LoadXml(xml.ToString());

            XmlElement root = (XmlElement)(xmlDoc.SelectSingleNode("tags")); //root

            foreach (XmlNode node in root.ChildNodes)
            {
                XmlElement tag = (XmlElement)node;

                string name  = tag.GetAttribute("name");
                string count = tag.GetAttribute("count");

                re.Add(new MoeLoader.TagItem()
                {
                    Name = name, Count = count
                });
            }

            return(re);
        }
Esempio n. 4
0
        //public bool ShowExplicit { get; set; }

        //public virtual bool IsSupportCount { get { return true; } }
        //public virtual bool IsSupportScore { get { return true; } }
        //public virtual bool IsSupportRes { get { return true; } }
        //public virtual bool IsSupportPreview { get { return true; } }
        //public virtual bool IsSupportJpeg { get { return true; } }
        //public virtual bool IsSupportTag { get { return true; } }

        //public virtual System.Drawing.Point LargeImgSize { get { return new System.Drawing.Point(SWIDTH, SWIDTH); } }
        //public virtual System.Drawing.Point SmallImgSize { get { return new System.Drawing.Point(SWIDTH, SHEIGHT); } }

        /// <summary>
        /// get images sync
        /// </summary>
        //public virtual List<Img> GetImages(int page, int count, string keyWord, int maskScore, int maskRes, ViewedID lastViewed, bool maskViewed, System.Net.IWebProxy proxy, bool showExplicit)
        //{
        //    return GetImages(GetPageString(page, count, keyWord, proxy), maskScore, maskRes, lastViewed, maskViewed, proxy, showExplicit);
        //}

        public override string GetPageString(int page, int count, string keyWord, System.Net.IWebProxy proxy)
        {
            string url = string.Format(siteUrl, needMinus ? page - 1 : page, count, keyWord);

            if (keyWord.Length == 0)
            {
                url = url.Substring(0, url.Length - 6);
            }

            MoeLoader.MyWebClient web = new MoeLoader.MyWebClient();
            web.Proxy = proxy;

            web.Encoding = Encoding.UTF8;
            string pageString = web.DownloadString(url);

            web.Dispose();

            return(pageString);
        }
Esempio n. 5
0
        public override List<MoeLoader.TagItem> GetTags(string word, System.Net.IWebProxy proxy)
        {
            List<MoeLoader.TagItem> re = new List<MoeLoader.TagItem>();

            string url = string.Format(tagUrl, 8, word);
            MoeLoader.MyWebClient web = new MoeLoader.MyWebClient();
            web.Timeout = 8;
            web.Proxy = proxy;
            web.Encoding = Encoding.UTF8;

            string xml = web.DownloadString(url);


            //<?xml version="1.0" encoding="UTF-8"?>
            //<tags type="array">
            //  <tag type="3" ambiguous="false" count="955" name="neon_genesis_evangelion" id="270"/>
            //  <tag type="3" ambiguous="false" count="335" name="angel_beats!" id="26272"/>
            //  <tag type="3" ambiguous="false" count="214" name="galaxy_angel" id="243"/>
            //  <tag type="3" ambiguous="false" count="58" name="wrestle_angels_survivor_2" id="34664"/>
            //</tags>

            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.LoadXml(xml.ToString());

            XmlElement root = (XmlElement)(xmlDoc.SelectSingleNode("tags")); //root

            foreach (XmlNode node in root.ChildNodes)
            {
                XmlElement tag = (XmlElement)node;

                string name = tag.GetAttribute("name");
                string count = tag.GetAttribute("count");

                re.Add(new MoeLoader.TagItem() { Name = name, Count = count });
            }

            return re;
        }