GetEnumerator() 공개 메소드

public GetEnumerator ( ) : ApplicationTrustEnumerator
리턴 ApplicationTrustEnumerator
예제 #1
0
        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;
            }
        }
        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);
        }
예제 #3
0
		internal ApplicationTrustEnumerator (ApplicationTrustCollection collection)
		{
			e = collection.GetEnumerator ();
		}
 internal ApplicationTrustEnumerator(ApplicationTrustCollection collection)
 {
     e = collection.GetEnumerator();
 }
 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;
     }
 }