?? attributefield.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 + -