示例#1
0
        /// <summary>
        /// 创建Downloader.
        /// </summary>
        /// <param name="iTargetInfo">下载目标.</param>
        /// <param name="iOnStart">开始委托回调.</param>
        /// <param name="iOnSuccessed">成功委托回调.</param>
        /// <param name="iOnFailed">失败委托回调.</param>
        /// <param name="iRetries">重下载次数.</param>
        /// <param name="iTimeOut">超时时间(单位:秒).</param>
        public static HttpDownloader Create(
            DownloadTargetInfo iTargetInfo, OnStart iOnStart,
            OnSuccessed iOnSuccessed, OnFailed iOnFailed)
        {
            HttpDownloader downloader = new HttpDownloader();

            if (downloader != null)
            {
                // 初始化
                downloader.Init(iTargetInfo, iOnStart, iOnSuccessed, iOnFailed);
                return(downloader);
            }
            else
            {
                UtilsLog.Error("Create", "Downloader Create failed!!");
                return(null);
            }
        }
示例#2
0
        /// <summary>
        /// 创建Downloader(Http).
        /// </summary>
        /// <param name="iDownloadUrl">下载Url.</param>
        /// <param name="iOnStart">开始事件委托.</param>
        /// <param name="iOnSuccessed">成功事件委托.</param>
        /// <param name="iOnFailed">失败事件委托.</param>
        /// <param name="iType">下载对象类型.</param>
        public static HttpDownloader Create(
            string iDownloadUrl, OnStart iOnStart,
            OnSuccessedByUrl iOnSuccessed, OnFailedByUrl iOnFailed,
            TargetType iType = TargetType.Bundle)
        {
            HttpDownloader downloader = new HttpDownloader();

            if (downloader != null)
            {
                downloader.Init(iDownloadUrl, iOnStart, iOnSuccessed, iOnFailed, iType);
                return(downloader);
            }
            else
            {
                UtilsLog.Error("Create", "Downloader Create failed!!");
                return(null);
            }
        }