internal DeploymentManager(Uri deploymentSource, bool isUpdate, bool isConfirmed, DownloadOptions downloadOptions, AsyncOperation optionalAsyncOp) { this._deploySource = deploymentSource; this._isupdate = isUpdate; this._isConfirmed = isConfirmed; this._downloadOptions = downloadOptions; this._events = new EventHandlerList(); this._syncGroupMap = CollectionsUtil.CreateCaseInsensitiveHashtable(); this._subStore = SubscriptionStore.CurrentUser; this.bindWorker = new ThreadStart(this.BindAsyncWorker); this.synchronizeWorker = new ThreadStart(this.SynchronizeAsyncWorker); this.synchronizeGroupWorker = new WaitCallback(this.SynchronizeGroupAsyncWorker); this.bindCompleted = new SendOrPostCallback(this.BindAsyncCompleted); this.synchronizeCompleted = new SendOrPostCallback(this.SynchronizeAsyncCompleted); this.progressReporter = new SendOrPostCallback(this.ProgressReporter); this.asyncOperation = optionalAsyncOp != null ? optionalAsyncOp : AsyncOperationManager.CreateOperation((object)null); this._log = Logger.StartLogging(); if (deploymentSource != (Uri)null) { Logger.SetSubscriptionUrl(this._log, deploymentSource); } this._assertApplicationReqEvents = new ManualResetEvent[3]; this._assertApplicationReqEvents[0] = this._trustNotGrantedEvent; this._assertApplicationReqEvents[1] = this._platformRequirementsFailedEvent; this._assertApplicationReqEvents[2] = this._trustGrantedEvent; this._callerType = DeploymentManager.CallerType.Other; PolicyKeys.SkipApplicationDependencyHashCheck(); PolicyKeys.SkipDeploymentProvider(); PolicyKeys.SkipSchemaValidation(); PolicyKeys.SkipSemanticValidation(); PolicyKeys.SkipSignatureValidation(); }
public static AssemblyManifest DownloadApplicationManifest(AssemblyManifest deploymentManifest, string targetDir, Uri deploymentUri, IDownloadNotification notification, DownloadOptions options, out Uri appSourceUri, out string appManifestPath) { Logger.AddMethodCall("DownloadApplicationManifest called."); DependentAssembly dependentAssembly = deploymentManifest.MainDependentAssembly; if (dependentAssembly == null || dependentAssembly.Codebase == null) { throw new InvalidDeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_NoAppInDeploymentManifest")); } appSourceUri = new Uri(deploymentUri, dependentAssembly.Codebase); Zone fromUrl1 = Zone.CreateFromUrl(deploymentUri.AbsoluteUri); Zone fromUrl2 = Zone.CreateFromUrl(appSourceUri.AbsoluteUri); if (!fromUrl1.Equals((object)fromUrl2)) { Logger.AddInternalState("Deployment and application does not have matching security zones. deploymentZone=" + (object)fromUrl1 + ",applicationZone=" + (object)fromUrl2); throw new InvalidDeploymentException(ExceptionTypes.Zone, Resources.GetString("Ex_DeployAppZoneMismatch")); } appManifestPath = Path.Combine(targetDir, dependentAssembly.Identity.Name + ".manifest"); ServerInformation serverInformation; AssemblyManifest assemblyManifest = DownloadManager.DownloadManifest(ref appSourceUri, appManifestPath, notification, options, AssemblyManifest.ManifestType.Application, out serverInformation); Logger.SetApplicationUrl(appSourceUri); Logger.SetApplicationServerInformation(serverInformation); Zone fromUrl3 = Zone.CreateFromUrl(appSourceUri.AbsoluteUri); if (!fromUrl1.Equals((object)fromUrl3)) { Logger.AddInternalState("Deployment and application does not have matching security zones. deploymentZone=" + (object)fromUrl1 + ",applicationZone=" + (object)fromUrl3); throw new InvalidDeploymentException(ExceptionTypes.Zone, Resources.GetString("Ex_DeployAppZoneMismatch")); } if (assemblyManifest.Identity.Equals((object)deploymentManifest.Identity)) { throw new InvalidDeploymentException(ExceptionTypes.ManifestSemanticValidation, string.Format((IFormatProvider)CultureInfo.CurrentUICulture, Resources.GetString("Ex_DepSameDeploymentAndApplicationIdentity"), new object[1] { (object)assemblyManifest.Identity.ToString() })); } if (!assemblyManifest.Identity.Matches(dependentAssembly.Identity, assemblyManifest.Application)) { throw new InvalidDeploymentException(ExceptionTypes.SubscriptionSemanticValidation, Resources.GetString("Ex_RefDefMismatch")); } if (!PolicyKeys.SkipApplicationDependencyHashCheck()) { try { ComponentVerifier.VerifyFileHash(appManifestPath, dependentAssembly.HashCollection); } catch (InvalidDeploymentException ex) { if (ex.SubType == ExceptionTypes.HashValidation) { throw new InvalidDeploymentException(ExceptionTypes.HashValidation, Resources.GetString("Ex_AppManInvalidHash"), (Exception)ex); } throw; } } if (assemblyManifest.RequestedExecutionLevel != null) { Logger.AddInternalState("Application manifest has RequestedExecutionLevel specified. Check requested privileges."); DownloadManager.VerifyRequestedPrivilegesSupport(assemblyManifest.RequestedExecutionLevel); } return(assemblyManifest); }