Skip to content

Commit 0ae2f11

Browse files
committed
[修复]1. 修复反射启动参数为空的问题
1 parent 4ab9f5e commit 0ae2f11

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

GameFrameX.StartUp/GameApp.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -65,30 +65,30 @@ public static async Task Entry(string[] args, Action initAction, Action<LogOptio
6565
LogOptions.Default.LogType = serverType;
6666
LogOptions.Default.GrafanaLokiLabels = new Dictionary<string, string>();
6767

68-
// 将LauncherOptions的所有属性添加到标签中
69-
var properties = typeof(LauncherOptions).GetProperties();
70-
foreach (var property in properties)
68+
if (launcherOptions != null)
7169
{
72-
var grafanaLokiLabelTagAttribute = property.GetCustomAttribute<GrafanaLokiLabelTagAttribute>();
73-
if (grafanaLokiLabelTagAttribute == null)
70+
// 将LauncherOptions的所有属性添加到标签中
71+
var properties = typeof(LauncherOptions).GetProperties();
72+
foreach (var property in properties)
7473
{
75-
continue;
76-
}
74+
var grafanaLokiLabelTagAttribute = property.GetCustomAttribute<GrafanaLokiLabelTagAttribute>();
75+
if (grafanaLokiLabelTagAttribute == null)
76+
{
77+
continue;
78+
}
7779

78-
var value = property.GetValue(launcherOptions)?.ToString();
79-
if (string.IsNullOrEmpty(value))
80-
{
81-
continue;
82-
}
80+
var value = property.GetValue(launcherOptions)?.ToString();
81+
if (string.IsNullOrEmpty(value))
82+
{
83+
continue;
84+
}
8385

84-
if (!LogOptions.Default.GrafanaLokiLabels.TryAdd(property.Name, value))
85-
{
86-
LogHelper.WarnConsole($"Grafana Loki 标签 {property.Name} 已存在,将被忽略");
86+
if (!LogOptions.Default.GrafanaLokiLabels.TryAdd(property.Name, value))
87+
{
88+
LogHelper.WarnConsole($"Grafana Loki 标签 {property.Name} 已存在,将被忽略");
89+
}
8790
}
88-
}
8991

90-
if (launcherOptions != null)
91-
{
9292
// 设置日志配置信息
9393
LogOptions.Default.IsConsole = launcherOptions.LogIsConsole;
9494
LogOptions.Default.IsGrafanaLoki = launcherOptions.LogIsGrafanaLoki;

0 commit comments

Comments
 (0)