Update download system

增加证书认证方法
pull/51/head
hevinci 2022-10-21 15:18:16 +08:00
parent a6de89ab74
commit f9ecad1cf0
3 changed files with 23 additions and 1 deletions

View File

@ -2,6 +2,7 @@
using System.IO;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.Networking;
namespace YooAsset
{
@ -15,6 +16,12 @@ namespace YooAsset
private static readonly Dictionary<string, DownloaderBase> _downloaderDic = new Dictionary<string, DownloaderBase>();
private static readonly List<string> _removeList = new List<string>(100);
/// <summary>
/// 自定义的证书认证实例
/// </summary>
public static CertificateHandler CertificateHandlerInstance;
/// <summary>
/// 启用断点续传功能文件的最小字节数
/// </summary>

View File

@ -89,6 +89,12 @@ namespace YooAsset
_downloadHandle = handler;
#endif
if (DownloadSystem.CertificateHandlerInstance != null)
{
_webRequest.certificateHandler = DownloadSystem.CertificateHandlerInstance;
_webRequest.disposeCertificateHandlerOnDispose = false;
}
_webRequest.downloadHandler = handler;
_webRequest.disposeDownloadHandlerOnDispose = true;
if (fileLength > 0)

View File

@ -162,6 +162,15 @@ namespace YooAsset
DownloadSystem.ClearFileResponseCodes = codes;
}
/// <summary>
/// 设置下载系统参数,自定义的证书认证实例
/// </summary>
/// <param name="instance"></param>
public static void SetDownloadSystemCertificateHandler(UnityEngine.Networking.CertificateHandler instance)
{
DownloadSystem.CertificateHandlerInstance = instance;
}
/// <summary>
/// 设置异步系统参数,每帧执行消耗的最大时间切片(单位:毫秒)
/// </summary>