private void buttonExportResult_Click(object sender, EventArgs e)
        {
            try
            {
                string        path = Anny.ShowSaveFileDialog();
                StringBuilder sb   = new StringBuilder("");
                sb.Append("搜索引擎").Append("\t")
                .Append("关键字").Append("\t")
                .Append("排位").Append("\t")
                .Append("标题").Append("\t")
                .Append("网址").Append("\r\n");
                foreach (var i in spiders)
                {
                    foreach (var j in i.Ranklist())
                    {
                        sb.Append(j.searchengine).Append("\t")
                        .Append(j.keyword).Append("\t")
                        .Append(j.no).Append("\t")
                        .Append(j.title).Append("\t")
                        .Append(j.ipaddress).Append("\r\n");
                    }
                }
                Anny.SaveToFile(sb.ToString(), path);

                System.Diagnostics.Process.Start(path);
            }
            catch (Exception)
            {
            }
        }
Exemple #2
0
 public void SaveData()
 {
     Anny.SaveToFile(Anny.ToXml(spiderFormulas), Path);
 }
Exemple #3
0
        public MainForm()
        {
            InitializeComponent();

            Instance = this;
            string content = Anny.LoadFile(Path);

            spiderFormulas = Anny.FromXml <List <SpiderFormula> >(content);
            if (spiderFormulas == null)
            {
                spiderFormulas = new List <SpiderFormula>();
                spiderFormulas.Add(new SpiderFormula()
                {
                    ipaddress         = "https://www.baidu.com",
                    keyword           = "石家庄钢化玻璃",
                    searchengine      = "百度",
                    continuepage      = true,
                    continuepagecount = 10,
                    continuepageregex = "",

                    interestcontentregex = "(光辉玻璃|光晖玻璃|光辉钢化|光晖钢化|迪辉玻璃|迪辉钢化)",
                });
                spiderFormulas.Add(new SpiderFormula()
                {
                    ipaddress         = "https://www.baidu.com",
                    keyword           = "石家庄中空玻璃",
                    searchengine      = "百度",
                    continuepage      = true,
                    continuepagecount = 10,
                    continuepageregex = "",

                    interestcontentregex = "(光辉玻璃|光晖玻璃|光辉钢化|光晖钢化|迪辉玻璃|迪辉钢化)",
                });
                spiderFormulas.Add(new SpiderFormula()
                {
                    ipaddress         = "https://www.baidu.com",
                    keyword           = "石家庄夹胶玻璃",
                    searchengine      = "百度",
                    continuepage      = true,
                    continuepagecount = 10,
                    continuepageregex = "",

                    interestcontentregex = "(光辉玻璃|光晖玻璃|光辉钢化|光晖钢化|迪辉玻璃|迪辉钢化)",
                });
                spiderFormulas.Add(new SpiderFormula()
                {
                    ipaddress         = "https://www.baidu.com",
                    keyword           = "正定钢化玻璃",
                    searchengine      = "百度",
                    continuepage      = true,
                    continuepagecount = 10,
                    continuepageregex = "",

                    interestcontentregex = "(光辉玻璃|光晖玻璃|光辉钢化|光晖钢化|迪辉玻璃|迪辉钢化)",
                });
                spiderFormulas.Add(new SpiderFormula()
                {
                    ipaddress         = "https://www.baidu.com",
                    keyword           = "正定中空玻璃",
                    searchengine      = "百度",
                    continuepage      = true,
                    continuepagecount = 10,
                    continuepageregex = "",

                    interestcontentregex = "(光辉玻璃|光晖玻璃|光辉钢化|光晖钢化|迪辉玻璃|迪辉钢化)",
                });
                spiderFormulas.Add(new SpiderFormula()
                {
                    ipaddress         = "https://www.baidu.com",
                    keyword           = "正定夹胶玻璃",
                    searchengine      = "百度",
                    continuepage      = true,
                    continuepagecount = 10,
                    continuepageregex = "",

                    interestcontentregex = "(光辉玻璃|光晖玻璃|光辉钢化|光晖钢化|迪辉玻璃|迪辉钢化)",
                });
                new About().Show();
            }
            UpdateListview();
        }