Пример #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
    IEnumerator ConfirmRecords()
    {
        GameObject  phd         = (GameObject)Instantiate(Resources.Load("HttpData/GetHttpData"));
        GetHttpData getHttpData = phd.GetComponent <GetHttpData>();

        getHttpData.GetData(ServerURL.BaseUrl + "records/?format=json");

        while (true)
        {
            yield return(new WaitForSeconds(0.1f));

            if (getHttpData.jsonString == "")
            {
                continue;
            }
            else
            {
                break;
            }
        }


        RecordData[] records = JsonHelper.FromJson <RecordData>(getHttpData.jsonString);

        int recordLen = records.Length, nearLen = Near.Length;

        if (recordLen >= 1)
        {
            First.GetComponent <RenderUserRank>().SetText("1st", records[0].user, records[0].Score.ToString());
        }

        if (recordLen >= 2)
        {
            Second.GetComponent <RenderUserRank>().SetText("2nd", records[1].user, records[1].Score.ToString());
        }

        if (recordLen >= 3)
        {
            Third.GetComponent <RenderUserRank>().SetText("3rd", records[2].user, records[2].Score.ToString());
        }

        for (int i = 0; (i + specialRankerLen < recordLen) && i < nearLen; i++)
        {
            Near[i].GetComponent <RenderUserRank>().SetText((i + specialRankerLen + 1).ToString() + "th", records[i + specialRankerLen].user, records[i + specialRankerLen].Score.ToString());
        }
    }
Пример #3
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));
    }