Пример #1
0
    public static void Excute(string id, string type)
    {
        if (!File.Exists(pathBase + id))
        {
        }
        long time = GetTime();

        string now = "";
        string url = string.Format(model, type, id, time, now);

        string data = GetHttpData.GetUrltoHtml(url);

        CheckData();

        StoreFile();
    }
Пример #2
0
    public void LoadByNet()
    {
        lstCode.Clear();
        lstCode2.Clear();
        lstCode3.Clear();
        lstCode4.Clear();

        // 1
        string content = "";

        for (int i = 600000; i < 606999; ++i)
        {
            string code   = string.Format("{0:000000}", i);
            string result = GetHttpData.GetUrltoHtml(ConstData.UrlBaseSina + ConstData.sh + code);
            if (result != null && result.Length > 100)
            {
                lstCode.Add(code);
            }
        }

        for (int i = 0; i < lstCode.Count; ++i)
        {
            content += lstCode[i] + "\t";
        }
        FileOpt.WriteFile(ConstData.IDLstPath, UTF8Encoding.UTF8.GetBytes(content));

        // 2
        content = "";
        for (int i = 000001; i < 001999; ++i)
        {
            string code   = string.Format("{0:000000}", i);
            string result = GetHttpData.GetUrltoHtml(ConstData.UrlBaseSina + ConstData.sz + code);
            if (result != null && result.Length > 100)
            {
                lstCode2.Add(code);
            }
        }

        for (int i = 0; i < lstCode2.Count; ++i)
        {
            content += lstCode2[i] + "\t";
        }
        FileOpt.WriteFile(ConstData.IDLstPath2, UTF8Encoding.UTF8.GetBytes(content));

        // 3
        content = "";
        for (int i = 002000; i < 002999; ++i)
        {
            string code   = string.Format("{0:000000}", i);
            string result = GetHttpData.GetUrltoHtml(ConstData.UrlBaseSina + ConstData.sz + code);
            if (result != null && result.Length > 100)
            {
                lstCode3.Add(code);
            }
        }
        for (int i = 0; i < lstCode3.Count; ++i)
        {
            content += lstCode3[i] + "\t";
        }
        FileOpt.WriteFile(ConstData.IDLstPath3, UTF8Encoding.UTF8.GetBytes(content));

        // 4
        content = "";
        for (int i = 300001; i < 301999; ++i)
        {
            string code   = string.Format("{0:000000}", i);
            string result = GetHttpData.GetUrltoHtml(ConstData.UrlBaseSina + ConstData.sz + code);
            if (result != null && result.Length > 100)
            {
                lstCode4.Add(code);
            }
        }
        for (int i = 0; i < lstCode4.Count; ++i)
        {
            content += lstCode4[i] + "\t";
        }
        FileOpt.WriteFile(ConstData.IDLstPath4, UTF8Encoding.UTF8.GetBytes(content));
    }