From bc0345eab8ca15c92064869ac32bbc8933177ad9 Mon Sep 17 00:00:00 2001 From: Kaioru Date: Mon, 15 Apr 2024 20:55:10 +0800 Subject: [PATCH] Fix indentation --- .../ProgramHandler.cs | 49 +++++++++++-------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/src/app/Edelstein.Application.Server/ProgramHandler.cs b/src/app/Edelstein.Application.Server/ProgramHandler.cs index 230efe1a5..857cf4e06 100644 --- a/src/app/Edelstein.Application.Server/ProgramHandler.cs +++ b/src/app/Edelstein.Application.Server/ProgramHandler.cs @@ -29,34 +29,41 @@ public async static Task ExecuteRoot(FileInfo file) var configFileInfos = (file.Attributes & FileAttributes.Directory) != 0 ? file.Directory?.GetFiles() ?? Array.Empty() : new[]{ file }; - + var version = new TransportVersion(95, "1", 8); + foreach (var configFile in configFileInfos.Where(f => f.Extension == ".json")) { - var version = new TransportVersion(95, "1", 8); var config = new ConfigurationBuilder() .AddJsonFile(configFile.FullName, false, false) .Build(); - switch (config["Type"]) + try + { + switch (config["Type"]) + { + case "Login": + builder.Services.AddSingleton(p => + { + var loginConfig = new StageConfigLogin(); + var loginSystem = new LoginStageSystem(loginConfig); + + config.Bind(loginConfig); + + return new ServiceHostStage( + p.GetRequiredService>>(), + version, + loginConfig, + loginSystem + ); + }); + break; + default: + continue; + } + } + catch (Exception) { - case "Login": - builder.Services.AddHostedService(p => - { - var loginConfig = new StageConfigLogin(); - var loginSystem = new LoginStageSystem(loginConfig); - - config.Bind(loginConfig); - - return new ServiceHostStage( - p.GetRequiredService>>(), - version, - loginConfig, - loginSystem - ); - }); - break; - default: - continue; + // ignored } }