下载
[Demo] ihaiu.MnutiThreadDownload For Mac.zip
[Demo] ihaiu.MnutiThreadDownload For Windows.zip
[Demo] 下载器
1.支持多行批量下载2.支持断点续传
3.可以打开文件到所在位置 (点击本地路径)
添加任务:支持多行批量下载

下载界面


目录
【Code】 Assets/Ihaiu/Scripts/MultiThreadDownload
【Example】 Assets/Ihaiu/HttpDownloadFileExampleFiles
[API] HttpDownload
/** 添加下载文件 */
public static DownloadFile Add(string url, string localPath);
public static DownloadFile Add(string url, string localPath, int size);
public static DownloadFile Add(string url, string localPath, Action<DownloadFile> callback);
public static DownloadFile Add(string url, string localPath, int size, Action<DownloadFile> callback);
public static void Add(DownloadFile downloadFile);
/** 移除下载文件 */
public static void Remove(DownloadFile downloadFile);
/** 退出,会退出所有线程*/
public static void Exit();
/** 设置线程数量 */
public static int ProcessorCount
{
get
{
// return Mathf.Max(Environment.ProcessorCount - 1, 1);
return 4;
}
}
[API] DownloadFile
/** 下载链接 */ public string url; /** 本地存储路径 */ public string localPath; /** 文件大小 */ public long size = 0; /** 已加载大小 */ public long loadedSize = 0; /** 状态 */ public StateType state = StateType.None; /** 加载完成回调 */ public Action<DownloadFile> completeCallback; /** 添加到异步队列 */ public void AsyncLoad(); /** 从异步队列移除 */ public void AsyncRemove(); /** 同步下载 */ public void Load();