using System;
using System.Runtime.InteropServices;
using System.Security.Permissions;
namespace System.Security
{
/// Defines a permission set that has a name and description associated with it. This class cannot be inherited.
// Token: 0x020005C5 RID: 1477
[ComVisible(true)]
[Serializable]
public sealed class NamedPermissionSet : PermissionSet
{
// Token: 0x060035D0 RID: 13776 RVA: 0x000B8494 File Offset: 0x000B6694
internal NamedPermissionSet()
{
}
/// Initializes a new instance of the class with the specified name from a permission set.
/// The name for the named permission set.
/// The permission set from which to take the value of the new named permission set.
/// The parameter is null or is an empty string ("").
// Token: 0x060035D1 RID: 13777 RVA: 0x000B849C File Offset: 0x000B669C
public NamedPermissionSet(string name, PermissionSet permSet)
: base(permSet)
{
this.Name = name;
}
/// Initializes a new instance of the class with the specified name in either an unrestricted or a fully restricted state.
/// The name for the new named permission set.
/// One of the values.
/// The parameter is null or is an empty string ("").
// Token: 0x060035D2 RID: 13778 RVA: 0x000B84AC File Offset: 0x000B66AC
public NamedPermissionSet(string name, PermissionState state)
: base(state)
{
this.Name = name;
}
/// Initializes a new instance of the class from another named permission set.
/// The named permission set from which to create the new instance.
// Token: 0x060035D3 RID: 13779 RVA: 0x000B84BC File Offset: 0x000B66BC
public NamedPermissionSet(NamedPermissionSet permSet)
: base(permSet)
{
this.name = permSet.name;
this.description = permSet.description;
}
/// Initializes a new, empty instance of the class with the specified name.
/// The name for the new named permission set.
/// The parameter is null or is an empty string ("").
// Token: 0x060035D4 RID: 13780 RVA: 0x000B84E0 File Offset: 0x000B66E0
public NamedPermissionSet(string name)
: this(name, PermissionState.Unrestricted)
{
}
/// Gets or sets the text description of the current named permission set.
/// A text description of the named permission set.
// Token: 0x17000A8B RID: 2699
// (get) Token: 0x060035D5 RID: 13781 RVA: 0x000B84EC File Offset: 0x000B66EC
// (set) Token: 0x060035D6 RID: 13782 RVA: 0x000B84F4 File Offset: 0x000B66F4
public string Description
{
get
{
return this.description;
}
set
{
this.description = value;
}
}
/// Gets or sets the name of the current named permission set.
/// The name of the named permission set.
/// The name is null or is an empty string ("").
// Token: 0x17000A8C RID: 2700
// (get) Token: 0x060035D7 RID: 13783 RVA: 0x000B8500 File Offset: 0x000B6700
// (set) Token: 0x060035D8 RID: 13784 RVA: 0x000B8508 File Offset: 0x000B6708
public string Name
{
get
{
return this.name;
}
set
{
if (value == null || value == string.Empty)
{
throw new ArgumentException(Locale.GetText("invalid name"));
}
this.name = value;
}
}
/// Creates a permission set copy from a named permission set.
/// A permission set that is a copy of the permissions in the named permission set.
// Token: 0x060035D9 RID: 13785 RVA: 0x000B8538 File Offset: 0x000B6738
public override PermissionSet Copy()
{
return new NamedPermissionSet(this);
}
/// Creates a copy of the named permission set with a different name but the same permissions.
/// A copy of the named permission set with the new name.
/// The name for the new named permission set.
/// The parameter is null or is an empty string ("").
// Token: 0x060035DA RID: 13786 RVA: 0x000B8540 File Offset: 0x000B6740
public NamedPermissionSet Copy(string name)
{
return new NamedPermissionSet(this)
{
Name = name
};
}
/// Reconstructs a named permission set with a specified state from an XML encoding.
/// A security element containing the XML representation of the named permission set.
/// The parameter is not a valid representation of a named permission set.
/// The parameter is null.
///
///
///
// Token: 0x060035DB RID: 13787 RVA: 0x000B855C File Offset: 0x000B675C
public override void FromXml(SecurityElement et)
{
base.FromXml(et);
this.name = et.Attribute("Name");
this.description = et.Attribute("Description");
if (this.description == null)
{
this.description = string.Empty;
}
}
/// Creates an XML element description of the named permission set.
/// The XML representation of the named permission set.
///
///
///
// Token: 0x060035DC RID: 13788 RVA: 0x000B85A8 File Offset: 0x000B67A8
public override SecurityElement ToXml()
{
SecurityElement securityElement = base.ToXml();
if (this.name != null)
{
securityElement.AddAttribute("Name", this.name);
}
if (this.description != null)
{
securityElement.AddAttribute("Description", this.description);
}
return securityElement;
}
/// Determines whether the specified object is equal to the current .
/// true if the specified is equal to the current object; otherwise, false.
/// The object to compare with the current .
// Token: 0x060035DD RID: 13789 RVA: 0x000B85F8 File Offset: 0x000B67F8
[ComVisible(false)]
public override bool Equals(object obj)
{
if (obj == null)
{
return false;
}
NamedPermissionSet namedPermissionSet = obj as NamedPermissionSet;
return namedPermissionSet != null && this.name == namedPermissionSet.Name && base.Equals(obj);
}
/// Gets a hash code for the object that is suitable for use in hashing algorithms and data structures such as a hash table.
/// A hash code for the current object.
// Token: 0x060035DE RID: 13790 RVA: 0x000B863C File Offset: 0x000B683C
[ComVisible(false)]
public override int GetHashCode()
{
int num = base.GetHashCode();
if (this.name != null)
{
num ^= this.name.GetHashCode();
}
return num;
}
// Token: 0x04001613 RID: 5651
private string name;
// Token: 0x04001614 RID: 5652
private string description;
}
}