using System;
using System.Runtime.InteropServices;
namespace System.Security.Principal
{
/// Represents a user or group account.
// Token: 0x020005B0 RID: 1456
[ComVisible(false)]
public sealed class NTAccount : IdentityReference
{
/// Initializes a new instance of the class by using the specified name.
/// The name used to create the object. This parameter cannot be null or an empty string.
// Token: 0x0600353F RID: 13631 RVA: 0x000B7188 File Offset: 0x000B5388
public NTAccount(string name)
{
if (name == null)
{
throw new ArgumentNullException("name");
}
if (name.Length == 0)
{
throw new ArgumentException(Locale.GetText("Empty"), "name");
}
this._value = name.ToUpper();
}
/// Initializes a new instance of the class by using the specified domain name and account name.
/// The name of the domain. This parameter can be null or an empty string. Domain names that are null values are treated like an empty string.
/// The name of the account. This parameter cannot be null or an empty string.
// Token: 0x06003540 RID: 13632 RVA: 0x000B71D8 File Offset: 0x000B53D8
public NTAccount(string domainName, string accountName)
{
if (accountName == null)
{
throw new ArgumentNullException("accountName");
}
if (accountName.Length == 0)
{
throw new ArgumentException(Locale.GetText("Empty"), "accountName");
}
if (domainName == null)
{
this._value = domainName.ToUpper();
}
else
{
this._value = domainName.ToUpper() + "\\" + domainName.ToUpper();
}
}
/// Returns an uppercase string representation of this object.
/// The uppercase string representation of this object.
///
///
///
// Token: 0x17000A73 RID: 2675
// (get) Token: 0x06003541 RID: 13633 RVA: 0x000B7250 File Offset: 0x000B5450
public override string Value
{
get
{
return this._value;
}
}
/// Returns a value that indicates whether this object is equal to a specified object.
/// true if is an object with the same underlying type and value as this object; otherwise, false.
/// An object to compare with this object, or null.
// Token: 0x06003542 RID: 13634 RVA: 0x000B7258 File Offset: 0x000B5458
public override bool Equals(object o)
{
NTAccount ntaccount = o as NTAccount;
return !(ntaccount == null) && ntaccount.Value == this.Value;
}
/// Serves as a hash function for the current object. The method is suitable for hashing algorithms and data structures like a hash table.
/// A hash value for the current object.
// Token: 0x06003543 RID: 13635 RVA: 0x000B728C File Offset: 0x000B548C
public override int GetHashCode()
{
return this.Value.GetHashCode();
}
/// Returns a value that indicates whether the specified type is a valid translation type for the class.
/// true if is a valid translation type for the class; otherwise false.
/// The type being queried for validity to serve as a conversion from . The following target types are valid:- -
// Token: 0x06003544 RID: 13636 RVA: 0x000B729C File Offset: 0x000B549C
public override bool IsValidTargetType(Type targetType)
{
return targetType == typeof(NTAccount) || targetType == typeof(SecurityIdentifier);
}
/// Returns the account name, in Domain\Account format, for the account represented by the object.
/// The account name, in Domain\Account format.
// Token: 0x06003545 RID: 13637 RVA: 0x000B72C4 File Offset: 0x000B54C4
public override string ToString()
{
return this.Value;
}
/// Translates the account name represented by the object into another -derived type.
/// The converted identity.
/// The target type for the conversion from . The target type must be a type that is considered valid by the method.
///
/// is null.
///
/// is not an type.
/// Some or all identity references could not be translated.
/// The source account name is too long.-or-A Win32 error code was returned.
///
///
///
// Token: 0x06003546 RID: 13638 RVA: 0x000B72CC File Offset: 0x000B54CC
public override IdentityReference Translate(Type targetType)
{
if (targetType == typeof(NTAccount))
{
return this;
}
return null;
}
/// Compares two objects to determine whether they are equal. They are considered equal if they have the same canonical name representation as the one returned by the property or if they are both null.
/// true if and are equal; otherwise false.
/// The left operand to use for the equality comparison. This parameter can be null.
/// The right operand to use for the equality comparison. This parameter can be null.
// Token: 0x06003547 RID: 13639 RVA: 0x000B72E4 File Offset: 0x000B54E4
public static bool operator ==(NTAccount left, NTAccount right)
{
if (left == null)
{
return right == null;
}
return right != null && left.Value == right.Value;
}
/// Compares two objects to determine whether they are not equal. They are considered not equal if they have different canonical name representations than the one returned by the property or if one of the objects is null and the other is not.
/// true if and are not equal; otherwise false.
/// The left operand to use for the inequality comparison. This parameter can be null.
/// The right operand to use for the inequality comparison. This parameter can be null.
// Token: 0x06003548 RID: 13640 RVA: 0x000B7318 File Offset: 0x000B5518
public static bool operator !=(NTAccount left, NTAccount right)
{
if (left == null)
{
return right != null;
}
return right == null || left.Value != right.Value;
}
// Token: 0x04001594 RID: 5524
private string _value;
}
}