Beispiel #1
0
    void test_DownloadResource(ConfigResponse res)
    {
        configLoading.SetDescribe(Core.Data.stringManager.getString(9027));
        configLoading.ShowLoading(0);

        HttpDownloadTask task = new HttpDownloadTask(ThreadType.MainThread, TaskResponse.Igonre_Response);

        string url  = res.url;
        string fn   = "Config.zip";
        string path = DeviceInfo.PersistRootPath;

        Debug.Log("path=" + path);
        long size = res.size;

        task.AppendDownloadParam(url, fn, path, res.md5, size);

        task.DownloadStart += (string durl) => { ConsoleEx.DebugLog("Download starts and url = " + durl); };

        task.taskCompeleted += () => { ConsoleEx.DebugLog("Download success."); };
        task.afterCompleted += testDownloadResp;
        task.ErrorOccured   += (s, t) => { step = LoginStep.Download_ERROR; ConsoleEx.DebugLog("Download failure."); };

        task.Report += (cur, total) => {
            ConsoleEx.DebugLog("current Bytes = " + cur + ", total Bytes = " + total);
            configLoading.ShowLoading((float)cur / (float)total);
        };

        task.DispatchToRealHandler();
    }
Beispiel #2
0
    void test_DownloadResource(string md5)
    {
        HttpDownloadTask task = new HttpDownloadTask(ThreadType.MainThread, TaskResponse.Igonre_Response);

        string url  = @"http://192.168.1.110:10000/ball/www/image/60101-3.jpg";
        string fn   = "60101-3.jpg";
        string path = Core.Data.guideManger.getBasePath();
        long   size = 103234;

        task.AppendDownloadParam(url, fn, path, md5, size);

        task.DownloadStart += (string durl) => { ConsoleEx.DebugLog("Download starts and url = " + durl); };

        task.taskCompeleted += () => { ConsoleEx.DebugLog("Download success."); };
        task.afterCompleted += testDownloadResp;
        task.ErrorOccured   += (s, t) => { ConsoleEx.DebugLog("Download failure."); };

        task.Report += (cur, total) => { ConsoleEx.DebugLog("current Bytes = " + cur + ", total Bytes = " + total); };

        task.DispatchToRealHandler();
    }
Beispiel #3
0
    void test_DownloadResource()
    {
        HttpDownloadTask task = new HttpDownloadTask(ThreadType.MainThread, TaskResponse.Igonre_Response);
        string           url  = @"http://zhangyuntao.com.cn/phpMyAdmin-4.1.0-all-languages.zip";
        string           fn   = "license.zip";
        string           path = DeviceInfo.PersistRootPath;
        string           md5  = "test md5";
        long             size = 103234;

        task.AppendDownloadParam(url, fn, path, md5, size);

        task.DownloadStart += (string durl) => { ConsoleEx.DebugLog("Download starts and url = " + durl); };

        task.taskCompeleted += () => { ConsoleEx.DebugLog("Download success."); };
        task.afterCompleted += testDownloadResp;
        task.ErrorOccured   += (s, t) => { ConsoleEx.DebugLog("Download failure."); };

        task.Report += (cur, total) => { ConsoleEx.DebugLog("current Bytes = " + cur + ", total Bytes = " + total); };

        task.DispatchToRealHandler();
    }