Skip to content

Commit 53071bd

Browse files
committed
style(OptionsDebugger): 优化控制台输出格式
将表格标题输出移到方法开头,移除重复的边框计算代码,使输出更清晰
1 parent 18fdd7b commit 53071bd

1 file changed

Lines changed: 4 additions & 13 deletions

File tree

GameFrameX.Foundation.Options/OptionsDebugger.cs

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ public static class OptionsDebugger
2727
/// <param name="options">解析后的选项对象</param>
2828
public static void PrintParsedOptions<T>(T options) where T : class
2929
{
30+
Console.WriteLine("╔══════════════════════════════════════════════════════════════════════╗");
31+
Console.WriteLine("║ Command-line parameter and parsed configuration object information ║");
32+
Console.WriteLine("╚══════════════════════════════════════════════════════════════════════╝");
33+
Console.WriteLine();
3034
try
3135
{
3236
// 使用反射获取所有属性
@@ -150,19 +154,6 @@ public static void PrintParsedOptions<T>(T options) where T : class
150154
}
151155

152156
int maxTableWidth = Math.Max(60, consoleWidth - 1);
153-
154-
// 计算最终表格宽度,用于上方/下方的双线边框和居中标题
155-
int tableWidth = CalculateTotalWidth();
156-
string topDouble = "╔" + new string('═', Math.Max(0, tableWidth - 2)) + "╗";
157-
string bottomDouble = "╚" + new string('═', Math.Max(0, tableWidth - 2)) + "╝";
158-
string headerText = "Command-line parameter and parsed configuration object information";
159-
string centeredHeader = CenterPadDisplay(headerText, Math.Max(0, tableWidth - 2));
160-
161-
Console.WriteLine(topDouble);
162-
Console.WriteLine($"║{centeredHeader}║");
163-
Console.WriteLine(bottomDouble);
164-
Console.WriteLine();
165-
166157
while (CalculateTotalWidth() > maxTableWidth)
167158
{
168159
if (descWidth > minDescWidth)

0 commit comments

Comments
 (0)