📄 keyfield.cs
字号:
using SDP;
using System;
/// <summary>
/// A Key represents the k= field contained within either a MediaDescription or a SessionDescription.
/// </summary>
public class KeyField : Field
{
private string method;
/// <summary>
/// Gets the method of encryption to use. See <see cref="EncryptionMethods"/>
/// </summary>
public string Method
{
get { return this.method; }
}
/// <summary>
/// Determines whether or not a key is present.
/// </summary>
public bool HasKey
{
get { return !String.IsNullOrEmpty(this.method); }
}
private string key;
/// <summary>
/// Gets the encryption key, if there is one.
/// </summary>
public string Key
{
get { return this.key; }
}
/// <summary>
/// Creates a new KeyField.
/// </summary>
/// <param name="value">The value portion of the field.</param>
public KeyField(string value)
: base("k=" + value)
{
string val = base.Value;
string[] parts = val.Split(':');
this.method = parts[0];
if (parts.Length > 1) this.key = parts[1];
}
/// <summary>
/// Creates a new KeyField.
/// </summary>
/// <param name="method">The encryption method.</param>
/// <param name="key">The key.</param>
public KeyField(string method, string key) : this(method + (String.IsNullOrEmpty(key) ? "" : ":" + key)) { }
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -