private void DownloadFilePart(FilePart filePart) { string filePartURL = filePart.URL(this.m_ManifestURL); Logger.Info("Downloading " + filePartURL + " to " + filePart.Path); bool downloaded = false; Exception capturedException = (Exception)null; SplitDownloader.DownloadFile(filePartURL, filePart.Path, this.m_UserAgent, (SplitDownloader.DownloadFileProgressCb)((downloadedSize, totalSize) => { filePart.DownloadedSize = downloadedSize; if ((double)this.m_PercentDownloaded != (double)this.m_Manifest.PercentDownloaded()) { this.m_ProgressCb(this.m_Manifest.PercentDownloaded()); } this.m_PercentDownloaded = this.m_Manifest.PercentDownloaded(); }), (SplitDownloader.DownloadFileCompletedCb)(filePath => { downloaded = true; Logger.Info("Downloaded " + filePartURL + " to " + filePart.Path); }), (SplitDownloader.DownloadFileExceptionCb)(e => { downloaded = false; capturedException = e; Logger.Error(e.ToString()); })); if (!downloaded) { throw capturedException; } }
private Manifest GetManifest() { string manifestFilePath = this.GetManifestFilePath(); Logger.Info("Downloading " + this.m_ManifestURL + " to " + manifestFilePath); bool downloaded = false; Exception capturedException = (Exception)null; SplitDownloader.DownloadFile(this.m_ManifestURL, manifestFilePath, this.m_UserAgent, (SplitDownloader.DownloadFileProgressCb)((downloadedSize, totalSize) => Logger.Info("Downloaded (" + downloadedSize.ToString() + " bytes) out of " + totalSize.ToString())), (SplitDownloader.DownloadFileCompletedCb)(filePath => { downloaded = true; Logger.Info("Downloaded " + this.m_ManifestURL + " to " + filePath); }), (SplitDownloader.DownloadFileExceptionCb)(e => { downloaded = false; capturedException = e; Logger.Error(e.ToString()); })); if (!downloaded) { throw capturedException; } Manifest manifest = new Manifest(manifestFilePath); manifest.Build(); return(manifest); }