public void Download(string url, UrlDownloadCompletedCallback cb, UrlDownloaderConfig config) { WebRequest request = WebRequest.Create(url); DotNetUrlDownloader.DownloadResult downloadResult = new DotNetUrlDownloader.DownloadResult(); downloadResult.callback = cb; DotNetUrlDownloader.Download(new DotNetUrlDownloader.DownloadState { downloader = this, host = url, downloadResult = downloadResult, request = request, numRetriesLeft = config.numRetries, timeoutMs = config.timeoutMs }); }
public void Process() { List <DotNetUrlDownloader.DownloadResult> completedDownloads = this.m_completedDownloads; lock (completedDownloads) { using (List <DotNetUrlDownloader.DownloadResult> .Enumerator enumerator = this.m_completedDownloads.GetEnumerator()) { while (enumerator.MoveNext()) { DotNetUrlDownloader.DownloadResult current = enumerator.get_Current(); current.callback(current.succeeded, current.downloadData); } } this.m_completedDownloads.Clear(); } }