parent
958cdd25a5
commit
0a1c40cee5
|
@ -16,10 +16,15 @@ namespace YooAsset
|
||||||
private static readonly List<string> _removeList = new List<string>(100);
|
private static readonly List<string> _removeList = new List<string>(100);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 启用断点续传的文件大小
|
/// 启用断点续传功能文件的最小字节数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static int BreakpointResumeFileSize { set; get; } = int.MaxValue;
|
public static int BreakpointResumeFileSize { set; get; } = int.MaxValue;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 下载失败后清理文件的HTTP错误码
|
||||||
|
/// </summary>
|
||||||
|
public static List<long> ClearFileResponseCodes { set; get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 更新所有下载器
|
/// 更新所有下载器
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -156,13 +156,26 @@ namespace YooAsset
|
||||||
// 如果下载失败
|
// 如果下载失败
|
||||||
if (hasError)
|
if (hasError)
|
||||||
{
|
{
|
||||||
// 注意:非断点续传下载失败后删除文件
|
// 注意:非断点续传下载失败之后删除文件
|
||||||
if (_breakResume == false)
|
if (_breakResume == false)
|
||||||
{
|
{
|
||||||
string cacheFilePath = _bundleInfo.Bundle.CachedFilePath;
|
string cacheFilePath = _bundleInfo.Bundle.CachedFilePath;
|
||||||
if (File.Exists(cacheFilePath))
|
if (File.Exists(cacheFilePath))
|
||||||
File.Delete(cacheFilePath);
|
File.Delete(cacheFilePath);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 注意:下载断点续传文件发生特殊错误码之后删除文件
|
||||||
|
if (DownloadSystem.ClearFileResponseCodes != null)
|
||||||
|
{
|
||||||
|
if (DownloadSystem.ClearFileResponseCodes.Contains(_webRequest.responseCode))
|
||||||
|
{
|
||||||
|
string cacheFilePath = _bundleInfo.Bundle.CachedFilePath;
|
||||||
|
if (File.Exists(cacheFilePath))
|
||||||
|
File.Delete(cacheFilePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 失败后重新尝试
|
// 失败后重新尝试
|
||||||
if (_failedTryAgain > 0)
|
if (_failedTryAgain > 0)
|
||||||
|
|
|
@ -147,7 +147,7 @@ namespace YooAsset
|
||||||
|
|
||||||
#region 系统参数
|
#region 系统参数
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 启用下载系统的断点续传功能的文件大小
|
/// 设置下载系统参数,启用断点续传功能文件的最小字节数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void SetDownloadSystemBreakpointResumeFileSize(int fileBytes)
|
public static void SetDownloadSystemBreakpointResumeFileSize(int fileBytes)
|
||||||
{
|
{
|
||||||
|
@ -155,7 +155,15 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设置异步系统的每帧允许运行的最大时间切片(单位:毫秒)
|
/// 设置下载系统参数,下载失败后清理文件的HTTP错误码
|
||||||
|
/// </summary>
|
||||||
|
public static void SetDownloadSystemClearFileResponseCode(List<long> codes)
|
||||||
|
{
|
||||||
|
DownloadSystem.ClearFileResponseCodes = codes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设置异步系统参数,每帧执行消耗的最大时间切片(单位:毫秒)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void SetOperationSystemMaxTimeSlice(long milliseconds)
|
public static void SetOperationSystemMaxTimeSlice(long milliseconds)
|
||||||
{
|
{
|
||||||
|
@ -168,7 +176,7 @@ namespace YooAsset
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设置缓存系统的已经缓存文件的校验等级
|
/// 设置缓存系统参数,已经缓存文件的校验等级
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void SetCacheSystemCachedFileVerifyLevel(EVerifyLevel verifyLevel)
|
public static void SetCacheSystemCachedFileVerifyLevel(EVerifyLevel verifyLevel)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue