Skip to content

Commit

Permalink
Fix indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaioru committed Apr 15, 2024
1 parent 1504809 commit bc0345e
Showing 1 changed file with 28 additions and 21 deletions.
49 changes: 28 additions & 21 deletions src/app/Edelstein.Application.Server/ProgramHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,34 +29,41 @@ public async static Task ExecuteRoot(FileInfo file)
var configFileInfos = (file.Attributes & FileAttributes.Directory) != 0
? file.Directory?.GetFiles() ?? Array.Empty<FileInfo>()
: 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<IHostedService>(p =>
{
var loginConfig = new StageConfigLogin();
var loginSystem = new LoginStageSystem(loginConfig);

config.Bind(loginConfig);

return new ServiceHostStage<ILoginStageUser, ILoginStageSystem>(
p.GetRequiredService<ILogger<ServiceHostStage<ILoginStageUser, ILoginStageSystem>>>(),
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<ILoginStageUser, ILoginStageSystem>(
p.GetRequiredService<ILogger<ServiceHostStage<ILoginStageUser, ILoginStageSystem>>>(),
version,
loginConfig,
loginSystem
);
});
break;
default:
continue;
// ignored
}
}

Expand Down

0 comments on commit bc0345e

Please sign in to comment.