/// <summary> /// 取得Bundle的下载地址. /// 下载地址:<下载资源用URL>/<BundleID>/<BundleVersion>/<BundleFullName> /// </summary> /// <returns>Bundle的下载地址.</returns> /// <param name="iDownloadInfo">下载信息.</param> public static string GetBundleDownloadBaseURL( DownloadTargetInfo iDownloadInfo) { DownloadServerInfo dlServerInfo = ServersConf.GetInstance().GetDownloadServerInfo(); if (dlServerInfo == null) { return(null); } string downloadBaseUrl = GetDownloadBaseURL(dlServerInfo); string bundleDownloadUrl = downloadBaseUrl; if (TBundleType.Scene == iDownloadInfo.BundleType) { bundleDownloadUrl = string.Format("{0}/{1}", bundleDownloadUrl, UploadList.AssetBundleDirNameOfScenes); } else { bundleDownloadUrl = string.Format("{0}/{1}", bundleDownloadUrl, UploadList.AssetBundleDirNameOfNormal); } // UtilsLog.Info ("GetBundleDownloadBaseURL", "BundleDownloadUrl:{0}", bundleDownloadUrl); return(bundleDownloadUrl); }
/// <summary> /// 取得上传列表文件的下载URL. /// </summary> /// <returns>BundlesInfo的下载URL.</returns> public string GetDownloadUrlOfUploadList() { DownloadServerInfo serverInfo = ServersConf.GetInstance().GetDownloadServerInfo(); string downloadBaseUrl = ServersConf.GetDownloadBaseURL(serverInfo); string JsonFileFullPath = UtilsAsset.GetJsonFilePath <UploadListData>(); int lastIndex = JsonFileFullPath.LastIndexOf("/"); string JsonFileName = JsonFileFullPath.Substring(lastIndex + 1); return(string.Format("{0}/{1}", downloadBaseUrl, JsonFileName)); }
/// <summary> /// 取得下载服务器基础地址. /// 基础地址:<服务器地址>:<端口号> /// </summary> /// <returns>下载服务器基础地址.</returns> /// <param name="iServerInfo">下载服务器信息.</param> public static string GetDwonloadServerPostBaseURL( DownloadServerInfo iServerInfo) { if (string.IsNullOrEmpty(iServerInfo.Url) == true) { return(null); } else { return(iServerInfo.Url); } }
/// <summary> /// 判断下载服务器信息是否有效. /// </summary> /// <returns><c>true</c>, 有效, <c>false</c> 无效.</returns> /// <param name="iServer">下载服务器信息.</param> private bool isDownloadServerValid(DownloadServerInfo iServer) { // 禁用该服务器 if (iServer.Disable == true) { return(false); } // 服务器ID无效 if ((TServerID.Invalid >= iServer.ID) || (TServerID.Max <= iServer.ID)) { return(false); } return(true); }
/// <summary> /// 取得下载服务器传输用URL. /// <服务器地址Url>/<工程名(例:NFF)> /// </summary> /// <returns>下载服务器传输地址.</returns> /// <param name="iServerInfo">下载服务器信息.</param> private static string GetDownloadServerPostURL( DownloadServerInfo iServerInfo) { string serverPostUrl = GetDwonloadServerPostBaseURL(iServerInfo); string rootDir = GetInstance().UploadServer.RootDir; if (false == string.IsNullOrEmpty(rootDir)) { serverPostUrl = string.Format("{0}/{1}", serverPostUrl, rootDir); } if (string.IsNullOrEmpty(serverPostUrl) == true) { return(null); } else { return(string.Format("{0}/{1}", serverPostUrl, BuildInfo.GetInstance().BuildName)); } }
/// <summary> /// 取得下载资源用URL(Ftp格式). /// </summary> /// <returns>下载资源用URL(Ftp格式).</returns> /// <param name="iServerInfo">下载服务器信息.</param> public static string GetDownloadBaseURL( DownloadServerInfo iServerInfo) { string serverPostUrl = GetDownloadServerPostURL(iServerInfo); string downloadBaseUrl = string.Format("http://{0}/bundles", serverPostUrl); // BuildTarget #if UNITY_ANDROID downloadBaseUrl = string.Format("{0}/Android", downloadBaseUrl); #endif #if UNITY_IOS || UNITY_IOS downloadBaseUrl = string.Format("{0}/iOS", downloadBaseUrl); #endif // AppVersion downloadBaseUrl = string.Format("{0}/{1}", downloadBaseUrl, BuildInfo.GetInstance().BuildVersion); // UtilsLog.Info ("GetDownloadBaseURL", "DownloadBaseUrl:{0}", downloadBaseUrl); return(downloadBaseUrl); }