Esempio n. 1
0
 public NBlinkService(IServiceProvider provider)
 {
     _appLifetime = provider.GetRequiredService <IApplicationLifetime>();
     _logger      = provider.GetRequiredService <ILoggerFactory>()
                    .CreateLogger(this.GetType().Name);
     _settings = provider.GetRequiredService <IOptions <NBlinkSettings> >()
                 .Value;
     _dispatcher = provider.GetRequiredService <IBlinkDispatcher>();
     _browser    = provider.GetRequiredService <IBrowser>();
     Initialise(provider);
 }
Esempio n. 2
0
        public NBlinkHttpService(ILoggerFactory loggerFactory, IOptions <NBlinkSettings> settings)
        {
            if (!HttpListener.IsSupported)
            {
                throw new ApplicationException(
                          "Windows XP SP2 or Server 2003 is required to use the HttpListener class.");
            }

            _logger   = loggerFactory.CreateLogger(this.GetType().Name);
            _settings = settings.Value;
            _rootPath = GetRootPath();
            if (!Directory.Exists(_rootPath))
            {
                throw new ApplicationException($"{_rootPath} don't exist");
            }

            _rootPrefix = GetHostAddress();
        }
Esempio n. 3
0
 public BrowserBase(ILoggerFactory loggerFactory, IOptions <NBlinkSettings> settings, IBlinkDispatcher dispatcher)
 {
     _logger    = loggerFactory.CreateLogger(this.GetType().Name);
     _settings  = settings.Value;
     Dispatcher = dispatcher;
 }