本文整理匯總了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");
}