public static RestServer <HttpListener> ToRestServer(this HttpListener listener) { RestServer <HttpListener> server = null; if (listener != null) { RestServerContext context = new RestServerContext(); server = new RestServer <HttpListener>(listener, context); context.StartFunc = listener.Start; context.StopFunc = listener.Stop; context.GetContextAsync = () => listener.GetContextAsync().ContinueWith(task => task.Result.ToRestListenerContext()); server.IsListening = FProperty.Create(() => listener.IsListening); } return(server); }
public RestServer(T internalServer, RestServerContext serverContext, bool verbose = false) { Internal = internalServer; ServerContext = serverContext; this.verbose = verbose; }