diff --git a/src/Luban.Job.Cfg/Source/DataExporters/YamlExportor.cs b/src/Luban.Job.Cfg/Source/DataExporters/YamlExportor.cs index aa050e3..11a8603 100644 --- a/src/Luban.Job.Cfg/Source/DataExporters/YamlExportor.cs +++ b/src/Luban.Job.Cfg/Source/DataExporters/YamlExportor.cs @@ -32,9 +32,14 @@ namespace Luban.Job.Cfg.DataExporters return new YamlScalarNode(x) { Style = ScalarStyle.Plain }; } + private static YamlScalarNode ToText(string x) + { + return new YamlScalarNode(x) { Style = ScalarStyle.SingleQuoted }; + } + public YamlNode Accept(DBool type) { - return ToPlainNode(type.Value.ToString()); + return ToPlainNode(type.Value ? "true" : "false"); } public YamlNode Accept(DByte type) @@ -89,7 +94,7 @@ namespace Luban.Job.Cfg.DataExporters public YamlNode Accept(DString type) { - return new YamlScalarNode(type.Value) { Style = ScalarStyle.SingleQuoted }; + return ToText(type.Value); } public YamlNode Accept(DBytes type) @@ -100,8 +105,8 @@ namespace Luban.Job.Cfg.DataExporters public YamlNode Accept(DText type) { var m = new YamlMappingNode(); - m.Add(DText.KEY_NAME, type.Key); - m.Add(DText.TEXT_NAME, type.TextOfCurrentAssembly); + m.Add(DText.KEY_NAME, ToText(type.Key)); + m.Add(DText.TEXT_NAME, ToText(type.TextOfCurrentAssembly)); return m; } @@ -111,7 +116,7 @@ namespace Luban.Job.Cfg.DataExporters if (type.Type.IsAbstractType) { - m.Add(DefBean.JSON_TYPE_NAME_KEY, DataUtil.GetImplTypeName(type)); + m.Add(DefBean.JSON_TYPE_NAME_KEY, ToText(DataUtil.GetImplTypeName(type))); } var defFields = type.ImplType.HierarchyFields; int index = 0; diff --git a/src/Luban.Job.Cfg/Source/GenArgs.cs b/src/Luban.Job.Cfg/Source/GenArgs.cs index 139e348..e753575 100644 --- a/src/Luban.Job.Cfg/Source/GenArgs.cs +++ b/src/Luban.Job.Cfg/Source/GenArgs.cs @@ -8,7 +8,7 @@ namespace Luban.Job.Cfg [Option('s', "service", Required = true, HelpText = "service")] public string Service { get; set; } - [Option("gen_types", Required = true, HelpText = "code_cs_bin,code_cs_dotnet_json,code_cs_unity_json,code_cs_unity_editor_json,code_lua_bin,code_java_bin,code_java_json,code_go_bin,code_go_json,code_cpp_bin,code_cpp_ue_editor_json,code_python2_json,code_python3_json,code_typescript_bin,code_typescript_json,code_rust_json,code_protobuf,code_template,code_flatbuffers,data_bin,data_lua,data_json,data_json2,data_json_monolithic,data_resources,data_template,data_protobuf_bin,data_protobuf_json,data_flatbuffers_json,convert_json,convert_lua,convert_xlsx . can be multi")] + [Option("gen_types", Required = true, HelpText = "code_cs_bin,code_cs_dotnet_json,code_cs_unity_json,code_cs_unity_editor_json,code_lua_bin,code_java_bin,code_java_json,code_go_bin,code_go_json,code_cpp_bin,code_cpp_ue_editor_json,code_python2_json,code_python3_json,code_typescript_bin,code_typescript_json,code_rust_json,code_protobuf,code_template,code_flatbuffers,data_bin,data_lua,data_json,data_json2,data_json_monolithic,data_yaml,data_resources,data_template,data_protobuf_bin,data_protobuf_json,data_flatbuffers_json,convert_json,convert_lua,convert_xlsx . can be multi")] public string GenType { get; set; } [Option("input_data_dir", Required = true, HelpText = "input data dir")]