public UiConfigurationService(IFileSystemService fileSystemService, IWebHostEnvironment hostingEnvironment, IJsonSerializerService jsonSerializerService, IAdapterSettingService adapterSettingService)
 {
     _fileSystemService     = fileSystemService;
     _hostingEnvironment    = hostingEnvironment;
     _jsonSerializerService = jsonSerializerService;
     _adapterSettingService = adapterSettingService;
 }
예제 #2
0
 public ApiController(IAdapterService adapterService, IAdapterSettingService adapterSettingService, ILogService logService, IHostApplicationLifetime hostApplicationLifetime)
 {
     _adapterService          = adapterService;
     _adapterSettingService   = adapterSettingService;
     _logService              = logService;
     _hostApplicationLifetime = hostApplicationLifetime;
 }
예제 #3
0
 public ConfigurationController(IUiConfigurationService uiConfigurationService, IAdapterSettingService adapterSettingService)
 {
     _uiConfigurationService = uiConfigurationService;
     _adapterSettingService  = adapterSettingService;
 }
예제 #4
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app,
                              IWebHostEnvironment env,
                              ILogService logService,
                              ILogMessageFactory logMessageFactory,
                              IConnectionProvider connectionProvider,
                              IMqttRepository repository,
                              IMqttCommandAdapter commandAdapter,
                              IAdapterSettingService adapterSettingService,
                              IUiConfigurationService uiConfigurationService,
                              INotificationService notificationService,
                              ISettingsService settingsService,
                              IFileSystemService fileSystemService,
                              ILogFormatterService logFormatterService,
                              ILogFileService logFileService,
                              ISettingsProvider settingsProvider)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }
            app.UseStaticFiles();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
            });

            settingsProvider.ReadSettings();

            logService.RegisterSinks(new List <IlogSink>
            {
                new ConsoleLogSink(),
                new MemoryLogSink(logMessageFactory, notificationService),
                new FileLogSink(fileSystemService, logFormatterService, logFileService)
            });

            if (Debugger.IsAttached)
            {
                logService.RegisterSink(new DebugLogSink());
            }

            logService.Log(LogSeverity.Info, "Logging started.");

            var repo = new DatabaseRepository();

            repo.InitializeDatabase();

            commandAdapter.Initialize();
            connectionProvider.InitializeConnection();
            repository.Initialize();
            adapterSettingService.Initialize();
            uiConfigurationService.ReadAllConfigurationFiles();

            ConfigureSystemSpecifics(app.ApplicationServices);
            app.ApplicationServices.GetService <ICustomCommandConfigurationService>().ReloadConfiguration();
        }