Skip to content

Commit c531e49

Browse files
committed
refactor(ProtoExport): 替换命令行解析库并扩展选项功能
- 从 CommandLine 迁移到 GameFrameX.Foundation.Options 库 - 为 LauncherOptions 添加 XML 文档注释 - 新增错误码 Excel 相关配置选项
1 parent 91fc8c3 commit c531e49

File tree

2 files changed

+35
-8
lines changed

2 files changed

+35
-8
lines changed

ProtoExport/LauncherOptions.cs

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,48 @@
1-
using CommandLine;
1+
using GameFrameX.Foundation.Options.Attributes;
22

33
namespace GameFrameX.ProtoExport;
44

55
public sealed class LauncherOptions
66
{
7-
[Option("inputPath", Required = true, HelpText = "协议文件路径")]
7+
/// <summary>
8+
/// 协议文件路径
9+
/// </summary>
10+
[Option("inputPath", Required = true, Description = "协议文件路径")]
811
public string InputPath { get; set; }
912

10-
[Option("mode", Required = true, HelpText = "运行模式")]
13+
/// <summary>
14+
/// 运行模式
15+
/// </summary>
16+
[Option("mode", Required = true, Description = "运行模式")]
1117
public string Mode { get; set; }
1218

13-
[Option("outputPath", Required = true, HelpText = "文件路径")]
19+
/// <summary>
20+
/// 文件路径
21+
/// </summary>
22+
[Option("outputPath", Required = true, Description = "文件路径")]
1423
public string OutputPath { get; set; }
1524

16-
[Option("namespaceName", Required = true, HelpText = "命名空间")]
25+
/// <summary>
26+
/// 命名空间
27+
/// </summary>
28+
[Option("namespaceName", Required = true, Description = "命名空间")]
1729
public string NamespaceName { get; set; }
1830

19-
[Option("isGenerateErrorCode", Required = false, Default = true, HelpText = "是否生成错误码")]
31+
/// <summary>
32+
/// 是否生成错误码
33+
/// </summary>
34+
[Option("isGenerateErrorCode", Required = false, DefaultValue = true, Description = "是否生成错误码")]
2035
public bool IsGenerateErrorCode { get; set; }
36+
37+
/// <summary>
38+
/// 是否生成错误码Excel文件
39+
/// </summary>
40+
[Option("isGenerateErrorCodeExcelFile", Required = false, DefaultValue = true, Description = "是否生成错误码Excel文件")]
41+
public bool IsGenerateErrorCodeExcelFile { get; set; }
42+
43+
/// <summary>
44+
/// 错误码Excel文件路径
45+
/// </summary>
46+
[Option("errorCodeExcelFilePath", Required = false, Description = "错误码Excel文件路径")]
47+
public string ErrorCodeExcelFilePath { get; set; }
2148
}

ProtoExport/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using CommandLine;
1+
using GameFrameX.Foundation.Options;
22

33
namespace GameFrameX.ProtoExport
44
{
@@ -8,7 +8,7 @@ private static int Main(string[] args)
88
{
99
try
1010
{
11-
var launcherOptions = Parser.Default.ParseArguments<LauncherOptions>(args).Value;
11+
var launcherOptions = new OptionsBuilder<LauncherOptions>(args).Build();
1212
if (launcherOptions == null)
1313
{
1414
Console.WriteLine("参数错误,解析失败");

0 commit comments

Comments
 (0)