private void DownloadPackage(IUpdateCheckResult result, int currentPackage) { IPackageInfo package = result.PackagesToUpdate[currentPackage]; string updaterCache = this.packageListDirectory + "UpdaterCache/"; if (Directory.Exists(updaterCache) == false) { Directory.CreateDirectory(updaterCache); } string tempPath = updaterCache + package.FullID + ".uprtmp";//Path.GetTempFileName(); FileDownload download = new FileDownload(result.UpdateDirectory + "Packages/" + package.FullID + "/" + package.FullID + ".zip", tempPath); if (PackageDownloadStart != null) { PackageDownloadStart(this, new PackageDownloadStartEventArgs(package, download)); } download.DownloadUpdate += delegate(System.Object o, FileDownloadingEventArgs e) { //if (UpdateDownloading != null) { // UpdateDownloading(this, new UpdateInstallingEventArgs(e, fileNum, fileList.Count)); //} }; download.DownloadComplete += delegate(System.Object o, FileDownloadingEventArgs e) { InstallDownloadedPackage(result, currentPackage, tempPath); }; download.Download(); }
private void DownloadPackage(IUpdateCheckResult result, int currentPackage) { IPackageInfo package = result.PackagesToUpdate[currentPackage]; string updaterCache = this.packageListDirectory + "UpdaterCache/"; if (Directory.Exists(updaterCache) == false) { Directory.CreateDirectory(updaterCache); } string tempPath = updaterCache + package.FullID + ".uprtmp";//Path.GetTempFileName(); FileDownload download = new FileDownload(result.UpdateDirectory + "Packages/" + package.FullID + "/" + package.FullID + ".zip", tempPath); if (PackageDownloadStart != null) { PackageDownloadStart(this, new PackageDownloadStartEventArgs(package, download)); } download.DownloadUpdate += delegate(System.Object o, FileDownloadingEventArgs e) { //if (UpdateDownloading != null) { // UpdateDownloading(this, new UpdateInstallingEventArgs(e, fileNum, fileList.Count)); //} }; download.DownloadComplete += delegate(System.Object o, FileDownloadingEventArgs e) { InstallDownloadedPackage(result, currentPackage, tempPath); }; download.Download(); }