예제 #1
0
 public static void ReadConfig()
 {
     try
     {
         gatewayConfig      = configuration.GetSection("Gateway").Get <GatewayConfig>();
         logs.config        = configuration.GetSection("Logs").Get <LogsConfig>();
         logs.consoleConfig = configuration.GetSection("Console").Get <ConsoleConfig>();
         nodesEngineConfig  = configuration.GetSection("NodesEngine").Get <NodesEngineConfig>();
         nodeEditorConfig   = configuration.GetSection("NodeEditor").Get <NodeEditorConfig>();
         dataBaseConfig     = configuration.GetSection("DataBase").Get <DataBaseConfig>();
         webServerRules     = configuration.GetSection("WebServer").Get <WebServerRules>();
         webServerConfig    = configuration.GetSection("WebServer").Get <WebServerConfig>();
     }
     catch
     {
         logs.AddSystemError("ERROR: Bad configuration in appsettings.json file.");
         throw new Exception("Bad configuration in appsettings.json file.");
     }
 }
 public static void ReadConfig()
 {
     try
     {
         gatewayConfig = configuration.Get<GatewayConfig>("Gateway");
         gatewayConfig.SerialGatewayConfig = configuration.Get<SerialGatewayConfig>("Gateway:SerialGateway");
         gatewayConfig.EthernetGatewayConfig = configuration.Get<EthernetGatewayConfig>("Gateway:EthernetGateway");
         logs.config = configuration.Get<LogsConfig>("Logs");
         logs.consoleConfig = configuration.Get<ConsoleConfig>("Console");
         nodesEngineConfig = configuration.Get<NodesEngineConfig>("NodesEngine");
         nodeEditorConfig = configuration.Get<NodeEditorConfig>("NodeEditor");
         dataBaseConfig = configuration.Get<DataBaseConfig>("DataBase");
         webServerRules = configuration.Get<WebServerRules>("WebServer");
         webServerConfig = configuration.Get<WebServerConfig>("WebServer");
     }
     catch
     {
         logs.AddSystemError("ERROR: Bad configuration in appsettings.json file.");
         throw new Exception("Bad configuration in appsettings.json file.");
     }
 }