/// <summary>
        /// Removes the specified URI prefix from the collection.
        /// </summary>
        /// <returns>
        /// <c>true</c> if the URI prefix is successfully removed; otherwise,
        /// <c>false</c>.
        /// </returns>
        /// <param name="uriPrefix">
        /// A <see cref="string"/> that specifies the URI prefix to remove.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="uriPrefix"/> is <see langword="null"/>.
        /// </exception>
        /// <exception cref="ObjectDisposedException">
        /// The <see cref="HttpListener"/> instance associated with this
        /// collection is closed.
        /// </exception>
        public bool Remove(string uriPrefix)
        {
            if (_listener.IsDisposed)
            {
                throw new ObjectDisposedException(_listener.GetType().ToString());
            }

            if (uriPrefix == null)
            {
                throw new ArgumentNullException("uriPrefix");
            }

            var ret = _prefixes.Remove(uriPrefix);

            if (!ret)
            {
                return(ret);
            }

            if (!_listener.IsListening)
            {
                return(ret);
            }

            EndPointManager.RemovePrefix(uriPrefix, _listener);

            return(ret);
        }
コード例 #2
0
        public bool Remove(string uriPrefix)
        {
            this._listener.CheckDisposed();
            if (uriPrefix == null)
            {
                throw new ArgumentNullException("uriPrefix");
            }
            bool flag = this._prefixes.Remove(uriPrefix);

            if (flag && this._listener.IsListening)
            {
                EndPointManager.RemovePrefix(uriPrefix, this._listener);
            }
            return(flag);
        }
コード例 #3
0
        /// <summary>
        /// Removes the specified <paramref name="uriPrefix"/> from the collection.
        /// </summary>
        /// <returns>
        /// <c>true</c> if <paramref name="uriPrefix"/> is successfully found and removed;
        /// otherwise, <c>false</c>.
        /// </returns>
        /// <param name="uriPrefix">
        /// A <see cref="string"/> that represents the URI prefix to remove.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="uriPrefix"/> is <see langword="null"/>.
        /// </exception>
        /// <exception cref="ObjectDisposedException">
        /// The <see cref="HttpListener"/> associated with this collection is closed.
        /// </exception>
        public bool Remove(string uriPrefix)
        {
            _listener.CheckDisposed();
            if (uriPrefix == null)
            {
                throw new ArgumentNullException("uriPrefix");
            }

            var ret = _prefixes.Remove(uriPrefix);

            if (ret && _listener.IsListening)
            {
                EndPointManager.RemovePrefix(uriPrefix, _listener);
            }

            return(ret);
        }
        /// <summary>
        /// Removes the specified URI prefix from the collection.
        /// </summary>
        /// <returns>
        /// <c>true</c> if the URI prefix is successfully removed; otherwise,
        /// <c>false</c>.
        /// </returns>
        /// <param name="uriPrefix">
        /// A <see cref="string"/> that specifies the URI prefix to remove.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="uriPrefix"/> is <see langword="null"/>.
        /// </exception>
        /// <exception cref="ObjectDisposedException">
        /// The <see cref="HttpListener"/> instance associated with this
        /// collection is closed.
        /// </exception>
        public bool Remove(string uriPrefix)
        {
            _listener.CheckDisposed();

            if (uriPrefix == null)
            {
                throw new ArgumentNullException("uriPrefix");
            }

            if (!_prefixes.Contains(uriPrefix))
            {
                return(false);
            }

            if (_listener.IsListening)
            {
                EndPointManager.RemovePrefix(uriPrefix, _listener);
            }

            return(_prefixes.Remove(uriPrefix));
        }
コード例 #5
0
        /// <summary>
        /// Removes the specified URI prefix from the collection.
        /// </summary>
        /// <returns>
        /// <c>true</c> if the URI prefix is successfully removed; otherwise,
        /// <c>false</c>.
        /// </returns>
        /// <param name="uriPrefix">
        /// A <see cref="string"/> that specifies the URI prefix to remove.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="uriPrefix"/> is <see langword="null"/>.
        /// </exception>
        /// <exception cref="ObjectDisposedException">
        /// The <see cref="HttpListener"/> instance associated with this
        /// collection is closed.
        /// </exception>
        public bool Remove(string uriPrefix)
        {
            if (_listener.IsDisposed)
            {
                throw new ObjectDisposedException(_listener.GetType().ToString());
            }

            if (uriPrefix == null)
            {
                throw new ArgumentNullException("uriPrefix");
            }

            if (!_prefixes.Contains(uriPrefix))
            {
                return(false);
            }

            if (_listener.IsListening)
            {
                EndPointManager.RemovePrefix(uriPrefix, _listener);
            }

            return(_prefixes.Remove(uriPrefix));
        }