scripts
This commit is contained in:
@@ -0,0 +1,202 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace System.Net.Mail
|
||||
{
|
||||
/// <summary>Represents the address of an electronic mail sender or recipient.</summary>
|
||||
// Token: 0x0200013E RID: 318
|
||||
public class MailAddress
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.MailAddress" /> class using the specified address. </summary>
|
||||
/// <param name="address">A <see cref="T:System.String" /> that contains an e-mail address.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="address" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="address" /> is <see cref="F:System.String.Empty" /> ("").</exception>
|
||||
/// <exception cref="T:System.FormatException">
|
||||
/// <paramref name="address" /> is not in a recognized format.</exception>
|
||||
// Token: 0x06000ACE RID: 2766 RVA: 0x00020550 File Offset: 0x0001E750
|
||||
public MailAddress(string address)
|
||||
: this(address, null)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.MailAddress" /> class using the specified address and display name.</summary>
|
||||
/// <param name="address">A <see cref="T:System.String" /> that contains an e-mail address.</param>
|
||||
/// <param name="displayName">A <see cref="T:System.String" /> that contains the display name associated with <paramref name="address" />. This parameter can be null.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="address" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="address" /> is <see cref="F:System.String.Empty" /> ("").</exception>
|
||||
/// <exception cref="T:System.FormatException">
|
||||
/// <paramref name="address" /> is not in a recognized format.-or-<paramref name="address" /> contains non-ASCII characters.</exception>
|
||||
// Token: 0x06000ACF RID: 2767 RVA: 0x0002055C File Offset: 0x0001E75C
|
||||
public MailAddress(string address, string displayName)
|
||||
: this(address, displayName, Encoding.Default)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Mail.MailAddress" /> class using the specified address, display name, and encoding.</summary>
|
||||
/// <param name="address">A <see cref="T:System.String" /> that contains an e-mail address.</param>
|
||||
/// <param name="displayName">A <see cref="T:System.String" /> that contains the display name associated with <paramref name="address" />.</param>
|
||||
/// <param name="displayNameEncoding">The <see cref="T:System.Text.Encoding" /> that defines the character set used for <paramref name="displayName" />.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="address" /> is null.-or-<paramref name="displayName" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="address" /> is <see cref="F:System.String.Empty" /> ("").-or-<paramref name="displayName" /> is <see cref="F:System.String.Empty" /> ("").</exception>
|
||||
/// <exception cref="T:System.FormatException">
|
||||
/// <paramref name="address" /> is not in a recognized format.-or-<paramref name="address" /> contains non-ASCII characters.</exception>
|
||||
// Token: 0x06000AD0 RID: 2768 RVA: 0x0002056C File Offset: 0x0001E76C
|
||||
public MailAddress(string address, string displayName, Encoding displayNameEncoding)
|
||||
{
|
||||
if (address == null)
|
||||
{
|
||||
throw new ArgumentNullException("address");
|
||||
}
|
||||
int num = address.IndexOf('"');
|
||||
if (num == 0)
|
||||
{
|
||||
int num2 = address.IndexOf('"', num + 1);
|
||||
if (num2 == -1)
|
||||
{
|
||||
throw MailAddress.CreateFormatException();
|
||||
}
|
||||
this.displayName = address.Substring(num + 1, num2 - 1).Trim();
|
||||
address = address.Substring(num2 + 1);
|
||||
}
|
||||
int num3 = address.IndexOf('<');
|
||||
if (num3 != -1)
|
||||
{
|
||||
if (num3 + 1 >= address.Length)
|
||||
{
|
||||
throw MailAddress.CreateFormatException();
|
||||
}
|
||||
int num4 = address.IndexOf('>', num3 + 1);
|
||||
if (num4 == -1)
|
||||
{
|
||||
throw MailAddress.CreateFormatException();
|
||||
}
|
||||
if (this.displayName == null)
|
||||
{
|
||||
this.displayName = address.Substring(0, num3).Trim();
|
||||
}
|
||||
address = address.Substring(++num3, num4 - num3);
|
||||
}
|
||||
if (displayName != null)
|
||||
{
|
||||
this.displayName = displayName.Trim();
|
||||
}
|
||||
this.address = address.Trim();
|
||||
}
|
||||
|
||||
/// <summary>Gets the e-mail address specified when this instance was created.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> that contains the e-mail address.</returns>
|
||||
// Token: 0x170002B5 RID: 693
|
||||
// (get) Token: 0x06000AD1 RID: 2769 RVA: 0x00020664 File Offset: 0x0001E864
|
||||
public string Address
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.address;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the display name composed from the display name and address information specified when this instance was created.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> that contains the display name; otherwise, <see cref="F:System.String.Empty" /> ("") if no display name information was specified when this instance was created.</returns>
|
||||
// Token: 0x170002B6 RID: 694
|
||||
// (get) Token: 0x06000AD2 RID: 2770 RVA: 0x0002066C File Offset: 0x0001E86C
|
||||
public string DisplayName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.displayName == null)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
return this.displayName;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the host portion of the address specified when this instance was created.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> that contains the name of the host computer that accepts e-mail for the <see cref="P:System.Net.Mail.MailAddress.User" /> property.</returns>
|
||||
// Token: 0x170002B7 RID: 695
|
||||
// (get) Token: 0x06000AD3 RID: 2771 RVA: 0x00020688 File Offset: 0x0001E888
|
||||
public string Host
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.Address.Substring(this.address.IndexOf("@") + 1);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the user information from the address specified when this instance was created.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> that contains the user name portion of the <see cref="P:System.Net.Mail.MailAddress.Address" />.</returns>
|
||||
// Token: 0x170002B8 RID: 696
|
||||
// (get) Token: 0x06000AD4 RID: 2772 RVA: 0x000206A8 File Offset: 0x0001E8A8
|
||||
public string User
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.Address.Substring(0, this.address.IndexOf("@"));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Compares two mail addresses.</summary>
|
||||
/// <returns>true if the two mail addresses are equal; otherwise, false.</returns>
|
||||
/// <param name="value">A <see cref="T:System.Net.Mail.MailAddress" /> instance to compare to the current instance.</param>
|
||||
// Token: 0x06000AD5 RID: 2773 RVA: 0x000206C8 File Offset: 0x0001E8C8
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return this.Equals(obj as MailAddress);
|
||||
}
|
||||
|
||||
// Token: 0x06000AD6 RID: 2774 RVA: 0x000206D8 File Offset: 0x0001E8D8
|
||||
private bool Equals(MailAddress other)
|
||||
{
|
||||
return other != null && this.Address == other.Address;
|
||||
}
|
||||
|
||||
/// <summary>Returns a hash value for a mail address.</summary>
|
||||
/// <returns>An integer hash value.</returns>
|
||||
// Token: 0x06000AD7 RID: 2775 RVA: 0x000206F4 File Offset: 0x0001E8F4
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return this.address.GetHashCode();
|
||||
}
|
||||
|
||||
/// <summary>Returns a string representation of this instance.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> that contains the contents of this <see cref="T:System.Net.Mail.MailAddress" />.</returns>
|
||||
// Token: 0x06000AD8 RID: 2776 RVA: 0x00020704 File Offset: 0x0001E904
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
if (this.DisplayName != null && this.DisplayName.Length > 0)
|
||||
{
|
||||
stringBuilder.Append("\"");
|
||||
stringBuilder.Append(this.DisplayName);
|
||||
stringBuilder.Append("\"");
|
||||
stringBuilder.Append(" ");
|
||||
stringBuilder.Append("<");
|
||||
stringBuilder.Append(this.Address);
|
||||
stringBuilder.Append(">");
|
||||
}
|
||||
else
|
||||
{
|
||||
stringBuilder.Append(this.Address);
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
// Token: 0x06000AD9 RID: 2777 RVA: 0x000207A4 File Offset: 0x0001E9A4
|
||||
private static FormatException CreateFormatException()
|
||||
{
|
||||
return new FormatException("The specified string is not in the form required for an e-mail address.");
|
||||
}
|
||||
|
||||
// Token: 0x04000B07 RID: 2823
|
||||
private string address;
|
||||
|
||||
// Token: 0x04000B08 RID: 2824
|
||||
private string displayName;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user