本文整理汇总了C#中System.Security.Permissions.EnvironmentPermission.GetPathList方法的典型用法代码示例。如果您正苦于以下问题:C# EnvironmentPermission.GetPathList方法的具体用法?C# EnvironmentPermission.GetPathList怎么用?C# EnvironmentPermission.GetPathList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Security.Permissions.EnvironmentPermission
的用法示例。
在下文中一共展示了EnvironmentPermission.GetPathList方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FromXml
public void FromXml ()
{
EnvironmentPermission ep = new EnvironmentPermission (PermissionState.None);
SecurityElement se = ep.ToXml ();
AssertNotNull ("ToXml()", se);
ep.FromXml (se);
se.AddAttribute ("Read", envVariables);
ep.FromXml (se);
AssertEquals ("FromXml-Read", envVariables, ep.GetPathList (EnvironmentPermissionAccess.Read));
se.AddAttribute ("Write", envVariables);
ep.FromXml (se);
AssertEquals ("FromXml-Read", envVariables, ep.GetPathList (EnvironmentPermissionAccess.Read));
AssertEquals ("FromXml-Write", envVariables, ep.GetPathList (EnvironmentPermissionAccess.Write));
}
示例2: GetPathList
public void GetPathList ()
{
EnvironmentPermission ep = new EnvironmentPermission (PermissionState.None);
#if NET_2_0
AssertEquals ("GetPathList-Read-Empty", String.Empty, ep.GetPathList (EnvironmentPermissionAccess.Read));
AssertEquals ("GetPathList-Write-Empty", String.Empty, ep.GetPathList (EnvironmentPermissionAccess.Write));
#else
AssertNull ("GetPathList-Read-Empty", ep.GetPathList (EnvironmentPermissionAccess.Read));
AssertNull ("GetPathList-Write-Empty", ep.GetPathList (EnvironmentPermissionAccess.Write));
#endif
ep.AddPathList (EnvironmentPermissionAccess.Read, "UID");
ep.AddPathList (EnvironmentPermissionAccess.Write, "PROMPT");
AssertEquals ("GetPathList-Read", "UID", ep.GetPathList (EnvironmentPermissionAccess.Read));
AssertEquals ("GetPathList-Write", "PROMPT", ep.GetPathList (EnvironmentPermissionAccess.Write));
}
示例3: GetPathListNoAccess
public void GetPathListNoAccess ()
{
EnvironmentPermission ep = new EnvironmentPermission (PermissionState.None);
ep.AddPathList (EnvironmentPermissionAccess.Read, "UID");
ep.AddPathList (EnvironmentPermissionAccess.Write, "PROMPT");
AssertEquals ("GetPathList-NoAccess", "", ep.GetPathList (EnvironmentPermissionAccess.NoAccess));
}
示例4: GetEnvironmentPermission
private static string GetEnvironmentPermission (EnvironmentPermission ep)
{
if (ep.IsUnrestricted ())
return " EnvironmentPermission - Unrestricted\\l";
StringBuilder sb = new StringBuilder (" EnvironmentPermission\\l");
string s = ep.GetPathList (EnvironmentPermissionAccess.Read);
if ((s != null) && (s.Length > 0))
sb.AppendFormat (" Read: {0}\\l", s);
s = ep.GetPathList (EnvironmentPermissionAccess.Write);
if ((s != null) && (s.Length > 0))
sb.AppendFormat (" Write: {0}\\l", s);
return sb.ToString ();
}
示例5: GetPathListAllAccess
public void GetPathListAllAccess ()
{
EnvironmentPermission ep = new EnvironmentPermission (PermissionState.None);
ep.AddPathList (EnvironmentPermissionAccess.Read, "UID");
ep.AddPathList (EnvironmentPermissionAccess.Write, "PROMPT");
Assert.AreEqual ("", ep.GetPathList (EnvironmentPermissionAccess.AllAccess), "GetPathList-AllAccess");
}
示例6: GetPathList
public void GetPathList ()
{
EnvironmentPermission ep = new EnvironmentPermission (PermissionState.None);
Assert.AreEqual (String.Empty, ep.GetPathList (EnvironmentPermissionAccess.Read), "GetPathList-Read-Empty");
Assert.AreEqual (String.Empty, ep.GetPathList (EnvironmentPermissionAccess.Write), "GetPathList-Write-Empty");
ep.AddPathList (EnvironmentPermissionAccess.Read, "UID");
ep.AddPathList (EnvironmentPermissionAccess.Write, "PROMPT");
Assert.AreEqual ("UID", ep.GetPathList (EnvironmentPermissionAccess.Read), "GetPathList-Read");
Assert.AreEqual ("PROMPT", ep.GetPathList (EnvironmentPermissionAccess.Write), "GetPathList-Write");
}