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

📄 attributefield.cs

📁 pureIRCd是一个用c语音写的irc(RFC459)服务,可以给您带来很多的方便
💻 CS
字号:
using SDP;
using System;

namespace SDP
{
    /// <summary>
    /// An Attribute represents the a= fields contained in either a MediaDescription or
    /// SessionDescription. They can be either an identity or a name-value pair.
    /// 
    /// For example:
    /// 
    /// a=recvonly  //Just the presence of this atttribute implies state.
    /// 
    /// a=rtpmap:0 PCMU/8000 //Identifies the media format 0 as being PCMU/8000.
    /// 
    /// The value must be preceded by the : character if present.
    /// </summary>
    public class AttributeField : Field
    {
        private string name;
        /// <summary>
        /// Gets the name of the attribute.
        /// </summary>
        public string Name
        {
            get { return this.name; }
        }

        /// <summary>
        /// Gets whether or not this attribute has a value.
        /// </summary>        
        public bool HasValue
        {
            get { return !String.IsNullOrEmpty(this.attributeValue); }
        }

        private string attributeValue;
        /// <summary>
        /// Gets the value of this attribute.
        /// </summary>
        public string AttributeValue
        {
            get { return this.attributeValue; }
        }

        /// <summary>
        /// Creates a new AttributeField.
        /// </summary>
        /// <param name="name">The name or identity of the attribute.</param>
        /// <param name="value">The value of the attribute. Should be left null or empty if the attribute
        /// is recognized by identity.</param>
        public AttributeField(string name, string value)
            : base("a=" + name + ":" + value)
        {
            this.name = name;
            this.attributeValue = value;
        }

        /// <summary>
        /// Creates a new AttributeField.
        /// </summary>
        /// <param name="value">The field's value.</param>
        public AttributeField(string value)
            : base("a=" + value)
        {
            string val = base.Value;
            string[] parts = val.Split(':');
            this.name = parts[0];
            if (parts.Length > 1) this.attributeValue = parts[1];
        }

        /// <summary>
        /// Gets the value portion of this field.
        /// </summary>
        public override string Value
        {
            get
            {
                if (this.HasValue)
                    return this.name + ":" + this.attributeValue;
                return this.name;
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -