Пример #1
0
        public void main()
        {
            StreamReader keysr = new StreamReader(textBox1.Text, EncodingType.GetTxtType(textBox1.Text));

            string ReadTxt = keysr.ReadToEnd();

            string[] text = ReadTxt.Split(new string[] { "\r\n" }, StringSplitOptions.None);

            foreach (string uid in text)
            {
                if (uid != "")
                {
                    this.uid    = uid;
                    label1.Text = "正在查询:" + uid;
                    status      = false;
                    webBrowser1.Navigate("https://market.m.taobao.com/app/find-like/find-like/pages/index?&appid=9709&nid=" + uid);


                    while (this.status == false)
                    {
                        Application.DoEvents();//如果loader是false表明正在加载,,则Application.DoEvents()意思就是处理其他消息。阻止当前的队列继续执行。
                    }

                    while (zanting == false)
                    {
                        Application.DoEvents();//如果loader是false表明正在加载,,则Application.DoEvents()意思就是处理其他消息。阻止当前的队列继续执行。
                    }
                    Thread.Sleep(3000);
                }
            }

            label1.Text = "查询结束";
            MessageBox.Show("查询结束");
        }
Пример #2
0
        public void run()
        {
            StreamReader keysr = new StreamReader(textBox1.Text, EncodingType.GetTxtType(textBox1.Text));

            string ReadTxt = keysr.ReadToEnd();

            string[] text = ReadTxt.Split(new string[] { "\r\n" }, StringSplitOptions.None);

            foreach (string aid in text)
            {
                string shangshi = "否";
                if (aid == "")
                {
                    ListViewItem listViewItem1 = this.listView2.Items.Add((listView2.Items.Count + 1).ToString());
                    listViewItem1.SubItems.Add("-");
                    listViewItem1.SubItems.Add("-");
                    listViewItem1.SubItems.Add("-");
                    listViewItem1.SubItems.Add("-");
                    listViewItem1.SubItems.Add("-");
                    listViewItem1.SubItems.Add("-");

                    continue;
                }

                string Url = "https://api9.tianyancha.com/services/v3/t/common/baseinfoV5/" + aid;

                string html = GetUrl(Url);  //定义的GetRul方法 返回 reader.ReadToEnd()

                if (html.Contains("上市信息"))
                {
                    shangshi = "是";
                }
                Match name = Regex.Match(html, @"""name"":""([\s\S]*?)""");
                Match time = Regex.Match(html, @"""estiblishTime"":([\s\S]*?),");

                Match ziben = Regex.Match(html, @"""regCapital"":""([\s\S]*?)""");
                Match yewu  = Regex.Match(html, @"""businessScope"":""([\s\S]*?)""");

                ListViewItem listViewItem = this.listView2.Items.Add((listView2.Items.Count + 1).ToString());
                listViewItem.SubItems.Add(aid);
                listViewItem.SubItems.Add(name.Groups[1].Value);
                listViewItem.SubItems.Add(ConvertStringToDateTime(time.Groups[1].Value).ToLongDateString());
                listViewItem.SubItems.Add(ziben.Groups[1].Value);
                listViewItem.SubItems.Add(shangshi);
                listViewItem.SubItems.Add(yewu.Groups[1].Value);

                Application.DoEvents();
                Thread.Sleep(10);

                while (this.zanting == false)
                {
                    Application.DoEvents();//如果loader是false表明正在加载,,则Application.DoEvents()意思就是处理其他消息。阻止当前的队列继续执行。
                }
            }
        }
Пример #3
0
        private void button6_Click(object sender, EventArgs e)
        {
            bool flag = this.openFileDialog1.ShowDialog() == DialogResult.OK;

            if (flag)
            {
                StreamReader sr = new StreamReader(this.openFileDialog1.FileName, EncodingType.GetTxtType(this.openFileDialog1.FileName));
                //一次性读取完
                string texts = sr.ReadToEnd();

                string[] text = texts.Split(new string[] { "\r\n" }, StringSplitOptions.None);

                for (int i = 0; i < text.Length; i++)
                {
                    textBox1.Text += text[i] + "\r\n";
                }
            }
        }
Пример #4
0
        public void run()
        {
            StreamReader sr = new StreamReader(textBox1.Text, EncodingType.GetTxtType(textBox1.Text));
            //一次性读取完
            string texts = sr.ReadToEnd();

            //string[] text = texts.Split(new string[] { "\r\n" }, StringSplitOptions.None);

            //for (int i = 0; i < text.Length; i++)
            //{

            //    ListViewItem lv1 = listView1.Items.Add(listView1.Items.Count.ToString()); //使用Listview展示数据
            //    lv1.SubItems.Add(text[i]);


            //}

            MatchCollection names = Regex.Matches(texts, @"客户姓名:.*");
            MatchCollection codes = Regex.Matches(texts, @"营销站点:.*");
            MatchCollection tels  = Regex.Matches(texts, @"客户电话:.*");
            MatchCollection times = Regex.Matches(texts, @"营销时间:.*");

            for (int i = 0; i < names.Count; i++)
            {
                string cardno = getcardcode();

                string       name = names[i].Groups[0].Value.Replace("客户姓名:", "").Trim();
                string       code = Regex.Match(codes[i].Groups[0].Value, @"\d{5,}").Groups[0].Value.Trim();
                string       tel  = tels[i].Groups[0].Value.Replace("客户电话:", "").Trim();
                string       time = times[i].Groups[0].Value.Replace("营销时间:", "").Replace(":", "").Replace("-", "").Replace(" ", "").Trim();
                ListViewItem lv1  = listView1.Items.Add(name); //使用Listview展示数据
                string       url  = "http://219.146.167.66:2100/qdyx/bg/m/ReadCardResult.aspx?CPhone=" + tel + "&UNum=" + code + "&ITime=" + time + "&UType=1&UCardID=" + cardno + "&UName=" + name + "&UAddress=" + textBox9.Text.Trim() + "&UNational=汉族";
                string       html = GetUrl(url);
                Match        msg  = Regex.Match(html, @"alert\('([\s\S]*?)'");
                lv1.SubItems.Add(msg.Groups[1].Value);
                Thread.Sleep(Convert.ToInt32(textBox10.Text));
            }
        }
Пример #5
0
        public void run()
        {
            if (radioButton3.Checked == true)
            {
                keysr = new StreamReader(textBox3.Text, EncodingType.GetTxtType(textBox3.Text));

                ReadTxt = keysr.ReadToEnd();
            }

            string        path   = textBox1.Text;
            DirectoryInfo folder = new DirectoryInfo(path);
            int           c      = folder.GetFiles("*.txt").Count();

            for (int i = 0; i < c; i++)
            {
                try
                {
                    label4.Text = "共" + c + "已处理:" + (i + 1);
                    string fullname = folder.GetFiles("*.txt")[i].FullName;
                    // textBox4.Text += "正在处理:" + fullname + "\r\n";
                    StringBuilder sb = new StringBuilder();

                    String ReadTxt;

                    StreamReader sr = new StreamReader(fullname, EncodingType.GetTxtType(fullname));

                    ReadTxt = sr.ReadToEnd();


                    //首先判断是否有img
                    if (ReadTxt.Contains("img"))
                    {
                        string[] FileRead = ReadTxt.Split(new string[] { "\r\n" }, StringSplitOptions.None);
                        foreach (String ReadLine in FileRead)
                        {
                            string key = chuli(fullname);
                            if (key == "")
                            {
                                key = Path.GetFileNameWithoutExtension(fullname);
                            }
                            string linevalue = ReadLine;
                            if (ReadLine.Contains("img"))
                            {
                                if (checkBox1.Checked == true && !ReadLine.Contains("title"))
                                {
                                    linevalue = linevalue.Replace("web_uri", "title=\"" + key + "\"  web_uri");
                                }
                                if (checkBox2.Checked == true && !ReadLine.Contains("alt"))
                                {
                                    linevalue = linevalue.Replace("web_uri", "alt=\"" + key + "\"  web_uri");
                                }

                                sb.AppendLine(linevalue);
                            }
                            else
                            {
                                sb.AppendLine(ReadLine);
                            }
                        }
                        sr.Close();
                        sr.Dispose();
                        StreamWriter sw = new StreamWriter(fullname);

                        sw.Write(sb.ToString());

                        sw.Close();
                        sw.Dispose();
                    }
                }

                catch (Exception ex)
                {
                    continue;
                }
            }

            MessageBox.Show("处理结束");
            keysr.Close();
            keysr.Dispose();
        }
Пример #6
0
        public void run()
        {
            if (textBox1.Text == "" || textBox2.Text == "")
            {
                MessageBox.Show("请选择文件路径");
                return;
            }

            StreamReader sr = new StreamReader(textBox2.Text.Trim(), EncodingType.GetTxtType(textBox2.Text.Trim()));
            //一次性读取完
            string texts = sr.ReadToEnd();

            sr.Close();
            string[] text = texts.Split(new string[] { "\r\n" }, StringSplitOptions.None);

            for (int i = 0; i < text.Length; i++)
            {
                string url = text[i];

                textBox3.Text = "正在下载:" + url + "\r\n";
                string html = GetUrl(url, "utf-8");

                string id           = Regex.Match(html, @"globalArtworkId = '([\s\S]*?)'").Groups[1].Value;
                string suoluetu     = Regex.Match(html, @"image"" content=""([\s\S]*?)""").Groups[1].Value;
                string widthmedium  = Regex.Match(html, @"widthmedium =([\s\S]*?);").Groups[1].Value;
                string heightmedium = Regex.Match(html, @"heightmedium =([\s\S]*?);").Groups[1].Value;

                int          width  = Convert.ToInt32(widthmedium);
                int          height = Convert.ToInt32(heightmedium);
                ListViewItem lv1    = listView1.Items.Add(listView1.Items.Count.ToString());  //使用Listview展示数据
                lv1.SubItems.Add(url);
                downloadFile(suoluetu, textBox1.Text + "//" + id + "//", id + ".jpg", "");
                for (int x = 0; x < width; x = x + 100)
                {
                    for (int y = 0; y < height; y = y + 100)
                    {
                        string imgurl = "https://render.fineartamerica.com/previewhighresolutionimage.php?artworkid=" + id + "&widthmedium=" + widthmedium + "&heightmedium=" + heightmedium + "&x=" + x + "&y=" + y + "&domainUrl=fineartamerica.com";
                        try
                        {
                            textBox3.Text += "正在下载:" + x + "_" + y + ".jpg" + "\r\n";


                            //downloadFile(imgurl,textBox1.Text+"//"+id+"//",id+"_"+x+"_"+y+".jpg","");
                            GetImage(imgurl, textBox1.Text + "//" + id + "//" + id + "_" + x + "_" + y + ".jpg");
                        }


                        catch (Exception ex)
                        {
                            dics.Add(imgurl, textBox1.Text + "//" + id + "//" + id + "_" + x + "_" + y + ".jpg");
                            continue;
                        }
                    }
                }

                while (dics.Count != 0)
                {
                    for (int a = 0; a < dics.Count; i++)
                    {
                        Thread.Sleep(1000);
                        try
                        {
                            GetImage(dics.ElementAt(a).Key, dics.ElementAt(a).Value);
                            dics.Remove(dics.ElementAt(a).Key);
                        }
                        catch (Exception)
                        {
                            if (!dics.ContainsKey(dics.ElementAt(a).Key))
                            {
                                dics.Add(dics.ElementAt(a).Key, dics.ElementAt(a).Value);
                            }
                            continue;
                        }
                    }
                }
                lv1.SubItems.Add("完成");

                if (status == false)
                {
                    return;
                }


                Thread.Sleep(1000);
            }
        }