Ejemplo n.º 1
0
 protected FileDownloader()
 {
     this._fileQueue       = new Queue();
     this._eventArgs       = new DownloadEventArgs();
     this._downloadResults = new ArrayList();
     this._buffer          = new byte[4096];
 }
Ejemplo n.º 2
0
 void IDownloadNotification.DownloadModified(object sender, DownloadEventArgs e)
 {
     if (this._cancellationPending)
     {
         ((FileDownloader)sender).Cancel();
     }
     this.asyncOperation.Post(this.progressReporter, new DeploymentProgressChangedEventArgs(e.Progress, null, e.BytesCompleted, e.BytesTotal, this._state, null));
 }
Ejemplo n.º 3
0
 public void DownloadModified(object sender, DownloadEventArgs e)
 {
     if (this._cancellationPending)
     {
         ((FileDownloader)sender).Cancel();
     }
     this.asyncOperation.Post(this.progressReporter, new DeploymentProgressChangedEventArgs(e.Progress, this.userState, e.BytesCompleted, e.BytesTotal, DeploymentProgressState.DownloadingApplicationFiles, this.groupName));
 }
 private static void ProcessDownloadedFile(object sender, DownloadEventArgs e)
 {
     if (e.Cookie != null)
     {
         string         fileName   = Path.GetFileName(e.FileLocalPath);
         FileDownloader downloader = (FileDownloader)sender;
         if ((e.FileResponseUri != null) && !e.FileResponseUri.Equals(e.FileSourceUri))
         {
             throw new InvalidDeploymentException(ExceptionTypes.AppFileLocationValidation, string.Format(CultureInfo.CurrentUICulture, Resources.GetString("Ex_DownloadAppFileAsmRedirected"), new object[] { fileName }));
         }
         DependencyDownloadCookie cookie = (DependencyDownloadCookie)e.Cookie;
         if (cookie.ManifestElement is DependentAssembly)
         {
             DependentAssembly manifestElement  = (DependentAssembly)cookie.ManifestElement;
             AssemblyManifest  deployManifest   = cookie.DeployManifest;
             AssemblyManifest  appManifest      = cookie.AppManifest;
             AssemblyManifest  assemblyManifest = new AssemblyManifest(e.FileLocalPath);
             if (!assemblyManifest.Identity.Matches(manifestElement.Identity, true))
             {
                 throw new InvalidDeploymentException(ExceptionTypes.RefDefValidation, string.Format(CultureInfo.CurrentUICulture, Resources.GetString("Ex_DownloadRefDefMismatch"), new object[] { fileName }));
             }
             if (assemblyManifest.Identity.Equals(deployManifest.Identity) || assemblyManifest.Identity.Equals(appManifest.Identity))
             {
                 throw new InvalidDeploymentException(ExceptionTypes.ManifestSemanticValidation, string.Format(CultureInfo.CurrentUICulture, Resources.GetString("Ex_AppPrivAsmIdSameAsDeployOrApp"), new object[] { assemblyManifest.Identity.ToString() }));
             }
             System.Deployment.Application.Manifest.File[] files = assemblyManifest.Files;
             for (int i = 0; i < files.Length; i++)
             {
                 Uri fileSourceUri = MapFileSourceUri(deployManifest, e.FileSourceUri, files[i].Name);
                 if (!fileSourceUri.AbsoluteUri.Equals(e.FileSourceUri.AbsoluteUri, StringComparison.OrdinalIgnoreCase))
                 {
                     string directoryName = Path.GetDirectoryName(e.FileLocalPath);
                     AddFileToDownloader(downloader, deployManifest, appManifest, files[i], fileSourceUri, directoryName, files[i].NameFS, files[i].HashCollection);
                 }
             }
             downloader.ComponentVerifier.AddFileForVerification(e.FileLocalPath, manifestElement.HashCollection);
             if (assemblyManifest.Identity.PublicKeyToken == null)
             {
                 downloader.ComponentVerifier.AddSimplyNamedAssemblyForVerification(e.FileLocalPath, assemblyManifest);
             }
             else
             {
                 downloader.ComponentVerifier.AddStrongNameAssemblyForVerification(e.FileLocalPath, assemblyManifest);
             }
         }
         else if (cookie.ManifestElement is System.Deployment.Application.Manifest.File)
         {
             System.Deployment.Application.Manifest.File file = (System.Deployment.Application.Manifest.File)cookie.ManifestElement;
             downloader.ComponentVerifier.AddFileForVerification(e.FileLocalPath, file.HashCollection);
         }
     }
 }
Ejemplo n.º 5
0
 public void DownloadModified(object sender, DownloadEventArgs e)
 {
     if (this._userCancelling)
     {
         ((FileDownloader)sender).Cancel();
     }
     else
     {
         this._downloadData = e;
         if (this._info.iconFilePath != null && this._appIconBitmap == null && (e.Cookie != null && File.Exists(this._info.iconFilePath)))
         {
             using (Icon associatedIcon = Icon.ExtractAssociatedIcon(this._info.iconFilePath))
                 this._appIconBitmap = this.TryGet32x32Bitmap(associatedIcon);
         }
         this.BeginInvoke((Delegate)this.updateUIMethodInvoker);
     }
 }
Ejemplo n.º 6
0
 public void DownloadCompleted(object sender, DownloadEventArgs e)
 {
     this.BeginInvoke((Delegate)this.disableMethodInvoker);
 }
 public void DownloadCompleted(object sender, DownloadEventArgs e)
 {
     base.BeginInvoke(this.disableMethodInvoker);
 }
Ejemplo n.º 8
0
 void IDownloadNotification.DownloadCompleted(object sender, DownloadEventArgs e)
 {
     this._downloadedAppSize = e.BytesCompleted;
 }
Ejemplo n.º 9
0
 public void DownloadCompleted(object sender, DownloadEventArgs e)
 {
 }