using System;
using System.Net.Sockets;
namespace System.Net
{
/// Stores serialized information from derived classes.
// Token: 0x02000257 RID: 599
public class SocketAddress
{
/// Creates a new instance of the class using the specified address family and buffer size.
/// An enumerated value.
/// The number of bytes to allocate for the underlying buffer.
///
/// is less than 2. These 2 bytes are needed to store .
// Token: 0x06001571 RID: 5489 RVA: 0x00044D5C File Offset: 0x00042F5C
public SocketAddress(global::System.Net.Sockets.AddressFamily family, int size)
{
if (size < 2)
{
throw new ArgumentOutOfRangeException("size is too small");
}
this.data = new byte[size];
this.data[0] = (byte)family;
this.data[1] = (byte)(family >> 8);
}
/// Creates a new instance of the class for the given address family.
/// An enumerated value.
// Token: 0x06001572 RID: 5490 RVA: 0x00044DA4 File Offset: 0x00042FA4
public SocketAddress(global::System.Net.Sockets.AddressFamily family)
: this(family, 32)
{
}
/// Gets the enumerated value of the current .
/// One of the enumerated values.
// Token: 0x17000704 RID: 1796
// (get) Token: 0x06001573 RID: 5491 RVA: 0x00044DB0 File Offset: 0x00042FB0
public global::System.Net.Sockets.AddressFamily Family
{
get
{
return (global::System.Net.Sockets.AddressFamily)((int)this.data[0] + ((int)this.data[1] << 8));
}
}
/// Gets the underlying buffer size of the .
/// The underlying buffer size of the .
// Token: 0x17000705 RID: 1797
// (get) Token: 0x06001574 RID: 5492 RVA: 0x00044DC8 File Offset: 0x00042FC8
public int Size
{
get
{
return this.data.Length;
}
}
/// Gets or sets the specified index element in the underlying buffer.
/// The value of the specified index element in the underlying buffer.
/// The array index element of the desired information.
/// The specified index does not exist in the buffer.
// Token: 0x17000706 RID: 1798
public byte this[int offset]
{
get
{
return this.data[offset];
}
set
{
this.data[offset] = value;
}
}
/// Returns information about the socket address.
/// A string that contains information about the .
///
///
///
// Token: 0x06001577 RID: 5495 RVA: 0x00044DEC File Offset: 0x00042FEC
public override string ToString()
{
string text = ((global::System.Net.Sockets.AddressFamily)this.data[0]).ToString();
int num = this.data.Length;
string text2 = string.Concat(new object[] { text, ":", num, ":{" });
for (int i = 2; i < num; i++)
{
int num2 = (int)this.data[i];
text2 += num2;
if (i < num - 1)
{
text2 += ",";
}
}
return text2 + "}";
}
/// Determines whether the specified is equal to the current instance.
/// true if the specified is equal to the current ; otherwise, false.
/// The specified to compare with the current instance.
// Token: 0x06001578 RID: 5496 RVA: 0x00044E8C File Offset: 0x0004308C
public override bool Equals(object obj)
{
SocketAddress socketAddress = obj as SocketAddress;
if (socketAddress != null && socketAddress.data.Length == this.data.Length)
{
byte[] array = socketAddress.data;
for (int i = 0; i < this.data.Length; i++)
{
if (array[i] != this.data[i])
{
return false;
}
}
return true;
}
return false;
}
/// Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
/// A hash code for the current .
// Token: 0x06001579 RID: 5497 RVA: 0x00044EF0 File Offset: 0x000430F0
public override int GetHashCode()
{
int num = 0;
for (int i = 0; i < this.data.Length; i++)
{
num += (int)this.data[i] + i;
}
return num;
}
// Token: 0x040011D1 RID: 4561
private byte[] data;
}
}