private void CommitApplicationTrust(ApplicationIdentity applicationIdentity, string trustXml) { StoreOperationMetadataProperty[] properties = new StoreOperationMetadataProperty[] { new StoreOperationMetadataProperty(ClrPropertySet, ApplicationTrustProperty, trustXml) }; IEnumDefinitionIdentity idenum = applicationIdentity.Identity.EnumAppPath(); IDefinitionIdentity[] asbId = new IDefinitionIdentity[1]; IDefinitionIdentity deplId = null; if (idenum.Next(1, asbId) == 1) deplId = asbId[0]; IDefinitionAppId defAppId = IsolationInterop.AppIdAuthority.CreateDefinition(); defAppId.SetAppPath(1, new IDefinitionIdentity[] {deplId}); defAppId.put_Codebase(applicationIdentity.CodeBase); using (StoreTransaction storeTxn = new StoreTransaction()) { storeTxn.Add(new StoreOperationSetDeploymentMetadata(defAppId, InstallReference, properties)); RefreshStorePointer(); m_pStore.Transact(storeTxn.Operations); } m_appTrusts = null; // reset the app trusts in the collection. }
private void CommitApplicationTrust(ApplicationIdentity applicationIdentity, string trustXml) { StoreOperationMetadataProperty[] setProperties = new StoreOperationMetadataProperty[] { new StoreOperationMetadataProperty(ClrPropertySet, "ApplicationTrust", trustXml) }; IEnumDefinitionIdentity identity = applicationIdentity.Identity.EnumAppPath(); IDefinitionIdentity[] definitionIdentity = new IDefinitionIdentity[1]; IDefinitionIdentity identity2 = null; if (identity.Next(1, definitionIdentity) == 1) { identity2 = definitionIdentity[0]; } IDefinitionAppId deployment = IsolationInterop.AppIdAuthority.CreateDefinition(); deployment.SetAppPath(1, new IDefinitionIdentity[] { identity2 }); deployment.put_Codebase(applicationIdentity.CodeBase); using (StoreTransaction transaction = new StoreTransaction()) { transaction.Add(new StoreOperationSetDeploymentMetadata(deployment, InstallReference, setProperties)); this.RefreshStorePointer(); this.m_pStore.Transact(transaction.Operations); } this.m_appTrusts = null; }