⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 emailfield.cs

📁 pureIRCd是一个用c语音写的irc(RFC459)服务,可以给您带来很多的方便
💻 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 + -