Пример #1
0
        public Host(IEnumerable <IHandler> handlers, int port)
        {
            var resourceHandler = new EmbeddedResourceHandler(handlers.Select(x => x.GetType().Assembly));
            var resourceIndex   = new EmbeddedResourceHandlerIndex(resourceHandler);

            var defaultHandlers = new IHandler[]
            {
                resourceHandler,
                resourceIndex,
                new HomeHandler(handlers.OfType <IModule>().Concat(new[] { resourceIndex })),
                new DefaultFallbackHandler()
            };

            _handlers = handlers.Concat(defaultHandlers);
            _port     = port;
        }
Пример #2
0
 public EmbeddedResourceHandlerIndex(EmbeddedResourceHandler resourceHandler)
 {
     _resourceHandler = resourceHandler;
 }