Example #1
0
 public WebServer(WebServerCallback callback)
     : this(new[] { DefaultLocalPrefix }, callback)
 {
     if (callback == null)
     {
         throw new ArgumentException(nameof(callback));
     }
 }
Example #2
0
 public WebServer(WebServerCallback callback, params string[] prefixes)
     : this(prefixes, callback)
 {
     if (callback == null)
     {
         throw new ArgumentException(nameof(callback));
     }
 }
Example #3
0
        //---------------------------------------------------------------------
        private WebServer(string[] prefixes, WebServerCallback callback)
        {
            if (!HttpListener.IsSupported)
            {
                throw new NotSupportedException("Needs Windows XP SP2, Server 2003 or later.");
            }

            if (prefixes == null || prefixes.Length == 0)
            {
                throw new ArgumentException(nameof(prefixes));
            }

            foreach (var prefix in prefixes)
            {
                _listener.Prefixes.Add(prefix);
            }

            _callback = callback;
        }