private ComponentStore(ComponentStoreType storeType, SubscriptionStore subStore) { if (storeType != ComponentStoreType.UserStore) { throw new NotImplementedException(); } this._storeType = storeType; this._subStore = subStore; this._store = System.Deployment.Internal.Isolation.IsolationInterop.GetUserStore(); Guid guidOfType = System.Deployment.Internal.Isolation.IsolationInterop.GetGuidOfType(typeof(System.Deployment.Internal.Isolation.IStateManager)); this._stateMgr = System.Deployment.Internal.Isolation.IsolationInterop.GetUserStateManager(0, IntPtr.Zero, ref guidOfType) as System.Deployment.Internal.Isolation.IStateManager; this._firstRefresh = true; }
private static AssemblyManifest DownloadDeploymentManifestDirect(SubscriptionStore subStore, ref Uri sourceUri, out TempFile tempFile, IDownloadNotification notification, DownloadOptions options, out ServerInformation serverInformation) { Logger.AddMethodCall("DownloadDeploymentManifestDirect(" + sourceUri + ") called."); tempFile = subStore.AcquireTempFile(".application"); AssemblyManifest manifest = DownloadManifest(ref sourceUri, tempFile.Path, notification, options, AssemblyManifest.ManifestType.Deployment, out serverInformation); if (manifest.Identity.Version == null) { throw new InvalidDeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_DeploymentManifestNoVersion")); } if (manifest.Deployment == null) { throw new InvalidDeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_InvalidDeploymentManifest")); } return manifest; }
public static AssemblyManifest DownloadDeploymentManifestBypass(SubscriptionStore subStore, ref Uri sourceUri, out TempFile tempFile, out SubscriptionState subState, IDownloadNotification notification, DownloadOptions options) { AssemblyManifest manifest; Logger.AddMethodCall("DownloadDeploymentManifestBypass called."); tempFile = null; subState = null; TempFile file = null; TempFile file2 = null; try { ServerInformation information; manifest = DownloadDeploymentManifestDirectBypass(subStore, ref sourceUri, out file, out subState, notification, options, out information); Logger.SetSubscriptionServerInformation(information); if (subState != null) { tempFile = file; return manifest; } bool flag = FollowDeploymentProviderUri(subStore, ref manifest, ref sourceUri, out file2, notification, options); tempFile = flag ? file2 : file; } finally { if ((file != null) && (file != tempFile)) { file.Dispose(); } if ((file2 != null) && (file2 != tempFile)) { file2.Dispose(); } } return manifest; }
public static AssemblyManifest DownloadDeploymentManifest(SubscriptionStore subStore, ref Uri sourceUri, out TempFile tempFile, IDownloadNotification notification, DownloadOptions options) { AssemblyManifest manifest; Logger.AddMethodCall("DownloadDeploymentManifest called."); Logger.AddInternalState("SourceUri=" + sourceUri); Logger.AddInternalState("DownloadOptions=" + ((options != null) ? options.ToString() : "null")); tempFile = null; TempFile file = null; TempFile file2 = null; try { ServerInformation information; manifest = DownloadDeploymentManifestDirect(subStore, ref sourceUri, out file, notification, options, out information); Logger.SetSubscriptionServerInformation(information); bool flag = FollowDeploymentProviderUri(subStore, ref manifest, ref sourceUri, out file2, notification, options); tempFile = flag ? file2 : file; } finally { if ((file != null) && (file != tempFile)) { file.Dispose(); file = null; } if ((file2 != null) && (file2 != tempFile)) { file2.Dispose(); file2 = null; } } return manifest; }
public static AssemblyManifest DownloadDeploymentManifest(SubscriptionStore subStore, ref Uri sourceUri, out TempFile tempFile) { return DownloadDeploymentManifest(subStore, ref sourceUri, out tempFile, null, null); }
public void CommitApplication(ref SubscriptionState subState, CommitApplicationParams commitParams) { Logger.AddMethodCall("CommitApplication called."); using (this.AcquireSubscriptionWriterLock(subState)) { if (commitParams.CommitDeploy) { Logger.AddInternalState("Commiting Deployment : subscription metadata."); UriHelper.ValidateSupportedScheme(commitParams.DeploySourceUri); this.CheckDeploymentSubscriptionState(subState, commitParams.DeployManifest); this.ValidateFileAssoctiation(subState, commitParams); if (commitParams.IsUpdate && !commitParams.IsUpdateInPKTGroup) { SubscriptionStore.CheckInstalled(subState); } } if (commitParams.CommitApp) { Logger.AddInternalState("Commiting Application: application binaries."); UriHelper.ValidateSupportedScheme(commitParams.AppSourceUri); if (commitParams.AppGroup != null) { SubscriptionStore.CheckInstalled(subState); } this.CheckApplicationPayload(commitParams); } bool flag = false; bool identityGroupFound = false; bool locationGroupFound = false; string identityGroupProductName = ""; ArrayList arrayList = this._compStore.CollectCrossGroupApplications(commitParams.DeploySourceUri, commitParams.DeployManifest.Identity, ref identityGroupFound, ref locationGroupFound, ref identityGroupProductName); if (arrayList.Count > 0) { flag = true; Logger.AddInternalState("This installation is a Cross Group: identityGroupFound=" + identityGroupFound.ToString() + ",locationGroupFound=" + locationGroupFound.ToString()); } if (subState.IsShellVisible & identityGroupFound & locationGroupFound) { throw new DeploymentException(ExceptionTypes.GroupMultipleMatch, string.Format((IFormatProvider)CultureInfo.CurrentUICulture, Resources.GetString("Ex_GroupMultipleMatch"), new object[1] { (object)identityGroupProductName })); } subState = this.GetSubscriptionState(commitParams.DeployManifest); this._compStore.CommitApplication(subState, commitParams); if (flag) { Logger.AddInternalState("Performing cross group migration."); IActContext actContext = IsolationInterop.CreateActContext(subState.CurrentBind.ComPointer); actContext.PrepareForExecution(IntPtr.Zero, IntPtr.Zero); uint ulDisposition; actContext.SetApplicationRunningState(0U, 1U, out ulDisposition); actContext.SetApplicationRunningState(0U, 2U, out ulDisposition); Logger.AddInternalState("Uninstalling all cross groups."); foreach (ComponentStore.CrossGroupApplicationData groupApplicationData in arrayList) { if (groupApplicationData.CrossGroupType == ComponentStore.CrossGroupApplicationData.GroupType.LocationGroup) { if (groupApplicationData.SubState.appType == AppType.CustomHostSpecified) { Logger.AddInternalState("UninstallCustomHostSpecifiedSubscription : " + (groupApplicationData.SubState.SubscriptionId != null ? groupApplicationData.SubState.SubscriptionId.ToString() : "null")); this.UninstallCustomHostSpecifiedSubscription(groupApplicationData.SubState); } else if (groupApplicationData.SubState.appType == AppType.CustomUX) { Logger.AddInternalState("UninstallCustomUXSubscription : " + (groupApplicationData.SubState.SubscriptionId != null ? groupApplicationData.SubState.SubscriptionId.ToString() : "null")); this.UninstallCustomUXSubscription(groupApplicationData.SubState); } else if (groupApplicationData.SubState.IsShellVisible) { Logger.AddInternalState("UninstallSubscription : " + (groupApplicationData.SubState.SubscriptionId != null ? groupApplicationData.SubState.SubscriptionId.ToString() : "null")); this.UninstallSubscription(groupApplicationData.SubState); } } else if (groupApplicationData.CrossGroupType == ComponentStore.CrossGroupApplicationData.GroupType.IdentityGroup) { Logger.AddInternalState("Not uninstalled :" + (groupApplicationData.SubState.SubscriptionId != null ? groupApplicationData.SubState.SubscriptionId.ToString() : "null") + ". It is in the identity group."); } } } if (commitParams.IsConfirmed && subState.IsInstalled && (subState.IsShellVisible && commitParams.appType != AppType.CustomUX)) { this.UpdateSubscriptionExposure(subState); } if (commitParams.appType == AppType.CustomUX) { ShellExposure.ShellExposureInformation exposureInformation = ShellExposure.ShellExposureInformation.CreateShellExposureInformation(subState.SubscriptionId); ShellExposure.UpdateShellExtensions(subState, ref exposureInformation); } SubscriptionStore.OnDeploymentAdded(subState); } }
public void CheckInstalledAndShellVisible(SubscriptionState subState) { SubscriptionStore.CheckInstalled(subState); SubscriptionStore.CheckShellVisible(subState); }
public static ComponentStore GetStore(ComponentStoreType storeType, SubscriptionStore subStore) { return new ComponentStore(storeType, subStore); }
private static AssemblyManifest DownloadDeploymentManifestDirectBypass(SubscriptionStore subStore, ref Uri sourceUri, out TempFile tempFile, out SubscriptionState subState, IDownloadNotification notification, DownloadOptions options, out ServerInformation serverInformation) { Logger.AddMethodCall("DownloadDeploymentManifestDirectBypass called."); subState = (SubscriptionState)null; tempFile = subStore.AcquireTempFile(".application"); DownloadManager.DownloadManifestAsRawFile(ref sourceUri, tempFile.Path, notification, options, out serverInformation); bool flag1 = false; AssemblyManifest deployment = (AssemblyManifest)null; DefinitionAppId appId = (DefinitionAppId)null; try { deployment = ManifestReader.FromDocumentNoValidation(tempFile.Path); DefinitionIdentity identity = deployment.Identity; DefinitionIdentity definitionIdentity = new DefinitionIdentity(deployment.MainDependentAssembly.Identity); appId = new DefinitionAppId((sourceUri.Query == null || sourceUri.Query.Length <= 0 ? sourceUri : new Uri(sourceUri.GetLeftPart(UriPartial.Path))).AbsoluteUri, new DefinitionIdentity[2] { identity, definitionIdentity }); Logger.AddInternalState("expectedAppId=" + appId.ToString()); } catch (InvalidDeploymentException ex) { flag1 = true; } catch (COMException ex) { flag1 = true; } catch (SEHException ex) { flag1 = true; } catch (IndexOutOfRangeException ex) { flag1 = true; } if (!flag1) { SubscriptionState subscriptionState = subStore.GetSubscriptionState(deployment); bool flag2 = false; long transactionId; using (subStore.AcquireReferenceTransaction(out transactionId)) flag2 = subStore.CheckAndReferenceApplication(subscriptionState, appId, transactionId); if (!flag2 || !appId.Equals((object)subscriptionState.CurrentBind)) { if (flag2) { Logger.AddInternalState("Application is found in store and but it is not the CurrentBind."); } } else { Logger.AddInternalState("Application is found in store and it is the CurrentBind, bypass validation and further downloads."); subState = subscriptionState; return(subState.CurrentDeploymentManifest); } } else { Logger.AddInternalState("Application is not found in store."); } Logger.AddInternalState("Reparse the deployment manifest for validations."); AssemblyManifest assemblyManifest = ManifestReader.FromDocument(tempFile.Path, AssemblyManifest.ManifestType.Deployment, sourceUri); if (assemblyManifest.Identity.Version == (Version)null) { throw new InvalidDeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_DeploymentManifestNoVersion")); } if (assemblyManifest.Deployment == null) { throw new InvalidDeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_InvalidDeploymentManifest")); } return(assemblyManifest); }
public static AssemblyManifest DownloadDeploymentManifest(SubscriptionStore subStore, ref Uri sourceUri, out TempFile tempFile) { return(DownloadManager.DownloadDeploymentManifest(subStore, ref sourceUri, out tempFile, (IDownloadNotification)null, (DownloadOptions)null)); }
private ApplicationDeployment(string fullAppId) { if (fullAppId.Length > 0x10000) { throw new InvalidDeploymentException(Resources.GetString("Ex_AppIdTooLong")); } try { this._fullAppId = new DefinitionAppId(fullAppId); } catch (COMException exception) { throw new InvalidDeploymentException(string.Format(CultureInfo.CurrentUICulture, Resources.GetString("Ex_SubAppIdNotValid"), new object[] { fullAppId }), exception); } catch (SEHException exception2) { throw new InvalidDeploymentException(string.Format(CultureInfo.CurrentUICulture, Resources.GetString("Ex_SubAppIdNotValid"), new object[] { fullAppId }), exception2); } DefinitionIdentity deploymentIdentity = this._fullAppId.DeploymentIdentity; this._currentVersion = deploymentIdentity.Version; DefinitionIdentity subId = deploymentIdentity.ToSubscriptionId(); this._subStore = SubscriptionStore.CurrentUser; this._subState = this._subStore.GetSubscriptionState(subId); if (!this._subState.IsInstalled) { throw new InvalidDeploymentException(Resources.GetString("Ex_SubNotInstalled")); } if (!this._fullAppId.Equals(this._subState.CurrentBind)) { throw new InvalidDeploymentException(Resources.GetString("Ex_AppIdNotMatchInstalled")); } Uri uri = new Uri(this._fullAppId.Codebase); if (uri.IsFile) { this.accessPermission = new FileIOPermission(FileIOPermissionAccess.Read, uri.LocalPath); } else { this.accessPermission = new WebPermission(NetworkAccess.Connect, this._fullAppId.Codebase); } this.accessPermission.Demand(); this._events = new EventHandlerList(); this.asyncOperation = AsyncOperationManager.CreateOperation(null); }
internal DeploymentManager(Uri deploymentSource, bool isUpdate, bool isConfirmed, DownloadOptions downloadOptions, AsyncOperation optionalAsyncOp) { this._trustNotGrantedEvent = new ManualResetEvent(false); this._trustGrantedEvent = new ManualResetEvent(false); this._platformRequirementsFailedEvent = new ManualResetEvent(false); this._isConfirmed = true; this._state = DeploymentProgressState.DownloadingApplicationFiles; 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); if (optionalAsyncOp == null) { this.asyncOperation = AsyncOperationManager.CreateOperation(null); } else { this.asyncOperation = optionalAsyncOp; } this._log = Logger.StartLogging(); if (deploymentSource != null) { Logger.SetSubscriptionUrl(this._log, deploymentSource); } this._assertApplicationReqEvents = new ManualResetEvent[] { this._trustNotGrantedEvent, this._platformRequirementsFailedEvent, this._trustGrantedEvent }; this._callerType = CallerType.Other; PolicyKeys.SkipApplicationDependencyHashCheck(); PolicyKeys.SkipDeploymentProvider(); PolicyKeys.SkipSchemaValidation(); PolicyKeys.SkipSemanticValidation(); PolicyKeys.SkipSignatureValidation(); }
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(); } } }
public static bool FollowDeploymentProviderUri(SubscriptionStore subStore, ref AssemblyManifest deployment, ref Uri sourceUri, out TempFile tempFile, IDownloadNotification notification, DownloadOptions options) { Logger.AddMethodCall("FollowDeploymentProviderUri called."); tempFile = null; bool flag = false; Zone zone = Zone.CreateFromUrl(sourceUri.AbsoluteUri); bool flag2 = false; if (zone.SecurityZone != SecurityZone.MyComputer) { Logger.AddInternalState("Deployment manifest zone is not local machine. Zone = " + zone.SecurityZone); flag2 = true; } else { Logger.AddInternalState("Deployment manifest zone is local machine. Zone = " + zone.SecurityZone); DependentAssembly mainDependentAssembly = deployment.MainDependentAssembly; if ((mainDependentAssembly == null) || (mainDependentAssembly.Codebase == null)) { throw new InvalidDeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_NoAppInDeploymentManifest")); } Uri uri = new Uri(sourceUri, mainDependentAssembly.Codebase); Zone zone2 = Zone.CreateFromUrl(uri.AbsoluteUri); if (zone2.SecurityZone == SecurityZone.MyComputer) { Logger.AddInternalState("Application manifest zone is local machine. Zone = " + zone2.SecurityZone); if (!System.IO.File.Exists(uri.LocalPath)) { Logger.AddInternalState(uri.LocalPath + " does not exist in local machine."); flag2 = true; } } } if (flag2) { Uri providerCodebaseUri = deployment.Deployment.ProviderCodebaseUri; Logger.SetDeploymentProviderUrl(providerCodebaseUri); Logger.AddInternalState(string.Concat(new object[] { "providerUri=", providerCodebaseUri, ",sourceUri=", sourceUri })); if ((!PolicyKeys.SkipDeploymentProvider() && (providerCodebaseUri != null)) && !providerCodebaseUri.Equals(sourceUri)) { ServerInformation information; AssemblyManifest manifest = null; try { manifest = DownloadDeploymentManifestDirect(subStore, ref providerCodebaseUri, out tempFile, notification, options, out information); } catch (InvalidDeploymentException exception) { if (((exception.SubType != ExceptionTypes.Manifest) && (exception.SubType != ExceptionTypes.ManifestLoad)) && ((exception.SubType != ExceptionTypes.ManifestParse) && (exception.SubType != ExceptionTypes.ManifestSemanticValidation))) { throw; } throw new InvalidDeploymentException(ExceptionTypes.Manifest, Resources.GetString("Ex_InvalidProviderManifest"), exception); } Logger.SetDeploymentProviderServerInformation(information); SubscriptionState subscriptionState = subStore.GetSubscriptionState(deployment); if (!subStore.GetSubscriptionState(manifest).SubscriptionId.Equals(subscriptionState.SubscriptionId)) { throw new InvalidDeploymentException(ExceptionTypes.SubscriptionSemanticValidation, Resources.GetString("Ex_ProviderNotInSubscription")); } Logger.AddInternalState("Deployment provider followed: " + providerCodebaseUri); deployment = manifest; sourceUri = providerCodebaseUri; flag = true; } } if (!flag) { Logger.AddInternalState("Deployment provider not followed."); } return(flag); }
public static AssemblyManifest DownloadDeploymentManifest(SubscriptionStore subStore, ref Uri sourceUri, out TempFile tempFile) { return(DownloadDeploymentManifest(subStore, ref sourceUri, out tempFile, null, null)); }
private static AssemblyManifest DownloadDeploymentManifestDirectBypass(SubscriptionStore subStore, ref Uri sourceUri, out TempFile tempFile, out SubscriptionState subState, IDownloadNotification notification, DownloadOptions options, out ServerInformation serverInformation) { Logger.AddMethodCall("DownloadDeploymentManifestDirectBypass called."); subState = null; tempFile = subStore.AcquireTempFile(".application"); DownloadManifestAsRawFile(ref sourceUri, tempFile.Path, notification, options, out serverInformation); bool flag = false; AssemblyManifest deployment = null; DefinitionIdentity identity = null; DefinitionIdentity identity2 = null; DefinitionAppId appId = null; try { deployment = ManifestReader.FromDocumentNoValidation(tempFile.Path); identity = deployment.Identity; identity2 = new DefinitionIdentity(deployment.MainDependentAssembly.Identity); Uri uri = ((sourceUri.Query != null) && (sourceUri.Query.Length > 0)) ? new Uri(sourceUri.GetLeftPart(UriPartial.Path)) : sourceUri; appId = new DefinitionAppId(uri.AbsoluteUri, new DefinitionIdentity[] { identity, identity2 }); Logger.AddInternalState("expectedAppId=" + appId.ToString()); } catch (InvalidDeploymentException) { flag = true; } catch (COMException) { flag = true; } catch (SEHException) { flag = true; } catch (IndexOutOfRangeException) { flag = true; } if (!flag) { long num; SubscriptionState subscriptionState = subStore.GetSubscriptionState(deployment); bool flag2 = false; using (subStore.AcquireReferenceTransaction(out num)) { flag2 = subStore.CheckAndReferenceApplication(subscriptionState, appId, num); } if (flag2 && appId.Equals(subscriptionState.CurrentBind)) { Logger.AddInternalState("Application is found in store and it is the CurrentBind, bypass validation and further downloads."); subState = subscriptionState; return subState.CurrentDeploymentManifest; } flag = true; if (flag2) { Logger.AddInternalState("Application is found in store and but it is not the CurrentBind."); } } else { Logger.AddInternalState("Application is not found in store."); } Logger.AddInternalState("Reparse the deployment manifest for validations."); AssemblyManifest manifest2 = ManifestReader.FromDocument(tempFile.Path, AssemblyManifest.ManifestType.Deployment, sourceUri); if (manifest2.Identity.Version == null) { throw new InvalidDeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_DeploymentManifestNoVersion")); } if (manifest2.Deployment == null) { throw new InvalidDeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_InvalidDeploymentManifest")); } return manifest2; }
public static bool FollowDeploymentProviderUri(SubscriptionStore subStore, ref AssemblyManifest deployment, ref Uri sourceUri, out TempFile tempFile, IDownloadNotification notification, DownloadOptions options) { Logger.AddMethodCall("FollowDeploymentProviderUri called."); tempFile = null; bool flag = false; Zone zone = Zone.CreateFromUrl(sourceUri.AbsoluteUri); bool flag2 = false; if (zone.SecurityZone != SecurityZone.MyComputer) { Logger.AddInternalState("Deployment manifest zone is not local machine. Zone = " + zone.SecurityZone); flag2 = true; } else { Logger.AddInternalState("Deployment manifest zone is local machine. Zone = " + zone.SecurityZone); DependentAssembly mainDependentAssembly = deployment.MainDependentAssembly; if ((mainDependentAssembly == null) || (mainDependentAssembly.Codebase == null)) { throw new InvalidDeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_NoAppInDeploymentManifest")); } Uri uri = new Uri(sourceUri, mainDependentAssembly.Codebase); Zone zone2 = Zone.CreateFromUrl(uri.AbsoluteUri); if (zone2.SecurityZone == SecurityZone.MyComputer) { Logger.AddInternalState("Application manifest zone is local machine. Zone = " + zone2.SecurityZone); if (!System.IO.File.Exists(uri.LocalPath)) { Logger.AddInternalState(uri.LocalPath + " does not exist in local machine."); flag2 = true; } } } if (flag2) { Uri providerCodebaseUri = deployment.Deployment.ProviderCodebaseUri; Logger.SetDeploymentProviderUrl(providerCodebaseUri); Logger.AddInternalState(string.Concat(new object[] { "providerUri=", providerCodebaseUri, ",sourceUri=", sourceUri })); if ((!PolicyKeys.SkipDeploymentProvider() && (providerCodebaseUri != null)) && !providerCodebaseUri.Equals(sourceUri)) { ServerInformation information; AssemblyManifest manifest = null; try { manifest = DownloadDeploymentManifestDirect(subStore, ref providerCodebaseUri, out tempFile, notification, options, out information); } catch (InvalidDeploymentException exception) { if (((exception.SubType != ExceptionTypes.Manifest) && (exception.SubType != ExceptionTypes.ManifestLoad)) && ((exception.SubType != ExceptionTypes.ManifestParse) && (exception.SubType != ExceptionTypes.ManifestSemanticValidation))) { throw; } throw new InvalidDeploymentException(ExceptionTypes.Manifest, Resources.GetString("Ex_InvalidProviderManifest"), exception); } Logger.SetDeploymentProviderServerInformation(information); SubscriptionState subscriptionState = subStore.GetSubscriptionState(deployment); if (!subStore.GetSubscriptionState(manifest).SubscriptionId.Equals(subscriptionState.SubscriptionId)) { throw new InvalidDeploymentException(ExceptionTypes.SubscriptionSemanticValidation, Resources.GetString("Ex_ProviderNotInSubscription")); } Logger.AddInternalState("Deployment provider followed: " + providerCodebaseUri); deployment = manifest; sourceUri = providerCodebaseUri; flag = true; } } if (!flag) { Logger.AddInternalState("Deployment provider not followed."); } return flag; }
public static bool FollowDeploymentProviderUri(SubscriptionStore subStore, ref AssemblyManifest deployment, ref Uri sourceUri, out TempFile tempFile, IDownloadNotification notification, DownloadOptions options) { Logger.AddMethodCall("FollowDeploymentProviderUri called."); tempFile = (TempFile)null; bool flag1 = false; Zone fromUrl1 = Zone.CreateFromUrl(sourceUri.AbsoluteUri); bool flag2 = false; if (fromUrl1.SecurityZone != SecurityZone.MyComputer) { Logger.AddInternalState("Deployment manifest zone is not local machine. Zone = " + (object)fromUrl1.SecurityZone); flag2 = true; } else { Logger.AddInternalState("Deployment manifest zone is local machine. Zone = " + (object)fromUrl1.SecurityZone); DependentAssembly dependentAssembly = deployment.MainDependentAssembly; if (dependentAssembly == null || dependentAssembly.Codebase == null) { throw new InvalidDeploymentException(ExceptionTypes.ManifestSemanticValidation, Resources.GetString("Ex_NoAppInDeploymentManifest")); } Uri uri = new Uri(sourceUri, dependentAssembly.Codebase); Zone fromUrl2 = Zone.CreateFromUrl(uri.AbsoluteUri); if (fromUrl2.SecurityZone == SecurityZone.MyComputer) { Logger.AddInternalState("Application manifest zone is local machine. Zone = " + (object)fromUrl2.SecurityZone); if (!System.IO.File.Exists(uri.LocalPath)) { Logger.AddInternalState(uri.LocalPath + " does not exist in local machine."); flag2 = true; } } } if (flag2) { Uri providerCodebaseUri = deployment.Deployment.ProviderCodebaseUri; Logger.SetDeploymentProviderUrl(providerCodebaseUri); Logger.AddInternalState("providerUri=" + (object)providerCodebaseUri + ",sourceUri=" + (object)sourceUri); if (!PolicyKeys.SkipDeploymentProvider() && providerCodebaseUri != (Uri)null && !providerCodebaseUri.Equals((object)sourceUri)) { ServerInformation serverInformation; AssemblyManifest deployment1; try { deployment1 = DownloadManager.DownloadDeploymentManifestDirect(subStore, ref providerCodebaseUri, out tempFile, notification, options, out serverInformation); } catch (InvalidDeploymentException ex) { if (ex.SubType == ExceptionTypes.Manifest || ex.SubType == ExceptionTypes.ManifestLoad || (ex.SubType == ExceptionTypes.ManifestParse || ex.SubType == ExceptionTypes.ManifestSemanticValidation)) { throw new InvalidDeploymentException(ExceptionTypes.Manifest, Resources.GetString("Ex_InvalidProviderManifest"), (Exception)ex); } throw; } Logger.SetDeploymentProviderServerInformation(serverInformation); SubscriptionState subscriptionState = subStore.GetSubscriptionState(deployment); if (!subStore.GetSubscriptionState(deployment1).SubscriptionId.Equals((object)subscriptionState.SubscriptionId)) { throw new InvalidDeploymentException(ExceptionTypes.SubscriptionSemanticValidation, Resources.GetString("Ex_ProviderNotInSubscription")); } Logger.AddInternalState("Deployment provider followed: " + (object)providerCodebaseUri); deployment = deployment1; sourceUri = providerCodebaseUri; flag1 = true; } } if (!flag1) { Logger.AddInternalState("Deployment provider not followed."); } return(flag1); }