using System; using System.Security.Permissions; namespace System.Security { // Token: 0x020005C6 RID: 1478 internal static class PermissionBuilder { // Token: 0x060035E0 RID: 13792 RVA: 0x000B8684 File Offset: 0x000B6884 public static IPermission Create(string fullname, PermissionState state) { if (fullname == null) { throw new ArgumentNullException("fullname"); } SecurityElement securityElement = new SecurityElement("IPermission"); securityElement.AddAttribute("class", fullname); securityElement.AddAttribute("version", "1"); if (state == PermissionState.Unrestricted) { securityElement.AddAttribute("Unrestricted", "true"); } return PermissionBuilder.CreatePermission(fullname, securityElement); } // Token: 0x060035E1 RID: 13793 RVA: 0x000B86E8 File Offset: 0x000B68E8 public static IPermission Create(SecurityElement se) { if (se == null) { throw new ArgumentNullException("se"); } string text = se.Attribute("class"); if (text == null || text.Length == 0) { throw new ArgumentException("class"); } return PermissionBuilder.CreatePermission(text, se); } // Token: 0x060035E2 RID: 13794 RVA: 0x000B8738 File Offset: 0x000B6938 public static IPermission Create(string fullname, SecurityElement se) { if (fullname == null) { throw new ArgumentNullException("fullname"); } if (se == null) { throw new ArgumentNullException("se"); } return PermissionBuilder.CreatePermission(fullname, se); } // Token: 0x060035E3 RID: 13795 RVA: 0x000B8764 File Offset: 0x000B6964 public static IPermission Create(Type type) { return (IPermission)Activator.CreateInstance(type, PermissionBuilder.psNone); } // Token: 0x060035E4 RID: 13796 RVA: 0x000B8778 File Offset: 0x000B6978 internal static IPermission CreatePermission(string fullname, SecurityElement se) { Type type = Type.GetType(fullname); if (type == null) { string text = Locale.GetText("Can't create an instance of permission class {0}."); throw new TypeLoadException(string.Format(text, fullname)); } IPermission permission = PermissionBuilder.Create(type); permission.FromXml(se); return permission; } // Token: 0x04001615 RID: 5653 private static object[] psNone = new object[] { PermissionState.None }; } }