public void SetAddress(string networkType, string addressType, string address) { if (string.IsNullOrEmpty(networkType)) { throw new ArgumentException("networkType"); } if (string.IsNullOrEmpty(addressType)) { throw new ArgumentException("addressType"); } if (string.IsNullOrEmpty(address)) { throw new ArgumentException("address"); } Grammar.ValidateToken(networkType); Grammar.ValidateToken(addressType); Grammar.ValidateAddress(address); if (IsReadOnly) { throw new InvalidOperationException("SessionDescription is read-only"); } _networkType = networkType; _addressType = addressType; _address = address; }
public void Set(string name, IEnumerable <string> values) { if (name == null) { throw new ArgumentNullException("name"); } Grammar.ValidateToken(name); foreach (string value in values) { if (value != null) { Grammar.ValidateByteString(value); } } if (IsReadOnly) { throw new InvalidOperationException("SessionDescription is read-only"); } if (ContainsKey(name)) { throw new ArgumentException("An element with the same name already exists"); } foreach (var value in values) { Add(name, value); } }
public void Add(string name) { if (name == null) { throw new ArgumentNullException("name"); } Grammar.ValidateToken(name); if (IsReadOnly) { throw new InvalidOperationException("SessionDescription is read-only"); } _values.Add(new KeyValuePair <string, string>(name, null)); }
public void Set(string name) { if (name == null) { throw new ArgumentNullException("name"); } Grammar.ValidateToken(name); if (IsReadOnly) { throw new InvalidOperationException("SessionDescription is read-only"); } Set(name, (string)null); }
private void Validate(string item) { if (_type == Type.EMail) { Grammar.ValidateEMail(item); } else if (_type == Type.Phone) { Grammar.ValidatePhoneNumber(item); } else if (_type == Type.Format) { Grammar.ValidateToken(item); } }
public bool ContainsKey(string name) { if (name == null) { throw new ArgumentNullException("name"); } Grammar.ValidateToken(name); foreach (var pair in _values) { if (pair.Key.Equals(name)) { return(true); } } return(false); }