コード例 #1
0
        /// <summary>
        /// Parse URI from string value.
        /// </summary>
        /// <param name="value">String URI value.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>value</b> is null reference.</exception>
        /// <exception cref="ArgumentException">Is raised when <b>value</b> has invalid URI value.</exception>
        public static AbsoluteUri Parse(string value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }
            if (value == "")
            {
                throw new ArgumentException("Argument 'value' value must be specified.");
            }

            string[] scheme_value = value.Split(new char[] { ':' }, 2);
            if (scheme_value[0].ToLower() == UriSchemes.sip || scheme_value[0].ToLower() == UriSchemes.sips)
            {
                SIP_Uri uri = new SIP_Uri();
                uri.ParseInternal(value);

                return(uri);
            }
            else
            {
                AbsoluteUri uri = new AbsoluteUri();
                uri.ParseInternal(value);

                return(uri);
            }
        }
コード例 #2
0
        /// <summary>
        /// Parse SIP or SIPS URI from string value.
        /// </summary>
        /// <param name="value">String URI value.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>value</b> is null reference.</exception>
        /// <exception cref="ArgumentException">Is raised when <b>value</b> is not valid SIP or SIPS URI.</exception>
        public new static SIP_Uri Parse(string value)
        {
            AbsoluteUri uri = AbsoluteUri.Parse(value);

            if (uri is SIP_Uri)
            {
                return((SIP_Uri)uri);
            }
            else
            {
                throw new ArgumentException("Argument 'value' is not valid SIP or SIPS URI.");
            }
        }
コード例 #3
0
ファイル: AbsoluteUri.cs プロジェクト: iraychen/LumiSoft.Net
        /// <summary>
        /// Parse URI from string value.
        /// </summary>
        /// <param name="value">String URI value.</param>
        /// <exception cref="ArgumentNullException">Is raised when <b>value</b> is null reference.</exception>
        /// <exception cref="ArgumentException">Is raised when <b>value</b> has invalid URI value.</exception>
        public static AbsoluteUri Parse(string value)
        {
            if(value == null){
                throw new ArgumentNullException("value");
            }
            if(value == ""){
                throw new ArgumentException("Argument 'value' value must be specified.");
            }
            
            string[] scheme_value = value.Split(new char[]{':'},2);
            if(scheme_value[0].ToLower() == UriSchemes.sip || scheme_value[0].ToLower() == UriSchemes.sips){
                SIP_Uri uri = new SIP_Uri();
                uri.ParseInternal(value);

                return uri;
            }
            else{
                AbsoluteUri uri = new AbsoluteUri();
                uri.ParseInternal(value);

                return uri;
            }
        }