mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-24 01:30:14 +00:00
Update download system
增加SetDownloadSystemClearFileResponseCode()新方法
This commit is contained in:
@@ -16,10 +16,15 @@ namespace YooAsset
|
||||
private static readonly List<string> _removeList = new List<string>(100);
|
||||
|
||||
/// <summary>
|
||||
/// 启用断点续传的文件大小
|
||||
/// 启用断点续传功能文件的最小字节数
|
||||
/// </summary>
|
||||
public static int BreakpointResumeFileSize { set; get; } = int.MaxValue;
|
||||
|
||||
/// <summary>
|
||||
/// 下载失败后清理文件的HTTP错误码
|
||||
/// </summary>
|
||||
public static List<long> ClearFileResponseCodes { set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新所有下载器
|
||||
/// </summary>
|
||||
|
||||
@@ -156,13 +156,26 @@ namespace YooAsset
|
||||
// 如果下载失败
|
||||
if (hasError)
|
||||
{
|
||||
// 注意:非断点续传下载失败后删除文件
|
||||
// 注意:非断点续传下载失败之后删除文件
|
||||
if (_breakResume == false)
|
||||
{
|
||||
string cacheFilePath = _bundleInfo.Bundle.CachedFilePath;
|
||||
if (File.Exists(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)
|
||||
|
||||
Reference in New Issue
Block a user