private bool SynchronizeGroupCore(bool blocking, SyncGroupHelper sgh) { TempDirectory directory = null; try { string group = sgh.Group; SubscriptionState subscriptionState = this._subStore.GetSubscriptionState(this._actDesc.DeployManifest); if (this._subStore.CheckGroupInstalled(subscriptionState, this._actDesc.AppId, this._actDesc.AppManifest, group)) { return(false); } bool flag = AppDomain.CurrentDomain.ApplicationTrust.DefaultGrantSet.PermissionSet.IsUnrestricted(); if (!flag && (this._actDesc.AppManifest.FileAssociations.Length > 0)) { throw new DeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_FileExtensionNotSupported")); } bool flag2 = !this._actDesc.DeployManifest.Deployment.Install; if (!flag && flag2) { if (this._downloadOptions == null) { this._downloadOptions = new DownloadOptions(); } this._downloadOptions.EnforceSizeLimit = true; this._downloadOptions.SizeLimit = this._subStore.GetSizeLimitInBytesForSemiTrustApps(); this._downloadOptions.Size = this._subStore.GetPrivateSize(this._actDesc.AppId); } directory = this._subStore.AcquireTempDirectory(); DownloadManager.DownloadDependencies(subscriptionState, this._actDesc.DeployManifest, this._actDesc.AppManifest, this._actDesc.AppSourceUri, directory.Path, group, blocking ? null : sgh, this._downloadOptions); if (!blocking && sgh.CancellationPending) { return(true); } CommitApplicationParams commitParams = new CommitApplicationParams(this._actDesc) { CommitApp = true, AppPayloadPath = directory.Path, AppManifestPath = null, AppGroup = group, CommitDeploy = false }; this._subStore.CommitApplication(ref subscriptionState, commitParams); } finally { this.DetachFromGroup(sgh); if (directory != null) { directory.Dispose(); } } return(false); }
private bool SynchronizeCore(bool blocking) { try { AssemblyManifest deployManifest = this._actDesc.DeployManifest; SubscriptionState subscriptionState = this._subStore.GetSubscriptionState(deployManifest); this._subStore.CheckDeploymentSubscriptionState(subscriptionState, deployManifest); this._subStore.CheckCustomUXFlag(subscriptionState, this._actDesc.AppManifest); if (this._actDesc.DeployManifestPath != null) { this._actDesc.CommitDeploy = true; this._actDesc.IsConfirmed = this._isConfirmed; this._actDesc.TimeStamp = DateTime.UtcNow; } else { this._actDesc.CommitDeploy = false; } if (!blocking && this._cancellationPending) { return(true); } if (!this._cached) { Logger.AddInternalState(this._log, "Application is not cached."); bool flag = false; if (this._actDesc.appType != AppType.CustomHostSpecified) { if (this._actDesc.Trust != null) { bool flag2 = this._actDesc.Trust.DefaultGrantSet.PermissionSet.IsUnrestricted(); Logger.AddInternalState(this._log, "fullTrust=" + flag2.ToString()); if (!flag2 && (this._actDesc.AppManifest.FileAssociations.Length > 0)) { throw new DeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_FileExtensionNotSupported")); } bool flag3 = !this._actDesc.DeployManifest.Deployment.Install; if (!flag2 && flag3) { Logger.AddInternalState(this._log, "Application is semi-trust and online. Size limits will be checked during download."); if (this._downloadOptions == null) { this._downloadOptions = new DownloadOptions(); } this._downloadOptions.EnforceSizeLimit = true; this._downloadOptions.SizeLimit = this._subStore.GetSizeLimitInBytesForSemiTrustApps(); this._downloadOptions.Size = this._actDesc.DeployManifest.SizeInBytes + this._actDesc.AppManifest.SizeInBytes; } } else { flag = true; } } DownloadManager.DownloadDependencies(subscriptionState, this._actDesc.DeployManifest, this._actDesc.AppManifest, this._actDesc.AppSourceUri, this._tempApplicationDirectory.Path, null, blocking ? null : this, this._downloadOptions); if (!blocking && this._cancellationPending) { return(true); } this.WaitForAssertApplicationRequirements(); if (flag) { this.CheckSizeLimit(); } this._actDesc.CommitApp = true; this._actDesc.AppPayloadPath = this._tempApplicationDirectory.Path; } else { Logger.AddInternalState(this._log, "Application is cached."); this.WaitForAssertApplicationRequirements(); } if (this._actDesc.CommitDeploy || this._actDesc.CommitApp) { this._subStore.CommitApplication(ref subscriptionState, this._actDesc); Logger.AddInternalState(this._log, "Application is successfully committed to the store."); } if (this._tempApplicationDirectory != null) { this._tempApplicationDirectory.Dispose(); this._tempApplicationDirectory = null; } if (this._tempDeployment != null) { this._tempDeployment.Dispose(); this._tempDeployment = null; } if (this._referenceTransaction != null) { this._referenceTransaction.Close(); this._referenceTransaction = null; } Logger.AddInternalState(this._log, "Refreshing ActivationContext from store."); ActivationContext context = this._actCtx; this._actCtx = ConstructActivationContextFromStore(this._actDesc.AppId); context.Dispose(); this._cached = true; } catch (Exception exception) { this.LogError(Resources.GetString("Ex_DownloadApplicationFailed"), exception); Logger.AddInternalState(this._log, "Exception thrown in SynchronizeCore(): " + exception.GetType().ToString() + " : " + exception.Message + "\r\n" + exception.StackTrace); throw; } return(false); }