public void AddRange(ApplicationTrustCollection trusts) { if (trusts == null) { throw new ArgumentNullException("trusts"); } int num = 0; try { ApplicationTrustEnumerator enumerator = trusts.GetEnumerator(); while (enumerator.MoveNext()) { ApplicationTrust current = enumerator.Current; this.Add(current); num++; } } catch { for (int i = 0; i < num; i++) { this.Remove(trusts[i]); } throw; } }
public ApplicationTrustCollection Find(ApplicationIdentity applicationIdentity, ApplicationVersionMatch versionMatch) { ApplicationTrustCollection trusts = new ApplicationTrustCollection(false); ApplicationTrustEnumerator enumerator = this.GetEnumerator(); while (enumerator.MoveNext()) { ApplicationTrust current = enumerator.Current; if (CmsUtils.CompareIdentities(current.ApplicationIdentity, applicationIdentity, versionMatch)) { trusts.Add(current); } } return(trusts); }
private static bool SearchPreviousTrustedVersion(ActivationContext activationContext, ApplicationIdentity previousAppId, out ArrayList matchingTrusts) { matchingTrusts = null; ApplicationTrustCollection userApplicationTrusts = ApplicationSecurityManager.UserApplicationTrusts; ApplicationTrustEnumerator enumerator = userApplicationTrusts.GetEnumerator(); while (enumerator.MoveNext()) { ApplicationTrust current = enumerator.Current; System.Deployment.Internal.Isolation.IDefinitionAppId id = System.Deployment.Internal.Isolation.IsolationInterop.AppIdAuthority.TextToDefinition(0, current.ApplicationIdentity.FullName); System.Deployment.Internal.Isolation.IDefinitionAppId id2 = System.Deployment.Internal.Isolation.IsolationInterop.AppIdAuthority.TextToDefinition(0, activationContext.Identity.FullName); if (System.Deployment.Internal.Isolation.IsolationInterop.AppIdAuthority.AreDefinitionsEqual(1, id, id2)) { if (matchingTrusts == null) { matchingTrusts = new ArrayList(); } matchingTrusts.Add(current); } } if (previousAppId != null) { ApplicationTrustEnumerator enumerator2 = userApplicationTrusts.GetEnumerator(); while (enumerator2.MoveNext()) { ApplicationTrust trust2 = enumerator2.Current; System.Deployment.Internal.Isolation.IDefinitionAppId id3 = System.Deployment.Internal.Isolation.IsolationInterop.AppIdAuthority.TextToDefinition(0, trust2.ApplicationIdentity.FullName); System.Deployment.Internal.Isolation.IDefinitionAppId id4 = System.Deployment.Internal.Isolation.IsolationInterop.AppIdAuthority.TextToDefinition(0, previousAppId.FullName); if (System.Deployment.Internal.Isolation.IsolationInterop.AppIdAuthority.AreDefinitionsEqual(1, id3, id4)) { if (matchingTrusts == null) { matchingTrusts = new ArrayList(); } matchingTrusts.Add(trust2); } } } return(matchingTrusts != null); }