当前位置: 首页>>代码示例>>C#>>正文


C# Evidence.GetHostEnumerator方法代码示例

本文整理汇总了C#中System.Security.Policy.Evidence.GetHostEnumerator方法的典型用法代码示例。如果您正苦于以下问题:C# Evidence.GetHostEnumerator方法的具体用法?C# Evidence.GetHostEnumerator怎么用?C# Evidence.GetHostEnumerator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Security.Policy.Evidence的用法示例。


在下文中一共展示了Evidence.GetHostEnumerator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Check

	// Implement the IMembership interface.
	public bool Check(Evidence evidence)
			{
				if(evidence == null)
				{
					return false;
				}
				IEnumerator e = evidence.GetHostEnumerator();
				IEnumerator e2;
				while(e.MoveNext())
				{
					ApplicationDirectory appDir =
						(e.Current as ApplicationDirectory);
					if(appDir != null)
					{
						e2 = evidence.GetHostEnumerator();
						while(e2.MoveNext())
						{
							Url url = (e2.Current as Url);
							if(url != null)
							{
								if(Match(url.parser, appDir.Directory))
								{
									return true;
								}
							}
						}
					}
				}
				return false;
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:31,代码来源:ApplicationDirectoryMembershipCondition.cs

示例2: Check

     //------------------------------------------------------
     //
     // IMEMBERSHIPCONDITION IMPLEMENTATION
     //
     //------------------------------------------------------
 
     /// <include file='doc\ApplicationDirectoryMembershipCondition.uex' path='docs/doc[@for="ApplicationDirectoryMembershipCondition.Check"]/*' />
     public bool Check( Evidence evidence )
     {
         if (evidence == null)
             return false;
     
         IEnumerator enumerator = evidence.GetHostEnumerator();
         while (enumerator.MoveNext())
         {
             Object obj = enumerator.Current;
         
             if (obj is ApplicationDirectory)
             {
                 ApplicationDirectory dir = (ApplicationDirectory)obj;
             
                 IEnumerator innerEnumerator = evidence.GetHostEnumerator();
                 
                 while (innerEnumerator.MoveNext())
                 {
                     Object innerObj = innerEnumerator.Current;
                     
                     if (innerObj is Url)
                     {
                         // We need to add a wildcard at the end because IsSubsetOf
                         // keys off of it.
                         
                         String appDir = dir.Directory;
                         
                         if (appDir != null && appDir.Length > 1)
                         {
                             if (appDir[appDir.Length-1] == '/')
                                 appDir += "*";
                             else
                                 appDir += "/*";
                             
                             URLString appDirString = new URLString( appDir );
                         
                             if (((Url)innerObj).GetURLString().IsSubsetOf( appDirString ))
                             {
                                 return true;
                             }
                         }
                     }
                 }
             }
         }
         
         return false;
     }
开发者ID:ArildF,项目名称:masters,代码行数:55,代码来源:applicationdirectorymembershipcondition.cs

示例3: Check

		// Methods
		public bool Check (Evidence evidence)
		{
			if (evidence == null)
				return false;

			string codebase = Assembly.GetCallingAssembly ().CodeBase;
			Uri local = new Uri (codebase);
			Url ucode = new Url (codebase);

			// *both* ApplicationDirectory and Url must be in *Host* evidences
			bool adir = false;
			bool url = false;
			IEnumerator e = evidence.GetHostEnumerator ();
			while (e.MoveNext ()) {
				object o = e.Current;

				if (!adir && (o is ApplicationDirectory)) {
					ApplicationDirectory ad = (o as ApplicationDirectory);
					string s = ad.Directory;
					adir = (String.Compare (s, 0, local.ToString (), 0, s.Length, true, CultureInfo.InvariantCulture) == 0);
				}
				else if (!url && (o is Url)) {
					url = ucode.Equals (o);
				}

				// got both ?
				if (adir && url)
					return true;
			}
			return false;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:32,代码来源:ApplicationDirectoryMembershipCondition.cs

示例4: Resolve

        /// <include file='doc\NetCodeGroup.uex' path='docs/doc[@for="NetCodeGroup.Resolve"]/*' />
        public override PolicyStatement Resolve( Evidence evidence )
        {
            if (evidence == null)
                throw new ArgumentNullException("evidence");
            
            if (this.MembershipCondition.Check( evidence ))
            {
                PolicyStatement thisPolicy = null;
                
                IEnumerator evidenceEnumerator = evidence.GetHostEnumerator();

                Site site = null;

                while (evidenceEnumerator.MoveNext())
                {
                    Url url = evidenceEnumerator.Current as Url;

                    if (url != null)
                    {
                        thisPolicy = CalculatePolicy( url.GetURLString().Host, url.GetURLString().Scheme );
                    }
                    else
                    {
                        if (site == null)
                            site = evidenceEnumerator.Current as Site;
                    }
                }

                if (thisPolicy == null && site != null)
                    thisPolicy = CalculatePolicy( site.Name, null );

                if (thisPolicy == null)
                    thisPolicy = new PolicyStatement( new PermissionSet( false ), PolicyStatementAttribute.Nothing );

                IEnumerator enumerator = this.Children.GetEnumerator();

                while (enumerator.MoveNext())
                {
                    PolicyStatement childPolicy = ((CodeGroup)enumerator.Current).Resolve( evidence );

                    if (childPolicy != null)
                    {
                        if (((thisPolicy.Attributes & childPolicy.Attributes) & PolicyStatementAttribute.Exclusive) == PolicyStatementAttribute.Exclusive)
                        {
                            throw new PolicyException( Environment.GetResourceString( "Policy_MultipleExclusive" ) );
                        }

                        thisPolicy.GetPermissionSetNoCopy().InplaceUnion( childPolicy.GetPermissionSetNoCopy() );
                        thisPolicy.Attributes = thisPolicy.Attributes | childPolicy.Attributes;
                    }
                }

                return thisPolicy;
            }           
            else
            {
                return null;
            }
        }        
开发者ID:ArildF,项目名称:masters,代码行数:60,代码来源:netcodegroup.cs

示例5: EvidenceCallMethods

 public static void EvidenceCallMethods()
 {
     Evidence e = new Evidence();
     e = new Evidence(new Evidence());
     e.Clear();
     Evidence e2 = e.Clone();
     System.Collections.IEnumerator ie = e.GetAssemblyEnumerator();
     ie = e.GetHostEnumerator();
     e.Merge(e2);
 }
开发者ID:dotnet,项目名称:corefx,代码行数:10,代码来源:EvidenceTests.cs

示例6: Check

		public bool Check (Evidence evidence)
		{
			if (evidence == null)
				return false;
			
			IEnumerator e = evidence.GetHostEnumerator ();
			while (e.MoveNext ()) {
				// TODO: from samples it seems related to IApplicationDescription and HostContext
				// but some are obsoleted - so this should be moving to ApplicationIdentity ?
			}
			return false;
		}
开发者ID:runefs,项目名称:Marvin,代码行数:12,代码来源:ApplicationMembershipCondition.cs

示例7: DefaultConstructor

		public void DefaultConstructor ()
		{
			Evidence evidence = new Evidence ();
			
			AssertEquals ("Default constructor count should be zero", evidence.Count, 0);
			AssertEquals ("Default constructor host enumerator MoveNext() should be false", 
				evidence.GetHostEnumerator().MoveNext(), false);
			AssertEquals ("Default constructor assembly enumerator MoveNext() should be false",
				evidence.GetAssemblyEnumerator().MoveNext(), false);
			AssertEquals ("Default constructor enumerator MoveNext() should be false",
				evidence.GetEnumerator().MoveNext(), false);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:12,代码来源:EvidenceTest.cs

示例8: Check

		public bool Check (Evidence evidence)
		{
			if (evidence == null)
				return false;

			// true only if Gac is in host-supplied evidences
			IEnumerator e = evidence.GetHostEnumerator ();
			while (e.MoveNext ()) {
				if (e.Current is GacInstalled)
					return true;
			}
			return false;
		}
开发者ID:runefs,项目名称:Marvin,代码行数:13,代码来源:GacMembershipCondition.cs

示例9: Check

		public bool Check (Evidence evidence) 
		{
			if (evidence == null)
				return false;

			IEnumerator e = evidence.GetHostEnumerator ();
			while (e.MoveNext ()) {
				if (e.Current is Publisher) {
					if (x509.Equals ((e.Current as Publisher).Certificate))
						return true;
				}
			}
			return false;
		}
开发者ID:jack-pappas,项目名称:mono,代码行数:14,代码来源:PublisherMembershipCondition.cs

示例10: Check

        //------------------------------------------------------
        //
        // IMEMBERSHIPCONDITION IMPLEMENTATION
        //
        //------------------------------------------------------

        public bool Check( Evidence evidence )
        {
            if (evidence == null)
                return false;

            IEnumerator enumerator = evidence.GetHostEnumerator();
            while (enumerator.MoveNext())
            {
                Object obj = enumerator.Current;
                if (obj is GacInstalled)
                    return true;
            }
            return false;
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:20,代码来源:gacmembershipcondition.cs

示例11: Check

                public bool Check (Evidence evidence)
                {
			if (evidence == null)
				return false;

			IEnumerator e = evidence.GetHostEnumerator ();
			while (e.MoveNext ()) {
				Zone z = (e.Current as Zone);
				if (z != null) {
					if (z.SecurityZone == zone)
						return true;
				}
			}
                        return false;
                }
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:15,代码来源:ZoneMembershipCondition.cs

示例12: Check

	// Implement the IMembership interface.
	public bool Check(Evidence evidence)
			{
				if(evidence == null)
				{
					return false;
				}
				IEnumerator e = evidence.GetHostEnumerator();
				while(e.MoveNext())
				{
					Publisher publisher = (e.Current as Publisher);
					if(publisher != null &&
					   publisher.Certificate.Equals(certificate))
					{
						return true;
					}
				}
				return false;
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:19,代码来源:PublisherMembershipCondition.cs

示例13: Check

	// Implement the IMembership interface.
	public bool Check(Evidence evidence)
			{
				if(evidence == null)
				{
					return false;
				}
				IEnumerator e = evidence.GetHostEnumerator();
				while(e.MoveNext())
				{
					Site s = (e.Current as Site);
					if(s != null)
					{
						if(UrlParser.HostMatches(site, s.Name))
						{
							return true;
						}
					}
				}
				return false;
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:21,代码来源:SiteMembershipCondition.cs

示例14: Check

	// Implement the IMembership interface.
	public bool Check(Evidence evidence)
			{
				if(evidence == null)
				{
					return false;
				}
				IEnumerator e = evidence.GetHostEnumerator();
				while(e.MoveNext())
				{
					Url url = (e.Current as Url);
					if(url != null)
					{
						if(parser.Matches(url.parser))
						{
							return true;
						}
					}
				}
				return false;
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:21,代码来源:UrlMembershipCondition.cs

示例15: Check

		// methods

		public bool Check (Evidence evidence) 
		{
			if (evidence == null)
				return false;

			IEnumerator e = evidence.GetHostEnumerator ();
			while (e.MoveNext ()) {
				if (e.Current is Site) {
					string[] s1 = _site.Split ('.');
					string[] s2 = (e.Current as Site).origin_site.Split ('.');
					for (int i = s1.Length - 1, j = s2.Length - 1; i>=0; i--, j--) {
						if (i == 0) {
							// special * case
							return (String.Compare (s1 [0], "*", true, CultureInfo.InvariantCulture) == 0);
						}
						if (String.Compare (s1 [i], s2 [j], true, CultureInfo.InvariantCulture) != 0)
							return false;
					}
					return true;
				}
			}
			return false;
		}
开发者ID:runefs,项目名称:Marvin,代码行数:25,代码来源:SiteMembershipCondition.cs


注:本文中的System.Security.Policy.Evidence.GetHostEnumerator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。