本文整理汇总了C#中System.Security.Policy.PolicyLevel.AddFullTrustAssembly方法的典型用法代码示例。如果您正苦于以下问题:C# PolicyLevel.AddFullTrustAssembly方法的具体用法?C# PolicyLevel.AddFullTrustAssembly怎么用?C# PolicyLevel.AddFullTrustAssembly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Security.Policy.PolicyLevel
的用法示例。
在下文中一共展示了PolicyLevel.AddFullTrustAssembly方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckAddedAssemblies
private static void CheckAddedAssemblies( PolicyLevel level, ref ArrayList assemblies )
{
try
{
if (assemblies == null || level == null)
return;
IEnumerator enumerator = assemblies.GetEnumerator();
while (enumerator.MoveNext())
{
Assembly assembly = (Assembly)enumerator.Current;
StrongName sn = FindStrongName( assembly.Evidence );
if (sn == null)
{
PauseCapableWriteLine( manager.GetString( "Dialog_AssemblyNotStrongNamed" ) );
if (!GetAnswer())
throw new ExitException();
}
else if (!sn.Name.Equals( "mscorlib" ))
{
IEnumerator snEnumerator = level.FullTrustAssemblies.GetEnumerator();
bool found = false;
Evidence evidence = new Evidence();
evidence.AddHost( sn );
while (snEnumerator.MoveNext())
{
if (((StrongNameMembershipCondition)snEnumerator.Current).Check( evidence ))
{
found = true;
break;
}
}
if (!found)
{
PauseCapableWriteLine( manager.GetString( "Dialog_StrongNameAssemblyAdded1" ) );
PauseCapableWriteLine( sn.Name + " " + sn.Version );
PauseCapableWriteLine( manager.GetString( "Dialog_StrongNameAssemblyAdded2" ) );
if (GetAnswer())
{
level.AddFullTrustAssembly( sn );
}
}
}
}
}
finally
{
assemblies = new ArrayList();
}
}