public void Add(string url, string saveFile, OnDownLoadComplete onDownLoadComplete = null, OnDownLoadError onDownLoadError = null) { HttpWebRequestDownLoader httpWebRequestDownLoader = new HttpWebRequestDownLoader(url, saveFile, true); httpWebRequestDownLoader.onDownLoadComplete = onDownLoadComplete; httpWebRequestDownLoader.onDownLoadError = onDownLoadError; AddDownLoader(httpWebRequestDownLoader); /* * int freeIndex = GetFreeIndex(); * * if (freeIndex != -1) * { * queueWorking[freeIndex] = httpWebRequestDownLoader; * httpWebRequestDownLoader.Execute(); * } * else * { * queueWaitting.Enqueue(httpWebRequestDownLoader); * }*/ }
public void Add(string url, string saveFile, string md5 = null, OnDownLoadComplete onDownLoadComplete = null, OnDownLoadError onDownLoadError = null, OnDownLoadProgress onDownLoadProgress = null) { HttpWebRequestDownLoader downLoader = new HttpWebRequestDownLoader(url, saveFile, true); downLoader.md5 = md5; downLoader.onDownLoadComplete = OnDownLoadComplete; if (onDownLoadComplete != null) { downLoader.onDownLoadComplete += onDownLoadComplete; } downLoader.onDownLoadError = OnDownLoadError; if (onDownLoadError != null) { downLoader.onDownLoadError += onDownLoadError; } downLoader.onDownLoadProgress = OnDownLoadProgress; if (onDownLoadProgress != null) { downLoader.onDownLoadProgress += onDownLoadProgress; } downLoaderArr.Add(downLoader); }