private WebFileRequest CreateDownloader(PatchBundle patchBundle) { // 注意:资源版本号只用于确定下载路径 string mainURL = _patcherMgr.GetPatchDownloadURL(patchBundle.Version, patchBundle.Hash); string fallbackURL = _patcherMgr.GetPatchDownloadFallbackURL(patchBundle.Version, patchBundle.Hash); string savePath = PatchHelper.MakeSandboxCacheFilePath(patchBundle.Hash); FileUtility.CreateFileDirectory(savePath); // 创建下载器 MotionLog.Log($"Beginning to download web file : {patchBundle.BundleName} URL : {mainURL}"); WebFileRequest download = WebFileSystem.GetWebFileRequest(mainURL, fallbackURL, savePath, _failedTryAgain); download.UserData = patchBundle; return(download); }
private string GetRequestURL(bool ignoreResrouceVersion, int resourceVersion, string fileName) { string url; // 轮流返回请求地址 if (_requestCount % 2 == 0) { url = _patcher.GetPatchDownloadFallbackURL(resourceVersion, fileName); } else { url = _patcher.GetPatchDownloadURL(resourceVersion, fileName); } // 注意:在URL末尾添加时间戳 if (ignoreResrouceVersion) { url = $"{url}?{System.DateTime.UtcNow.Ticks}"; } return(url); }