2.0协议完善加简单交管配置
This commit is contained in:
@@ -8,12 +8,30 @@ namespace StandardScene.Fass2Simulator
|
||||
{
|
||||
public static class Fass2SimBootstrap
|
||||
{
|
||||
public static Fass2SimConfig LoadConfig()
|
||||
public static string SettingsFile { get; private set; } = "appsettings.json";
|
||||
|
||||
public static void ApplyCommandLine(string[] args)
|
||||
{
|
||||
if (args == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i = 0; i < args.Length - 1; i++)
|
||||
{
|
||||
if (string.Equals(args[i], "--config", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
SettingsFile = args[i + 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Fass2SimConfig LoadConfig(string settingsFile = null)
|
||||
{
|
||||
var basePath = AppContext.BaseDirectory;
|
||||
var builder = new ConfigurationBuilder()
|
||||
.SetBasePath(basePath)
|
||||
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false);
|
||||
.AddJsonFile(settingsFile ?? SettingsFile, optional: true, reloadOnChange: false);
|
||||
|
||||
var configuration = builder.Build();
|
||||
var config = new Fass2SimConfig();
|
||||
|
||||
Reference in New Issue
Block a user