private List <string> getCityList(DateTime start)
        {
            List <string> cityList     = new List <string>();
            List <string> tempcityList = new List <string>();

            for (int j = 0; j < 2; j++)
            {
                int pageNo = 1;
                tempcityList = new List <string>();
                start        = start.AddDays(-7 * j);
                List <string[]> dayData    = null;
                int             uablecount = 0;
                do
                {
                    dayData = null;
                    dayData = EnvironmentalData.getDayData(pageNo, "", start, start);
                    if (dayData == null)
                    {
                        //页数;城市;开始时间;结束时间;
                        uablecount++;
                        continue;
                    }
                    else if (dayData.Count == 0)
                    {
                        uablecount++;
                        continue;
                    }
                    for (int i = 0; i < dayData.Count; i++)
                    {
                        tempcityList.Add(string.Format("{0};{1}", dayData[i][1], dayData[i][6]));
                    }
                    pageNo++;
                    GC.Collect();
                } while (uablecount <= 2);
                if (cityList.Count < 1)
                {
                    cityList = tempcityList;
                }
                else
                {
                    cityList = (tempcityList.Count > cityList.Count ? tempcityList : cityList);
                }
            }
            return(cityList);
        }
        private void getDayDataFromFile(List <string> param, string pathfile)
        {
            //页数;城市;开始时间;结束时间;
            string       filename = Path.GetFileNameWithoutExtension(pathfile);
            StreamWriter sw1      = new StreamWriter(Path.GetDirectoryName(pathfile) + "\\" + filename + "errHtmlBuchong" + DateTime.Now.Millisecond.ToString() + ".txt", true);
            StreamWriter sw       = new StreamWriter(pathfile, true);

            foreach (var item in param)
            {
                string[] pCity = item.Split(new string[] { ";" }, StringSplitOptions.None);
                if (pCity.Length == 4)
                {
                    DateTime start  = Convert.ToDateTime(pCity[2]);
                    DateTime end    = Convert.ToDateTime(pCity[3]);
                    int      pageno = 1;
                    if (start != null & end != null & int.TryParse(pCity[0], out pageno))
                    {
                        List <string[]> dayData = null;
                        dayData = EnvironmentalData.getDayData(pageno, pCity[1], start, end);
                        if (dayData == null)
                        {
                            //页数;城市;开始时间;结束时间;
                            sw1.WriteLine(pageno + ";" + pCity[1] + ";" + start.ToString() + ";" + end.ToString());
                            continue;
                        }

                        for (int i = 0; i < dayData.Count; i++)
                        {
                            for (int j = 0; j < dayData[i].Length; j++)
                            {
                                sw.Write(dayData[i][j] + ";");
                            }
                            sw.WriteLine();
                        }
                    }
                }
            }
            sw1.Close();
            sw.Close();
        }
        private void getDayData(DateTime start, DateTime end, string pathfile, List <string> city = null)
        {
            int pageNo = 1;

            using (StreamWriter sw = new StreamWriter(pathfile, true))
            {
                string          filename = Path.GetFileNameWithoutExtension(pathfile);
                StreamWriter    sw1      = new StreamWriter(Path.GetDirectoryName(pathfile) + "\\" + filename + "errHtml" + DateTime.Now.Millisecond.ToString() + ".txt", true);
                List <string[]> dayData  = null;
                if (city == null || city.Count < 1)
                {
                    int uablecount = 0;
                    do
                    {
                        dayData = EnvironmentalData.getDayData(pageNo, "", start, end);
                        if (dayData == null)
                        {
                            //页数;城市;开始时间;结束时间;
                            sw1.WriteLine(pageNo + ";" + city + ";" + start.ToString() + ";" + end.ToString());
                            uablecount++;
                            continue;
                        }
                        else if (dayData.Count == 0)
                        {
                            uablecount++;
                            continue;
                        }
                        for (int i = 0; i < dayData.Count; i++)
                        {
                            for (int j = 0; j < dayData[i].Length; j++)
                            {
                                sw.Write(dayData[i][j] + ";");
                            }
                            sw.WriteLine();
                        }
                        pageNo++;
                        GC.Collect();
                    } while (uablecount <= 5);
                }
                else
                {
                    foreach (var item in city)
                    {
                        int uablecount = 0;
                        do
                        {
                            dayData = EnvironmentalData.getDayData(pageNo, item, start, end);
                            if (dayData == null)
                            {
                                //页数;城市;开始时间;结束时间;
                                sw1.WriteLine(pageNo + ";" + city + ";" + start.ToString() + ";" + end.ToString());
                                uablecount++;
                                continue;
                            }
                            else if (dayData.Count == 0)
                            {
                                uablecount++;
                                continue;
                            }
                            for (int i = 0; i < dayData.Count; i++)
                            {
                                for (int j = 0; j < dayData[i].Length; j++)
                                {
                                    sw.Write(dayData[i][j] + ";");
                                }
                                sw.WriteLine();
                            }
                            pageNo++;
                            GC.Collect();
                        } while (uablecount <= 5);
                    }
                }
                sw1.Close();
                sw.Close();
            }
        }