private UpdateCheckInfo DetermineUpdateCheckResult(ActivationDescription actDesc) { bool updateAvailable = false; Version availableVersion = (Version)null; bool isUpdateRequired = false; Version minimumRequiredVersion = (Version)null; long updateSize = 0; bool bUpdateInPKTGroup = false; AssemblyManifest deployManifest = actDesc.DeployManifest; this._subState.Invalidate(); Version version = this._subStore.CheckUpdateInManifest(this._subState, actDesc.DeploySourceUri, deployManifest, this._currentVersion, ref bUpdateInPKTGroup); if (version != (Version)null && !deployManifest.Identity.Equals((object)this._subState.ExcludedDeployment)) { updateAvailable = true; availableVersion = version; minimumRequiredVersion = deployManifest.Deployment.MinimumRequiredVersion; if (minimumRequiredVersion != (Version)null && minimumRequiredVersion.CompareTo(this._currentVersion) > 0) { isUpdateRequired = true; } ulong dependenciesSize = actDesc.AppManifest.CalculateDependenciesSize(); updateSize = dependenciesSize <= 9223372036854775807UL ? (long)dependenciesSize : long.MaxValue; actDesc.IsUpdateInPKTGroup = bUpdateInPKTGroup; } return(new UpdateCheckInfo(updateAvailable, availableVersion, isUpdateRequired, minimumRequiredVersion, updateSize)); }
private UpdateCheckInfo DetermineUpdateCheckResult(ActivationDescription actDesc) { bool updateAvailable = false; Version availableVersion = null; bool isUpdateRequired = false; Version minimumRequiredVersion = null; long updateSize = 0L; bool bUpdateInPKTGroup = false; AssemblyManifest deployManifest = actDesc.DeployManifest; this._subState.Invalidate(); Version version3 = this._subStore.CheckUpdateInManifest(this._subState, actDesc.DeploySourceUri, deployManifest, this._currentVersion, ref bUpdateInPKTGroup); if ((version3 != null) && !deployManifest.Identity.Equals(this._subState.ExcludedDeployment)) { updateAvailable = true; availableVersion = version3; minimumRequiredVersion = deployManifest.Deployment.MinimumRequiredVersion; if ((minimumRequiredVersion != null) && (minimumRequiredVersion.CompareTo(this._currentVersion) > 0)) { isUpdateRequired = true; } ulong num2 = actDesc.AppManifest.CalculateDependenciesSize(); if (num2 > 0x7fffffffffffffffL) { updateSize = 0x7fffffffffffffffL; } else { updateSize = (long)num2; } actDesc.IsUpdateInPKTGroup = bUpdateInPKTGroup; } return(new UpdateCheckInfo(updateAvailable, availableVersion, isUpdateRequired, minimumRequiredVersion, updateSize)); }
private static ActivationContext ConstructActivationContext(ActivationDescription actDesc) { return(ActivationContext.CreatePartialActivationContext(actDesc.AppId.ToApplicationIdentity(), new string[2] { actDesc.DeployManifestPath, actDesc.AppManifestPath })); }
private void ProcessUpdateCheckResult(UpdateCheckInfo info, ActivationDescription actDesc) { if (this._subState.IsShellVisible) { AssemblyManifest deployManifest = actDesc.DeployManifest; DefinitionIdentity deployId = info.UpdateAvailable ? deployManifest.Identity : null; this._subStore.SetPendingDeployment(this._subState, deployId, DateTime.UtcNow); } }
private bool BindCoreWithAppId(bool blocking, ref FileStream refTransaction, ref string productName) { SubscriptionState subscriptionState = this._subStore.GetSubscriptionState(this._bindAppId.DeploymentIdentity.ToSubscriptionId()); if (!subscriptionState.IsInstalled) { throw new InvalidDeploymentException(Resources.GetString("Ex_BindAppIdNotInstalled")); } if (!this._bindAppId.Equals((object)subscriptionState.CurrentBind)) { throw new InvalidDeploymentException(Resources.GetString("Ex_BindAppIdNotCurrrent")); } if (!blocking && this._cancellationPending) { return(true); } long transactionId; refTransaction = this._subStore.AcquireReferenceTransaction(out transactionId); bool flag = this._subStore.CheckAndReferenceApplication(subscriptionState, this._bindAppId, transactionId); ActivationDescription activationDescription = new ActivationDescription(); activationDescription.SetDeploymentManifest(subscriptionState.CurrentDeploymentManifest, subscriptionState.CurrentDeploymentSourceUri, (string)null); Logger.SetDeploymentManifest(this._log, subscriptionState.CurrentDeploymentManifest); activationDescription.IsUpdate = this._isupdate; activationDescription.SetApplicationManifest(subscriptionState.CurrentApplicationManifest, subscriptionState.CurrentApplicationSourceUri, (string)null); Logger.SetApplicationManifest(this._log, subscriptionState.CurrentApplicationManifest); Logger.SetApplicationUrl(this._log, subscriptionState.CurrentApplicationSourceUri); activationDescription.AppId = new DefinitionAppId(activationDescription.ToAppCodebase(), new DefinitionIdentity[2] { activationDescription.DeployManifest.Identity, activationDescription.AppManifest.Identity }); if (!blocking && this._cancellationPending) { return(true); } Description effectiveDescription = subscriptionState.EffectiveDescription; productName = effectiveDescription.Product; this._cached = flag; Logger.AddInternalState(this._log, "_cached=" + this._cached.ToString()); Logger.AddInternalState(this._log, "_isupdate=" + this._isupdate.ToString()); this._referenceTransaction = refTransaction; this._actCtx = DeploymentManager.ConstructActivationContextFromStore(activationDescription.AppId); this._actDesc = activationDescription; return(false); }
internal GetManifestCompletedEventArgs(BindCompletedEventArgs e, ActivationDescription activationDescription, string logFilePath, Logger.LogIdentity log) : base(e.Error, e.Cancelled, e.UserState) { this._applicationIdentity = (e.ActivationContext != null) ? e.ActivationContext.Identity : null; Logger.AddInternalState(log, "Creating GetManifestCompletedEventArgs."); string text = this._applicationIdentity.ToString(); DefinitionAppId id = new DefinitionAppId(text); this._subId = id.DeploymentIdentity.ToSubscriptionId(); this._logFilePath = logFilePath; this._isCached = e.IsCached; this._name = e.FriendlyName; this._actContext = e.ActivationContext; Logger.AddInternalState(log, "Application identity=" + text); Logger.AddInternalState(log, "Subscription identity=" + ((this._subId != null) ? this._subId.ToString() : "null")); Logger.AddInternalState(log, "IsCached=" + this._isCached.ToString()); if (this._isCached) { this._rawDeploymentManifest = e.ActivationContext.DeploymentManifestBytes; this._rawApplicationManifest = e.ActivationContext.ApplicationManifestBytes; } this._activationDescription = activationDescription; this._version = this._activationDescription.AppId.DeploymentIdentity.Version; this._support = this._activationDescription.DeployManifest.Description.SupportUri; }
internal GetManifestCompletedEventArgs(BindCompletedEventArgs e, ActivationDescription activationDescription, string logFilePath, Logger.LogIdentity log) : base(e.Error, e.Cancelled, e.UserState) { this._applicationIdentity = e.ActivationContext != null ? e.ActivationContext.Identity : (ApplicationIdentity)null; Logger.AddInternalState(log, "Creating GetManifestCompletedEventArgs."); string text = this._applicationIdentity.ToString(); this._subId = new DefinitionAppId(text).DeploymentIdentity.ToSubscriptionId(); this._logFilePath = logFilePath; this._isCached = e.IsCached; this._name = e.FriendlyName; this._actContext = e.ActivationContext; Logger.AddInternalState(log, "Application identity=" + text); Logger.AddInternalState(log, "Subscription identity=" + (this._subId != null ? this._subId.ToString() : "null")); Logger.AddInternalState(log, "IsCached=" + this._isCached.ToString()); if (this._isCached) { this._rawDeploymentManifest = e.ActivationContext.DeploymentManifestBytes; this._rawApplicationManifest = e.ActivationContext.ApplicationManifestBytes; } this._activationDescription = activationDescription; this._version = this._activationDescription.AppId.DeploymentIdentity.Version; this._support = this._activationDescription.DeployManifest.Description.SupportUri; }
private void ProcessUpdateCheckResult(UpdateCheckInfo info, ActivationDescription actDesc) { if (this._subState.IsShellVisible) { AssemblyManifest deployManifest = actDesc.DeployManifest; DefinitionIdentity deployId = info.UpdateAvailable ? deployManifest.Identity : null; this._subStore.SetPendingDeployment(this._subState, deployId, DateTime.UtcNow); } }
private UpdateCheckInfo DetermineUpdateCheckResult(ActivationDescription actDesc) { bool updateAvailable = false; Version availableVersion = null; bool isUpdateRequired = false; Version minimumRequiredVersion = null; long updateSize = 0L; bool bUpdateInPKTGroup = false; AssemblyManifest deployManifest = actDesc.DeployManifest; this._subState.Invalidate(); Version version3 = this._subStore.CheckUpdateInManifest(this._subState, actDesc.DeploySourceUri, deployManifest, this._currentVersion, ref bUpdateInPKTGroup); if ((version3 != null) && !deployManifest.Identity.Equals(this._subState.ExcludedDeployment)) { updateAvailable = true; availableVersion = version3; minimumRequiredVersion = deployManifest.Deployment.MinimumRequiredVersion; if ((minimumRequiredVersion != null) && (minimumRequiredVersion.CompareTo(this._currentVersion) > 0)) { isUpdateRequired = true; } ulong num2 = actDesc.AppManifest.CalculateDependenciesSize(); if (num2 > 0x7fffffffffffffffL) { updateSize = 0x7fffffffffffffffL; } else { updateSize = (long) num2; } actDesc.IsUpdateInPKTGroup = bUpdateInPKTGroup; } return new UpdateCheckInfo(updateAvailable, availableVersion, isUpdateRequired, minimumRequiredVersion, updateSize); }
private void ConsumeUpdatedDeployment(ref SubscriptionState subState, ActivationDescription actDesc) { DefinitionIdentity updateSkippedDeployment = actDesc.DeployManifest.Identity; Uri deploySourceUri = actDesc.DeploySourceUri; Logger.AddPhaseInformation(Resources.GetString("PhaseLog_ConsumeUpdatedDeployment")); Logger.AddInternalState("Consuming new update."); if (!actDesc.IsRequiredUpdate) { Logger.AddInternalState("Update is not a required update."); Description effectiveDescription = subState.EffectiveDescription; UserInterfaceInfo info = new UserInterfaceInfo { formTitle = Resources.GetString("UI_UpdateTitle"), productName = effectiveDescription.Product, supportUrl = effectiveDescription.SupportUrl, sourceSite = UserInterface.GetDisplaySite(deploySourceUri) }; switch (this._ui.ShowUpdate(info)) { case UserInterfaceModalResult.Skip: { TimeSpan span = new TimeSpan(7, 0, 0, 0); DateTime updateSkipTime = DateTime.UtcNow + span; this._subStore.SetUpdateSkipTime(subState, updateSkippedDeployment, updateSkipTime); Logger.AddPhaseInformation(Resources.GetString("Upd_DeployUpdateSkipping")); Logger.AddInternalState("User has decided to skip the update."); return; } case UserInterfaceModalResult.Cancel: Logger.AddInternalState("Do not update now, but prompt for update on next activation."); return; } } this.InstallApplication(ref subState, actDesc); Logger.AddPhaseInformation(Resources.GetString("Upd_Consumed"), new object[] { updateSkippedDeployment.ToString(), deploySourceUri }); Logger.AddInternalState("Update consumed."); }
private ActivationDescription ProcessOrFollowShortcut(string shortcutFile, ref string errorPageUrl, out TempFile deployFile) { DefinitionIdentity identity; Uri uri; deployFile = null; Logger.AddMethodCall("ProcessOrFollowShortcut(shortcutFile=" + shortcutFile + ",errorPageUrl=" + errorPageUrl + ") called."); string str = shortcutFile; string activationParameter = null; int index = shortcutFile.IndexOf('|', 0); if (index > 0) { str = shortcutFile.Substring(0, index); if ((index + 1) < shortcutFile.Length) { activationParameter = shortcutFile.Substring(index + 1); } } Logger.AddInternalState("shortcutParameter=" + activationParameter); ShellExposure.ParseAppShortcut(str, out identity, out uri); SubscriptionState subscriptionState = this._subStore.GetSubscriptionState(identity); ActivationDescription description = null; if (subscriptionState.IsInstalled && subscriptionState.IsShellVisible) { Logger.AddInternalState("Application family is already installed and Shell Visible."); this.PerformDeploymentUpdate(ref subscriptionState, ref errorPageUrl); if (activationParameter == null) { this.Activate(subscriptionState.CurrentBind, subscriptionState.CurrentApplicationManifest, null, false); return description; } this.Activate(subscriptionState.CurrentBind, subscriptionState.CurrentApplicationManifest, activationParameter, true); return description; } Uri sourceUri = uri; Logger.AddInternalState("Application family is not installed or is not Shell-Visible. Try to deploy it from the deployment provider specified in the shortcut : " + sourceUri); Logger.AddInternalState("Start processing deployment manifest."); AssemblyManifest manifest = DownloadManager.DownloadDeploymentManifest(this._subStore, ref sourceUri, out deployFile); Logger.AddInternalState("Processing of deployment manifest has successfully completed."); if (manifest.Description != null) { errorPageUrl = manifest.Description.ErrorReportUrl; } if (!manifest.Deployment.Install) { throw new DeploymentException(ExceptionTypes.Activation, Resources.GetString("Ex_ShortcutRefOnlineOnly")); } description = new ActivationDescription(); description.SetDeploymentManifest(manifest, sourceUri, deployFile.Path); description.IsUpdate = false; description.ActType = ActivationType.InstallViaShortcut; return description; }
private ActivationDescription ProcessOrFollowExtension(Uri associatedFile, string textualSubId, string deploymentProviderUrlFromExtension, ref string errorPageUrl, out TempFile deployFile) { deployFile = null; Logger.AddMethodCall(string.Concat(new object[] { "ProcessOrFollowExtension(", associatedFile, ",", textualSubId, ",", deploymentProviderUrlFromExtension, ",", errorPageUrl, ") called." })); DefinitionIdentity subId = new DefinitionIdentity(textualSubId); SubscriptionState subscriptionState = this._subStore.GetSubscriptionState(subId); ActivationDescription description = null; if (subscriptionState.IsInstalled && subscriptionState.IsShellVisible) { Logger.AddInternalState("Application family is already installed and Shell Visible."); this.PerformDeploymentUpdate(ref subscriptionState, ref errorPageUrl); this.Activate(subscriptionState.CurrentBind, subscriptionState.CurrentApplicationManifest, associatedFile.AbsoluteUri, true); return description; } Logger.AddInternalState("Application family is not installed or is not Shell-Visible. Try to deploy it from the deployment provider specified in the extension : " + deploymentProviderUrlFromExtension); if (string.IsNullOrEmpty(deploymentProviderUrlFromExtension)) { throw new DeploymentException(ExceptionTypes.Activation, string.Format(CultureInfo.CurrentUICulture, Resources.GetString("Ex_FileAssociationNoDpUrl"), new object[] { textualSubId })); } Uri sourceUri = new Uri(deploymentProviderUrlFromExtension); Logger.AddInternalState("Start processing deployment manifest."); AssemblyManifest manifest = DownloadManager.DownloadDeploymentManifest(this._subStore, ref sourceUri, out deployFile); if (manifest.Description != null) { errorPageUrl = manifest.Description.ErrorReportUrl; } Logger.AddInternalState("Processing of deployment manifest has successfully completed."); if (!manifest.Deployment.Install) { throw new DeploymentException(ExceptionTypes.Activation, Resources.GetString("Ex_FileAssociationRefOnline")); } description = new ActivationDescription(); description.SetDeploymentManifest(manifest, sourceUri, deployFile.Path); description.IsUpdate = false; description.ActType = ActivationType.InstallViaFileAssociation; return description; }
private void PerformDeploymentUpdate(ref SubscriptionState subState, ref string errorPageUrl) { DeploymentUpdate deploymentUpdate = subState.CurrentDeploymentManifest.Deployment.DeploymentUpdate; bool flag = (deploymentUpdate != null) && deploymentUpdate.BeforeApplicationStartup; Logger.AddPhaseInformation(Resources.GetString("PhaseLog_DeploymentUpdateCheck")); Logger.AddMethodCall("PerformDeploymentUpdate called."); Logger.AddInternalState(string.Concat(new object[] { "UpdateOnStart=", flag.ToString(), ",PendingDeployment=", subState.PendingDeployment })); if (flag || ((subState.PendingDeployment != null) && !SkipUpdate(subState, subState.PendingDeployment))) { using (TempFile file = null) { AssemblyManifest manifest; Uri deploymentProviderUri = subState.DeploymentProviderUri; try { Logger.AddInternalState("Start processing deployment manifest for update check : " + deploymentProviderUri); manifest = DownloadManager.DownloadDeploymentManifest(this._subStore, ref deploymentProviderUri, out file); Logger.AddInternalState("End processing deployment manifest."); if (manifest.Description != null) { errorPageUrl = manifest.Description.ErrorReportUrl; } } catch (DeploymentDownloadException exception) { Logger.AddErrorInformation(exception, Resources.GetString("Upd_UpdateCheckDownloadFailed"), new object[] { subState.SubscriptionId.ToString() }); return; } if (this._ui.SplashCancelled()) { throw new DownloadCancelledException(); } if ((!SkipUpdate(subState, manifest.Identity) && (this._subStore.CheckUpdateInManifest(subState, deploymentProviderUri, manifest, subState.CurrentDeployment.Version) != null)) && !manifest.Identity.Equals(subState.ExcludedDeployment)) { Logger.AddInternalState("Update available in the deployment server."); ActivationDescription actDesc = new ActivationDescription(); actDesc.SetDeploymentManifest(manifest, deploymentProviderUri, file.Path); actDesc.IsUpdate = true; actDesc.IsRequiredUpdate = false; actDesc.ActType = ActivationType.UpdateViaShortcutOrFA; if ((manifest.Deployment.MinimumRequiredVersion != null) && (manifest.Deployment.MinimumRequiredVersion.CompareTo(subState.CurrentDeployment.Version) > 0)) { actDesc.IsRequiredUpdate = true; } this.CheckDeploymentProviderValidity(actDesc, subState); this.ConsumeUpdatedDeployment(ref subState, actDesc); } } } }
private void PerformDeploymentActivation(Uri activationUri, bool isShortcut, string textualSubId, string deploymentProviderUrlFromExtension, BrowserSettings browserSettings, ref string errorPageUrl) { TempFile deployFile = null; Logger.AddMethodCall("PerformDeploymentActivation called."); try { ActivationDescription description; string shortcutFile = null; Uri uri = null; bool flag = false; this._subStore = SubscriptionStore.CurrentUser; this._subStore.RefreshStorePointer(); Uri sourceUri = activationUri; bool flag2 = false; if (textualSubId != null) { Logger.AddInternalState("Activating through file association."); flag2 = true; description = this.ProcessOrFollowExtension(activationUri, textualSubId, deploymentProviderUrlFromExtension, ref errorPageUrl, out deployFile); if (description == null) { return; } } else if (isShortcut) { Logger.AddInternalState("Activating through shortcut."); shortcutFile = activationUri.LocalPath; description = this.ProcessOrFollowShortcut(shortcutFile, ref errorPageUrl, out deployFile); if (description == null) { return; } } else { SubscriptionState state; Logger.AddInternalState("Activating through deployment manifest."); Logger.AddInternalState("Start processing deployment manifest."); AssemblyManifest deploymentManifest = DownloadManager.DownloadDeploymentManifestBypass(this._subStore, ref sourceUri, out deployFile, out state, null, null); if ((browserSettings != null) && (deployFile != null)) { browserSettings.Validate(deployFile.Path); } if (deploymentManifest.Description != null) { errorPageUrl = deploymentManifest.Description.ErrorReportUrl; } description = new ActivationDescription(); if (state != null) { shortcutFile = null; description.SetApplicationManifest(state.CurrentApplicationManifest, null, null); description.AppId = state.CurrentBind; Logger.AddInternalState("Running from the store. Bypass further downloads and verifications."); flag = true; } else { shortcutFile = deployFile.Path; } Logger.SetDeploymentManifest(deploymentManifest); Logger.AddPhaseInformation(Resources.GetString("PhaseLog_ProcessingDeploymentManifestComplete")); Logger.AddInternalState("Processing of deployment manifest has successfully completed."); description.SetDeploymentManifest(deploymentManifest, sourceUri, shortcutFile); description.IsUpdate = false; description.ActType = ActivationType.InstallViaDotApplication; uri = activationUri; } if (this._ui.SplashCancelled()) { throw new DownloadCancelledException(); } if (description.DeployManifest.Deployment == null) { throw new DeploymentException(ExceptionTypes.Activation, Resources.GetString("Ex_NotDeploymentOrShortcut")); } bool flag3 = false; SubscriptionState subscriptionState = this._subStore.GetSubscriptionState(description.DeployManifest); this.CheckDeploymentProviderValidity(description, subscriptionState); if (!flag) { Logger.AddInternalState("Could not find application in store. Continue with downloading application manifest."); flag3 = this.InstallApplication(ref subscriptionState, description); Logger.AddPhaseInformation(Resources.GetString("PhaseLog_InstallationComplete")); Logger.AddInternalState("Installation of application has successfully completed."); } else { this._subStore.SetLastCheckTimeToNow(subscriptionState); } if ((description.DeployManifest.Deployment.DisallowUrlActivation && !isShortcut) && (!activationUri.IsFile || activationUri.IsUnc)) { if (flag3) { this._ui.ShowMessage(Resources.GetString("Activation_DisallowUrlActivationMessageAfterInstall"), Resources.GetString("Activation_DisallowUrlActivationCaptionAfterInstall")); } else { this._ui.ShowMessage(Resources.GetString("Activation_DisallowUrlActivationMessage"), Resources.GetString("Activation_DisallowUrlActivationCaption")); } } else if (flag2) { this.Activate(description.AppId, description.AppManifest, activationUri.AbsoluteUri, true); } else if (isShortcut) { string activationParameter = null; int index = shortcutFile.IndexOf('|', 0); if ((index > 0) && ((index + 1) < shortcutFile.Length)) { activationParameter = shortcutFile.Substring(index + 1); } if (activationParameter == null) { this.Activate(description.AppId, description.AppManifest, null, false); } else { this.Activate(description.AppId, description.AppManifest, activationParameter, true); } } else { this.Activate(description.AppId, description.AppManifest, uri.AbsoluteUri, false); } } finally { if (deployFile != null) { deployFile.Dispose(); } } }
private bool InstallApplication(ref SubscriptionState subState, ActivationDescription actDesc) { long num; bool flag = false; Logger.AddMethodCall("InstallApplication called."); Logger.AddPhaseInformation(Resources.GetString("PhaseLog_InstallApplication")); this._subStore.CheckDeploymentSubscriptionState(subState, actDesc.DeployManifest); using (this._subStore.AcquireReferenceTransaction(out num)) { using (TempDirectory directory = null) { flag = this.DownloadApplication(subState, actDesc, num, out directory); actDesc.CommitDeploy = true; actDesc.IsConfirmed = true; actDesc.TimeStamp = DateTime.UtcNow; Logger.AddPhaseInformation(Resources.GetString("PhaseLog_CommitApplication")); this._subStore.CommitApplication(ref subState, actDesc); } } return flag; }
private bool DownloadApplication(SubscriptionState subState, ActivationDescription actDesc, long transactionId, out TempDirectory downloadTemp) { Uri uri; string str; bool flag = false; Logger.AddMethodCall("DownloadApplication called."); downloadTemp = this._subStore.AcquireTempDirectory(); Logger.AddInternalState("Start processing application manifest."); AssemblyManifest appManifest = DownloadManager.DownloadApplicationManifest(actDesc.DeployManifest, downloadTemp.Path, actDesc.DeploySourceUri, out uri, out str); AssemblyManifest.ReValidateManifestSignatures(actDesc.DeployManifest, appManifest); if (appManifest.EntryPoints[0].HostInBrowser) { throw new DeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_HostInBrowserAppNotSupported")); } if (appManifest.EntryPoints[0].CustomHostSpecified) { throw new DeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_CustomHostSpecifiedAppNotSupported")); } if (appManifest.EntryPoints[0].CustomUX && (((actDesc.ActType == ActivationType.InstallViaDotApplication) || (actDesc.ActType == ActivationType.InstallViaFileAssociation)) || ((actDesc.ActType == ActivationType.InstallViaShortcut) || (actDesc.ActType == ActivationType.None)))) { throw new DeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_CustomUXAppNotSupported")); } Logger.AddPhaseInformation(Resources.GetString("PhaseLog_ProcessingApplicationManifestComplete")); Logger.AddInternalState("Processing of application manifest has successfully completed."); actDesc.SetApplicationManifest(appManifest, uri, str); Logger.SetApplicationManifest(appManifest); this._subStore.CheckCustomUXFlag(subState, actDesc.AppManifest); actDesc.AppId = new DefinitionAppId(actDesc.ToAppCodebase(), new DefinitionIdentity[] { actDesc.DeployManifest.Identity, actDesc.AppManifest.Identity }); Logger.AddInternalState("Start request of trust and detection of platform."); if (appManifest.EntryPoints[0].CustomUX) { Logger.AddInternalState("This is a CustomUX application. Calling PersistTrustWithoutEvaluation."); actDesc.Trust = ApplicationTrust.PersistTrustWithoutEvaluation(actDesc.ToActivationContext()); } else { this._ui.Hide(); if (this._ui.SplashCancelled()) { throw new DownloadCancelledException(); } if (subState.IsInstalled && !string.Equals(subState.EffectiveCertificatePublicKeyToken, actDesc.EffectiveCertificatePublicKeyToken, StringComparison.Ordinal)) { Logger.AddInternalState("EffectiveCertificatePublicKeyToken has changed between versions: subState.EffectiveCertificatePublicKeyToken=" + subState.EffectiveCertificatePublicKeyToken + ",actDesc.EffectiveCertificatePublicKeyToken=" + actDesc.EffectiveCertificatePublicKeyToken); Logger.AddInternalState("Removing the cached trust decision for CurrentBind."); ApplicationTrust.RemoveCachedTrust(subState.CurrentBind); } try { actDesc.Trust = ApplicationTrust.RequestTrust(subState, actDesc.DeployManifest.Deployment.Install, actDesc.IsUpdate, actDesc.ToActivationContext()); } catch (Exception exception) { Logger.AddErrorInformation(Resources.GetString("Ex_DetermineTrustFailed"), exception); if (!(exception is TrustNotGrantedException)) { try { PlatformDetector.VerifyPlatformDependencies(actDesc.AppManifest, actDesc.DeployManifest, downloadTemp.Path); } catch (Exception exception2) { if (exception2 is DependentPlatformMissingException) { throw new DeploymentException(ExceptionTypes.TrustFailDependentPlatform, string.Format(CultureInfo.CurrentUICulture, Resources.GetString("ErrorMessage_TrustFailDependentPlatformMissing"), new object[] { exception2.Message }), exception); } } } throw; } } this._fullTrust = actDesc.Trust.DefaultGrantSet.PermissionSet.IsUnrestricted(); Logger.AddInternalState("_fullTrust = " + this._fullTrust.ToString()); if (!this._fullTrust && (actDesc.AppManifest.FileAssociations.Length > 0)) { throw new DeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_FileExtensionNotSupported")); } PlatformDetector.VerifyPlatformDependencies(actDesc.AppManifest, actDesc.DeployManifest, downloadTemp.Path); Logger.AddPhaseInformation(Resources.GetString("PhaseLog_PlatformDetectAndTrustGrantComplete")); Logger.AddInternalState("Request of trust and detection of platform is complete."); Logger.AddInternalState("Start downloading and verifying dependencies."); if (!this._subStore.CheckAndReferenceApplication(subState, actDesc.AppId, transactionId)) { flag = true; Description effectiveDescription = actDesc.EffectiveDescription; UserInterfaceInfo info = new UserInterfaceInfo { productName = effectiveDescription.Product }; if (actDesc.IsUpdate) { if (actDesc.IsRequiredUpdate) { info.formTitle = string.Format(CultureInfo.CurrentUICulture, Resources.GetString("UI_ProgressTitleRequiredUpdate"), new object[] { info.productName }); } else { info.formTitle = string.Format(CultureInfo.CurrentUICulture, Resources.GetString("UI_ProgressTitleUpdate"), new object[] { info.productName }); } } else if (!actDesc.DeployManifest.Deployment.Install) { info.formTitle = string.Format(CultureInfo.CurrentUICulture, Resources.GetString("UI_ProgressTitleDownload"), new object[] { info.productName }); } else { info.formTitle = string.Format(CultureInfo.CurrentUICulture, Resources.GetString("UI_ProgressTitleInstall"), new object[] { info.productName }); } info.supportUrl = effectiveDescription.SupportUrl; info.sourceSite = UserInterface.GetDisplaySite(actDesc.DeploySourceUri); if ((appManifest.Description != null) && (appManifest.Description.IconFileFS != null)) { info.iconFilePath = Path.Combine(downloadTemp.Path, appManifest.Description.IconFileFS); } ProgressPiece notification = this._ui.ShowProgress(info); DownloadOptions options = null; bool flag2 = !actDesc.DeployManifest.Deployment.Install; if (!this._fullTrust && flag2) { options = new DownloadOptions { EnforceSizeLimit = true, SizeLimit = this._subStore.GetSizeLimitInBytesForSemiTrustApps(), Size = actDesc.DeployManifest.SizeInBytes + actDesc.AppManifest.SizeInBytes }; } DownloadManager.DownloadDependencies(subState, actDesc.DeployManifest, actDesc.AppManifest, actDesc.AppSourceUri, downloadTemp.Path, null, notification, options); Logger.AddPhaseInformation(Resources.GetString("PhaseLog_DownloadDependenciesComplete")); actDesc.CommitApp = true; actDesc.AppPayloadPath = downloadTemp.Path; actDesc.AppGroup = null; } return flag; }
private bool BindCore(bool blocking, ref TempFile tempDeploy, ref TempDirectory tempAppDir, ref FileStream refTransaction, ref string productName) { try { if (this._deploySource == (Uri)null) { return(this.BindCoreWithAppId(blocking, ref refTransaction, ref productName)); } Uri deploySource = this._deploySource; this._state = DeploymentProgressState.DownloadingDeploymentInformation; Logger.AddInternalState(this._log, "Internal state=" + (object)this._state); AssemblyManifest assemblyManifest1 = DownloadManager.DownloadDeploymentManifest(this._subStore, ref deploySource, out tempDeploy, blocking ? (IDownloadNotification)null : (IDownloadNotification)this, this._downloadOptions); string path = tempDeploy.Path; ActivationDescription actDesc = new ActivationDescription(); actDesc.SetDeploymentManifest(assemblyManifest1, deploySource, path); Logger.SetDeploymentManifest(this._log, assemblyManifest1); actDesc.IsUpdate = this._isupdate; if (actDesc.DeployManifest.Deployment == null) { throw new InvalidDeploymentException(ExceptionTypes.InvalidManifest, Resources.GetString("Ex_NotDeploymentOrShortcut")); } if (!blocking && this._cancellationPending) { return(true); } long transactionId; refTransaction = this._subStore.AcquireReferenceTransaction(out transactionId); SubscriptionState subscriptionState = this._subStore.GetSubscriptionState(actDesc.DeployManifest); if (actDesc.DeployManifest.Deployment.Install && actDesc.DeployManifest.Deployment.ProviderCodebaseUri == (Uri)null && (subscriptionState != null && subscriptionState.DeploymentProviderUri != (Uri)null) && !subscriptionState.DeploymentProviderUri.Equals((object)deploySource)) { throw new DeploymentException(ExceptionTypes.DeploymentUriDifferent, string.Format((IFormatProvider)CultureInfo.CurrentUICulture, Resources.GetString("Ex_DeploymentUriDifferentExText"), new object[3] { (object)actDesc.DeployManifest.Description.FilteredProduct, (object)deploySource.AbsoluteUri, (object)subscriptionState.DeploymentProviderUri.AbsoluteUri })); } DefinitionAppId appId; try { appId = new DefinitionAppId(actDesc.ToAppCodebase(), new DefinitionIdentity[2] { actDesc.DeployManifest.Identity, new DefinitionIdentity(actDesc.DeployManifest.MainDependentAssembly.Identity) }); } catch (COMException ex) { throw new InvalidDeploymentException(ExceptionTypes.InvalidManifest, Resources.GetString("Ex_IdentityIsNotValid"), (Exception)ex); } catch (SEHException ex) { throw new InvalidDeploymentException(ExceptionTypes.InvalidManifest, Resources.GetString("Ex_IdentityIsNotValid"), (Exception)ex); } Logger.AddInternalState(this._log, "expectedAppId=" + appId.ToString()); bool flag1 = this._subStore.CheckAndReferenceApplication(subscriptionState, appId, transactionId); if (flag1 && appId.Equals((object)subscriptionState.CurrentBind)) { Logger.AddInternalState(this._log, "Application is found in store and it is the CurrentBind. Binding with appid."); this._bindAppId = appId; return(this.BindCoreWithAppId(blocking, ref refTransaction, ref productName)); } if (flag1) { Logger.AddInternalState(this._log, "Application is found in store but it is not the CurrentBind."); } else { Logger.AddInternalState(this._log, "Application is not found in store."); } if (!blocking && this._cancellationPending) { return(true); } this._state = DeploymentProgressState.DownloadingApplicationInformation; Logger.AddInternalState(this._log, "Internal state=" + (object)this._state); tempAppDir = this._subStore.AcquireTempDirectory(); Uri appSourceUri; string appManifestPath; AssemblyManifest assemblyManifest2 = DownloadManager.DownloadApplicationManifest(actDesc.DeployManifest, tempAppDir.Path, actDesc.DeploySourceUri, blocking ? (IDownloadNotification)null : (IDownloadNotification)this, this._downloadOptions, out appSourceUri, out appManifestPath); AssemblyManifest.ReValidateManifestSignatures(actDesc.DeployManifest, assemblyManifest2); Logger.SetApplicationManifest(this._log, assemblyManifest2); Logger.SetApplicationUrl(this._log, appSourceUri); actDesc.SetApplicationManifest(assemblyManifest2, appSourceUri, appManifestPath); actDesc.AppId = new DefinitionAppId(actDesc.ToAppCodebase(), new DefinitionIdentity[2] { actDesc.DeployManifest.Identity, actDesc.AppManifest.Identity }); bool flag2 = this._subStore.CheckAndReferenceApplication(subscriptionState, actDesc.AppId, transactionId); if (!blocking && this._cancellationPending) { return(true); } Description effectiveDescription = actDesc.EffectiveDescription; productName = effectiveDescription.Product; this._cached = flag2; Logger.AddInternalState(this._log, "_cached=" + this._cached.ToString()); Logger.AddInternalState(this._log, "_isupdate=" + this._isupdate.ToString()); this._tempApplicationDirectory = tempAppDir; this._tempDeployment = tempDeploy; this._referenceTransaction = refTransaction; this._actCtx = DeploymentManager.ConstructActivationContext(actDesc); this._actDesc = actDesc; } catch (Exception ex) { this.LogError(Resources.GetString("Ex_FailedToDownloadManifest"), ex); Logger.AddInternalState(this._log, "Exception thrown in BindCore(): " + ex.GetType().ToString() + " : " + ex.Message + "\r\n" + ex.StackTrace); throw; } return(false); }
private void CheckDeploymentProviderValidity(ActivationDescription actDesc, SubscriptionState subState) { if ((actDesc.DeployManifest.Deployment.Install && (actDesc.DeployManifest.Deployment.ProviderCodebaseUri == null)) && ((subState != null) && (subState.DeploymentProviderUri != null))) { Uri uri = ((subState.DeploymentProviderUri.Query != null) && (subState.DeploymentProviderUri.Query.Length > 0)) ? new Uri(subState.DeploymentProviderUri.GetLeftPart(UriPartial.Path)) : subState.DeploymentProviderUri; Logger.AddInternalState("Checking deployment provider validity."); Logger.AddInternalState("providerCodebaseUri=" + uri); Logger.AddInternalState("actDesc.ToAppCodebase()=" + actDesc.ToAppCodebase()); if (!uri.Equals(actDesc.ToAppCodebase())) { throw new DeploymentException(ExceptionTypes.DeploymentUriDifferent, string.Format(CultureInfo.CurrentUICulture, Resources.GetString("ErrorMessage_DeploymentUriDifferent"), new object[] { actDesc.DeployManifest.Description.FilteredProduct }), new DeploymentException(ExceptionTypes.DeploymentUriDifferent, string.Format(CultureInfo.CurrentUICulture, Resources.GetString("Ex_DeploymentUriDifferentExText"), new object[] { actDesc.DeployManifest.Description.FilteredProduct, actDesc.DeploySourceUri.AbsoluteUri, subState.DeploymentProviderUri.AbsoluteUri }))); } } }