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


C# Evidence.GetDelayEvaluatedHostEvidence方法代码示例

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


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

示例1: GetHomogenousGrantSet

        internal PermissionSet GetHomogenousGrantSet(Evidence evidence)
        {
            Contract.Assert(evidence != null);
            Contract.Assert(IsHomogenous);
            Contract.Assert(evidence.GetHostEvidence<GacInstalled>() == null);

            if (_IsFastFullTrustDomain)
            {
                return new PermissionSet(PermissionState.Unrestricted);
            }

            // If the ApplicationTrust's full trust list calls out the assembly, then it is fully trusted
            if (evidence.GetDelayEvaluatedHostEvidence<StrongName>() != null)
            {
                foreach (StrongName fullTrustAssembly in ApplicationTrust.FullTrustAssemblies)
                {
                    StrongNameMembershipCondition sn = new StrongNameMembershipCondition(fullTrustAssembly.PublicKey,
                                                                                         fullTrustAssembly.Name,
                                                                                         fullTrustAssembly.Version);

                    object usedEvidence = null;
                    if ((sn as IReportMatchMembershipCondition).Check(evidence, out usedEvidence))
                    {
                        IDelayEvaluatedEvidence delayEvidence = usedEvidence as IDelayEvaluatedEvidence;
                        if (usedEvidence != null)
                        {
                            delayEvidence.MarkUsed();
                        }

                        return new PermissionSet(PermissionState.Unrestricted);
                    }
                }
            }

            // Otherwise, the grant set is just the default grant set
            return ApplicationTrust.DefaultGrantSet.PermissionSet.Copy();
        }
开发者ID:Rayislandstyle,项目名称:dotnet-coreclr,代码行数:37,代码来源:AppDomain.cs

示例2:

 bool IReportMatchMembershipCondition.Check(Evidence evidence, out object usedEvidence)
 {
     usedEvidence = null;
     if (evidence != null)
     {
         StrongName delayEvaluatedHostEvidence = evidence.GetDelayEvaluatedHostEvidence<StrongName>();
         if (delayEvaluatedHostEvidence != null)
         {
             bool flag = (this.PublicKey != null) && this.PublicKey.Equals(delayEvaluatedHostEvidence.PublicKey);
             bool flag2 = (this.Name == null) || ((delayEvaluatedHostEvidence.Name != null) && StrongName.CompareNames(delayEvaluatedHostEvidence.Name, this.Name));
             bool flag3 = (this.Version == null) || ((delayEvaluatedHostEvidence.Version != null) && (delayEvaluatedHostEvidence.Version.CompareTo(this.Version) == 0));
             if ((flag && flag2) && flag3)
             {
                 usedEvidence = delayEvaluatedHostEvidence;
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:20,代码来源:StrongNameMembershipCondition.cs

示例3:

        bool IReportMatchMembershipCondition.Check(Evidence evidence, out object usedEvidence)
        {
            usedEvidence = null;

            if (evidence == null)
                return false;

            StrongName name = evidence.GetDelayEvaluatedHostEvidence<StrongName>();                
            if (name != null)
            {
                bool publicKeyMatch = PublicKey != null && PublicKey.Equals(name.PublicKey);
                bool nameMatch = Name == null || (name.Name != null && StrongName.CompareNames(name.Name, Name));
                bool versionMatch = (object)Version == null || ((object)name.Version != null && name.Version.CompareTo(Version) == 0);

                if (publicKeyMatch && nameMatch && versionMatch)
                {
                    // Note that we explicitly do not want to mark the strong name evidence as used at
                    // this point, since we could be a child code group where our parent provides more
                    // trust than we do.  For instance, if we're in a setup like this:
                    //
                    //   AllCode -> FullTrust
                    //     StrongName -> FullTrust
                    //
                    // the StrongName code group didn't add anything to the final grant set and therefore
                    // does not need to be evaluated.
                    usedEvidence = name;
                    return true;
                }
            }

            return false;
        }
开发者ID:REALTOBIZ,项目名称:mono,代码行数:32,代码来源:strongnamemembershipcondition.cs

示例4: GetHomogenousGrantSet

		internal PermissionSet GetHomogenousGrantSet(Evidence evidence)
		{
			if (evidence.GetDelayEvaluatedHostEvidence<StrongName>() != null)
			{
				foreach (StrongName current in this._applicationTrust.FullTrustAssemblies)
				{
					StrongNameMembershipCondition strongNameMembershipCondition = new StrongNameMembershipCondition(current.PublicKey, current.Name, current.Version);
					object obj = null;
					if (((IReportMatchMembershipCondition)strongNameMembershipCondition).Check(evidence, out obj))
					{
						IDelayEvaluatedEvidence delayEvaluatedEvidence = obj as IDelayEvaluatedEvidence;
						if (obj != null)
						{
							delayEvaluatedEvidence.MarkUsed();
						}
						return new PermissionSet(PermissionState.Unrestricted);
					}
				}
			}
			return this._applicationTrust.DefaultGrantSet.PermissionSet.Copy();
		}
开发者ID:ChristianWulf,项目名称:CSharpKDMDiscoverer,代码行数:21,代码来源:AppDomain.cs


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