Exemplo n.º 1
0
        /// <summary>分析</summary>
        /// <param name="value">数值</param>
        /// <returns></returns>
        public static SdpConnection Parse(String value)
        {
            if (String.IsNullOrEmpty(value))
            {
                throw new ArgumentNullException("value");
            }

            value = value.Trim();

            if (!value.ToLower().StartsWith("c="))
            {
                throw new NetException("Invalid SDP Connection('c=') value '" + value + "'.");
            }

            value = value.Substring(2);

            var values = value.Split(' ');

            if (values.Length != 3)
            {
                throw new NetException("Invalid SDP Connection('c=') value '" + value + "'.");
            }

            var entity = new SdpConnection();

            entity.NetType     = values[0];
            entity.AddressType = values[1];
            entity.Address     = values[2];

            return(entity);
        }
Exemplo n.º 2
0
        /// <summary>分析</summary>
        /// <param name="value">数值</param>
        /// <returns></returns>
        public static SdpConnection Parse(String value)
        {
            if (String.IsNullOrEmpty(value)) throw new ArgumentNullException("value");

            value = value.Trim();

            if (!value.ToLower().StartsWith("c=")) throw new NetException("Invalid SDP Connection('c=') value '" + value + "'.");

            value = value.Substring(2);

            string[] values = value.Split(' ');
            if (values.Length != 3) throw new NetException("Invalid SDP Connection('c=') value '" + value + "'.");

            var entity = new SdpConnection();
            entity.NetType = values[0];
            entity.AddressType = values[1];
            entity.Address = values[2];

            return entity;
        }