?? emailfield.cs
字號:
using SDP;
using System;
/// <summary>
/// An EMail represents an e= field contained within a SessionDescription.
/// </summary>
public class EMailField : Field
{
private string username;
/// <summary>
/// Gets the username portion of this email address.
/// </summary>
public string Username
{
get { return this.username; }
}
private string displayname;
/// <summary>
/// Gets the display name.
/// </summary>
public string DisplayName
{
get { return this.displayname; }
}
private string host;
/// <summary>
/// Gets the host.
/// </summary>
public string Host
{
get { return this.host; }
}
/// <summary>
/// Gets the full string representation of the email address: username@host (displayname)
/// </summary>
public string EmailAddress
{
get { return this.Value; }
}
/// <summary>
/// Creates a new EMailField.
/// </summary>
/// <param name="value">The value portion of the field.</param>
public EMailField(string value)
: base("e=" + value)
{
string val = base.Value;
int i = val.IndexOf(' ');
if (i > 0)
{
this.displayname = val.Substring(i + 1).Trim(' ', '\r', '\n', '(', ')');
val = val.Remove(i + 1);
}
string[] parts = val.Split('@');
this.username = parts[0];
this.host = parts[1];
}
/// <summary>
/// Creates a new EMailField.
/// </summary>
/// <param name="username">The username.</param>
/// <param name="host">The host.</param>
public EMailField(string username, string host) : this(username + "@" + host) { }
/// <summary>
/// Creates a new EMailField.
/// </summary>
/// <param name="username">The username.</param>
/// <param name="host">The host.</param>
/// <param name="displayname">The display name.</param>
public EMailField(string username, string host, string displayname) : this(username + "@" + host + " (" + displayname + ")") { }
/// <summary>
/// Gets the value portion of this field.
/// </summary>
public override string Value
{
get
{
string s = this.username + "@" + this.host;
if (!String.IsNullOrEmpty(s)) s = s + " (" + this.displayname + ")";
return s;
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -