CheckDisposed() private method

private CheckDisposed ( ) : void
return void
Esempio n. 1
0
        public void CopyTo(Array array, int offset)
        {
            m_HttpListener.CheckDisposed();
            if (Count > array.Length)
            {
                throw new ArgumentOutOfRangeException("array", SR.GetString(SR.net_array_too_small));
            }
            if (offset + Count > array.Length)
            {
                throw new ArgumentOutOfRangeException("offset");
            }
            int index = 0;

            foreach (string uriPrefix in m_HttpListener.m_UriPrefixes.Keys)
            {
                array.SetValue(uriPrefix, offset + index++);
            }
        }
Esempio n. 2
0
        public void CopyTo(Array array, int offset)
        {
            _httpListener.CheckDisposed();
            if (Count > array.Length)
            {
                throw new ArgumentOutOfRangeException(nameof(array), SR.net_array_too_small);
            }
            if (offset + Count > array.Length)
            {
                throw new ArgumentOutOfRangeException(nameof(offset));
            }
            int index = 0;

            foreach (string uriPrefix in _httpListener.PrefixCollection)
            {
                array.SetValue(uriPrefix, offset + index++);
            }
        }
Esempio n. 3
0
 /// <summary>Adds a Uniform Resource Identifier (URI) prefix to the collection.</summary>
 /// <param name="uriPrefix">A <see cref="T:System.String" /> that identifies the URI information that is compared in incoming requests. The prefix must be terminated with a forward slash ("/").</param>
 /// <exception cref="T:System.ArgumentNullException">
 ///   <paramref name="uriPrefix" /> is null.</exception>
 /// <exception cref="T:System.ArgumentException">
 ///   <paramref name="uriPrefix" /> does not use the http:// or https:// scheme. These are the only schemes supported for <see cref="T:System.Net.HttpListener" /> objects. -or-<paramref name="uriPrefix" /> is not a correctly formatted URI prefix. Make sure the string is terminated with a "/".</exception>
 /// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.Net.HttpListener" /> associated with this collection is closed.</exception>
 /// <exception cref="T:System.Net.HttpListenerException">A Windows function call failed. Check the exception's <see cref="P:System.Net.HttpListenerException.ErrorCode" /> property to determine the cause of the exception. This exception is thrown if another <see cref="T:System.Net.HttpListener" /> has already added the prefix <paramref name="uriPrefix" />.</exception>
 /// <PermissionSet>
 ///   <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
 ///   <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
 ///   <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
 ///   <IPermission class="System.Net.WebPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
 /// </PermissionSet>
 public void Add(string uriPrefix)
 {
     listener.CheckDisposed();
     ListenerPrefix.CheckUri(uriPrefix);
     if (!prefixes.Contains(uriPrefix))
     {
         prefixes.Add(uriPrefix);
         if (listener.IsListening)
         {
             EndPointManager.AddPrefix(uriPrefix, listener);
         }
     }
 }
        public void Add(string uriPrefix)
        {
            _listener.CheckDisposed();
            ListenerPrefix.CheckUri(uriPrefix);
            if (_prefixes.Contains(uriPrefix))
            {
                return;
            }

            _prefixes.Add(uriPrefix);
            if (_listener.IsListening)
            {
                HttpEndPointManager.AddPrefix(uriPrefix, _listener);
            }
        }