コード例 #1
0
ファイル: Program.cs プロジェクト: Zhushuaijiang/PickEmoticon
        public static void SaveImage(string last_id = "")
        {
            string repsonsestr = HttpHelper.SendGet("http://mobile.shenmeiguan.cn/folder/cherrypick/");

            if (last_id != "")
            {
                repsonsestr = HttpHelper.SendGet("http://mobile.shenmeiguan.cn/folder/cherrypick/?last_id=" + last_id);
            }
            Rootobject rb = JsonConvert.DeserializeObject <Rootobject>(repsonsestr);

            if (rb != null && rb.rt == true)
            {
                //遍历集合创建文件夹
                foreach (List lis in rb.list)
                {
                    string dertory = string.Format(@"C:\PickEmoticon\{0}", lis.folder.name);
                    if (!System.IO.Directory.Exists(dertory))
                    {
                        try
                        {
                            System.IO.Directory.CreateDirectory(dertory);
                        }
                        catch (Exception)
                        {
                            dertory = string.Format(@"C:\PickEmoticon\{0}", DateTime.Now.ToString("yyyyMMddhh24mmss"));
                        }
                    }
                    string detailurl = "http://mobile.shenmeiguan.cn/user/social/" + lis.user.id + "/" + "folder/" + lis.folder.id + "?pagesize=200";
                    repsonsestr = HttpHelper.SendGet(detailurl);
                    Imagedetail imgdetail = JsonConvert.DeserializeObject <Imagedetail>(repsonsestr);
                    if (imgdetail != null && imgdetail.rt == true)
                    {
                        foreach (Emotion em in imgdetail.emotions.ToList())
                        {
                            //根据路径创建图片
                            getimages(dertory, em.url, em.online_id.ToString());
                        }
                    }
                }
                SaveImage(rb.last_id.ToString());
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: Zhushuaijiang/PickEmoticon
        public static void SaveDetailImage(string usrid, string folderid, string dertory, string last_id = "")
        {
            string detailurl = "";

            if (last_id != "")
            {
                detailurl = "http://mobile.shenmeiguan.cn/user/social/" + usrid + "/" + "folder/" + folderid + "?pagesize=30&last_id=" + last_id;
            }
            else
            {
                detailurl = "http://mobile.shenmeiguan.cn/user/social/" + usrid + "/" + "folder/" + folderid + "?pagesize=30";
            }
            string      repsonsestr = HttpHelper.SendGet(detailurl);
            Imagedetail imgdetail   = JsonConvert.DeserializeObject <Imagedetail>(repsonsestr);

            if (imgdetail != null && imgdetail.rt == true)
            {
                foreach (Emotion em in imgdetail.emotions.ToList())
                {
                    //根据路径创建图片
                    getimages(dertory, em.url, em.online_id.ToString());
                }
            }
        }