using System;
using System.Runtime.InteropServices;
namespace System.Security.Policy
{
/// Specifies the network resource access that is granted to code.
// Token: 0x02000582 RID: 1410
[ComVisible(true)]
[Serializable]
public class CodeConnectAccess
{
/// Initializes a new instance of the class.
/// The URI scheme represented by the current instance.
/// The port represented by the current instance.
///
/// is null.-or- is an empty string ("").-or- contains characters that are not permitted in schemes.-or- is less than 0.-or- is greater than 65,535.
// Token: 0x06003385 RID: 13189 RVA: 0x000B10C0 File Offset: 0x000AF2C0
[MonoTODO("(2.0) validations incomplete")]
public CodeConnectAccess(string allowScheme, int allowPort)
{
if (allowScheme == null || allowScheme.Length == 0)
{
throw new ArgumentOutOfRangeException("allowScheme");
}
if (allowPort < 0 || allowPort > 65535)
{
throw new ArgumentOutOfRangeException("allowPort");
}
this._scheme = allowScheme;
this._port = allowPort;
}
/// Gets the port represented by the current instance.
/// A value that identifies a computer port used in conjunction with the property.
// Token: 0x17000A21 RID: 2593
// (get) Token: 0x06003387 RID: 13191 RVA: 0x000B114C File Offset: 0x000AF34C
public int Port
{
get
{
return this._port;
}
}
/// Gets the URI scheme represented by the current instance.
/// A that identifies a URI scheme, converted to lowercase.
// Token: 0x17000A22 RID: 2594
// (get) Token: 0x06003388 RID: 13192 RVA: 0x000B1154 File Offset: 0x000AF354
public string Scheme
{
get
{
return this._scheme;
}
}
/// Returns a value indicating whether two objects represent the same scheme and port.
/// true if the two objects represent the same scheme and port; otherwise, false.
/// The object to compare to the current object.
// Token: 0x06003389 RID: 13193 RVA: 0x000B115C File Offset: 0x000AF35C
public override bool Equals(object o)
{
CodeConnectAccess codeConnectAccess = o as CodeConnectAccess;
return codeConnectAccess != null && this._scheme == codeConnectAccess._scheme && this._port == codeConnectAccess._port;
}
// Token: 0x0600338A RID: 13194 RVA: 0x000B11A0 File Offset: 0x000AF3A0
public override int GetHashCode()
{
return this._scheme.GetHashCode() ^ this._port;
}
/// Returns a instance that represents access to the specified port using any scheme.
/// A instance for the specified port.
/// The port represented by the returned instance.
///
/// is less than 0.-or- is greater than 65,535.
// Token: 0x0600338B RID: 13195 RVA: 0x000B11B4 File Offset: 0x000AF3B4
public static CodeConnectAccess CreateAnySchemeAccess(int allowPort)
{
return new CodeConnectAccess(CodeConnectAccess.AnyScheme, allowPort);
}
/// Returns a instance that represents access to the specified port using the code's scheme of origin.
/// A instance for the specified port.
/// The port represented by the returned instance.
///
/// is less than 0.-or- is greater than 65,535.
// Token: 0x0600338C RID: 13196 RVA: 0x000B11C4 File Offset: 0x000AF3C4
public static CodeConnectAccess CreateOriginSchemeAccess(int allowPort)
{
return new CodeConnectAccess(CodeConnectAccess.OriginScheme, allowPort);
}
/// Contains the string value that represents the scheme wildcard.
// Token: 0x04001517 RID: 5399
public static readonly string AnyScheme = "*";
/// Contains the value used to represent the default port.
// Token: 0x04001518 RID: 5400
public static readonly int DefaultPort = -3;
/// Contains the value used to represent the port value in the URI where code originated.
// Token: 0x04001519 RID: 5401
public static readonly int OriginPort = -4;
/// Contains the value used to represent the scheme in the URL where the code originated.
// Token: 0x0400151A RID: 5402
public static readonly string OriginScheme = "$origin";
// Token: 0x0400151B RID: 5403
private string _scheme;
// Token: 0x0400151C RID: 5404
private int _port;
}
}