示例#1
0
文件: Note.cs 项目: zipsoon/EmuchSign
        //加载记事本
        private void Read(CookieCollection ccl2, string emuchid)
        {
            string content = "";

            try
            {
                string url = "http://emuch.net/bbs/space.php?uid=" + emuchid + "&view=notebook";
                Dictionary <CookieCollection, string> dic_note = new Dictionary <CookieCollection, string>();
                dic_note = ch.GetResponsesDomain(url, "get", "", "application/x-www-form-urlencoded", "gbk", ccl2);
                string html_note = "";
                foreach (var item in dic_note)
                {
                    html_note = item.Value;
                }
                Regex         r           = new Regex("99%;\">[^<]+[^>]+");
                List <string> lst_OldNote = rm.GetAims(html_note, r);
                if (lst_OldNote.Count == 1)
                {
                    content = lst_OldNote[0].Replace("99%;\">", "")
                              .Replace("</textarea", "");
                }
                rtxtNote.Text = content;
            }
            catch (Exception)
            {
                rtxtNote.Text = "* 读取错误";
            }
        }
示例#2
0
        public void ExqueryBlogImg(List <string> lst)
        {
            rtxtLog.Focus();
            for (int i = 0; i < lst.Count; i++)
            {
                string path = lst[i];

                StreamReader sr    = new StreamReader(path);
                string[]     files = path.Split(Convert.ToChar("\\"));
                string       file  = files[files.Length - 1].Replace(".html", "");

                string        article = sr.ReadToEnd();
                Regex         r       = new Regex("http://img[0-9]{1}.ph.126.net/[^\"]+");
                List <string> lstPics = rm.GetAims(article, r);

                for (int j = 0; j < lstPics.Count; j++)
                {
                    string[] urls     = lstPics[j].Split(Convert.ToChar("/"));
                    string   picname  = urls[urls.Length - 1];
                    string   filepath = "img/" + file + "/" + picname;
                    if (!Directory.Exists("img/" + file))
                    {
                        Directory.CreateDirectory("img/" + file);
                    }
                    //if (!Directory.Exists("img"))
                    //{
                    //    Directory.CreateDirectory("img");
                    //}
                    DownImage(lstPics[j], picname, filepath);

                    //try
                    //{
                    //    Image img = ch.GetResponseImage(lstPics[j], "image/png");
                    //    img.Save(filepath);
                    //    rtxtLog.AppendText(filepath + " 成功\n");
                    //}
                    //catch (Exception err)
                    //{
                    //    rtxtLog.AppendText(filepath + " 失败\n");
                    //}
                }
            }
        }
示例#3
0
        public string GetCoin(CookieCollection ccl2, string html2)
        {
            Regex         r_coin   = new Regex(@"<u>金币: [^<]+");
            List <string> lst_coin = new List <string>();

            lst_coin = rm.GetAims(html2, r_coin);
            if (lst_coin.Count >= 1)
            {
                return(lst_coin[0].Replace("<u>", ""));
            }
            return(null);
        }