cli
Usage: java -jar cfggen.jar [options] [-tool toolname[,param=value...]] -datadir <dir> [-gen genname[,param=value...]]
or: java -jar cfggen.jar (launch GUI)
Parameters can be in any order, but -datadir is required when using generators.以下tool/gen参数之间由,分割,参数名和参数取值之间由=或:分割
-----language & logging options -locale locale, default system locale -v verbose,级别1,输出统计和warning信息 -vv verbose,级别2,输出额外信息 -p profiler,内存和时间监测 -pp profiler,内存监测前加gc -nowarn 不打印警告信息,默认打印 -weakwarn 打印弱警告,默认不打印
-----tools -tool xmltocfg 迁移(把之前的.xml改为.cfg) datadir=. -tool fastexcelcheck fastexcel库和poi库比较 datadir=. csvencoding=GBK headrow=2 -tool bytesview bytes=config.bytes match=null -tool term 查看术语,或检查术语使用情况 todo=null term=null check ,默认为false checkall ,默认为false -tool translate 根据相似语句和相关术语翻译todo文件 source=中文 target=英文 todo=language/_todo_en.xlsx term=null ai=ai.json prompt=null batch=10 -tool help print usage help -tool schematocsv datadir=.
-----schema & data -datadir 配表根目录,目录下有文件config.cfg -headrow csv/Excel文件里数据头行数, 默认为2 -encoding csv编码,默认是GBK,如果文件中含有bom则用bom标记的编码 -asroot 兼容之前的目录结构,有ClientTables、PublicTables、ServerTables目录,目录下是.txt后缀的tsv文件。这里可以配置为'ClientTables:noserver,PublicTables,ServerTables:noclient',配合gen的own:-noclient来提取 -exceldirs excel目录,以,分隔 -jsondirs json目录,以,分隔,-asroot、-exceldirs、-jsondirs一旦有一个配置,说明要明确只用-datadir下的部分目录,而不是全部。
-----i18n support -i18nfile 国际化需要的文件,如果不用国际化,就不要配置 -langswitchdir 国际化并且可随时切换语言 -defaultlang langswitchdir设置时有效,表示默认的语言,默认为zh_cn
-----generators -gen verify 检验数据 unreferenced ,默认为false entry ,默认为false -gen search 搜索数据 own=null to=null q=null int <num> [num]... : Search for integers (supports hex 0x) str <substring> : Search for strings containing substring ref <table[key]> [skip] : Search references to a table/key sl [name] : List matching schema names sll [name] : List matching schemas with data (limit 100) slljson [name] : List matching schemas in JSON format h / help : Show this help q / exit : Quit -gen i18n 生成翻译文件(方案1:by 文本) file=../i18n/en.csv 生成文件 -gen i18nbyid 生成翻译文件(方案2:by id) dir=../i18n/en 目录 backup=../backup 备份目录 checkWrite 测试fastexcel的xlsx文件写入是否正确(用再读取一次,然后比较的方式),默认为false -gen java 生成java代码 own=null dir=config 目录 pkg=config 包名 encoding=UTF-8 生成代码文件的编码 sealed 生成sealed interface,需要java17,默认为false builders=null 指向txt文件,每行是一个table,对这些table生成对应的builder configgenDir=null 复制configgen genjava源文件到{configgenDir}/configgen/genjava/,可选 schemaNumPerFile=100 当配表数量过多时生成的ConfigCodeSchema会超过java编译器限制,用此参数来分文 -gen cs 生成c#代码 own=null dir=Config 目录 pkg=Config 包名 encoding=GBK 生成文件的编码 prefix=Data 生成类的前缀 serverText ,默认为false -gen bytes 生成c#/ts/go代码需要的数据 own=null dir=. cipher= xor加密 schema ,默认为false langSeparated ,默认为false -gen lua 生成lua代码(数据也是代码) own=null dir=. 生成代码所在目录 pkg=cfg 模块名称 encoding=UTF-8 编码 emmylua 是否生成EmmyLua相关的注解,默认为false preload 是否一开始就全部加载配置,默认用到的时候再加载,默认为false sharedEmptyTable ,默认为false shared 是否提取非空的公共table,默认为false packBool ,默认为false rForOldShared ,默认为false noStr ,默认为false mkCfgDir=null -gen ts 生成typescript代码 own=null dir=. pkg=Config encoding=UTF-8 ts文件编码 serverText ,默认为false -gen go 生成go代码 own=null dir=config pkg=config encoding=GBK serverText ,默认为false mod=null -gen gd own=null dir=config prefix=Data -gen tsschema 生成特定table的schema(用ts来表达) own=null table= dst=. 目标目录 encoding=UTF-8 生成的ts文件编码 -gen json 把特定table里数据输出为json own=null tables= 表名,;分割 dst=. json文件输出目录 -gen server 为cfgeditor编辑器提供server own=null port=3456 为cfgeditor.exe提供服务的端口 note=_note.csv 非json记录的标注存储位置 watch=0 x>0表示数据文件修改x秒后自动重载配置 postrun=null xx.bat或xx.sh,用于重载配置后的额外动作, .bat最开始多行的注释可有':: -gen '用当前上下文生成,.sh则是'# -gen ' -gen mcpserver 为ai agent比如claude code提供mcp服务 own=null port=3457 watch=0 postrun=null -gen byai 批量生成单个table的数据 cfg=ai.json 同-gen server里的aiCfg ask=ask.txt 问题,每行生成一个json table=skill.buff 表名称 retry=1 重试llm次数,默认1代表不重试Build & Test
Section titled “Build & Test”生成 cfggen.jar
Section titled “生成 cfggen.jar”genjar.bat # 生成cfggen.jar测试 Java:生成 java 代码和数据
Section titled “测试 Java:生成 java 代码和数据”cd example/javagenjava.batrun.bat@rem rm -rf configgen/java -jar ../../cfggen.jar -datadir ../config -gen java,own:-noserver,dir:.,sealed,builders:../config/builders.txt,configgendir:. -gen bytes,own:-noserver,schema测试 Lua
Section titled “测试 Lua”cd example/luagenlua.batrun.bat@rem rm -rf commonjava -jar ../../cfggen.jar -datadir ../config -gen lua,dir:.,emmylua,sharedEmptyTable,shared,mkcfgdir:common测试 CSharp
Section titled “测试 CSharp”cd example/csgencs.batrun.bat@rem rm Config/Loader.cs@rem rm Config/KeyedList.cs@rem rm Config/LoadErrors.cs
java -jar ../../cfggen.jar -datadir ../config -gen cs,dir:.,encoding:UTF-8 -gen bytes,cipher=xyzcd example/gogengo.batrun.bat@rem rm -f config/stream.go config/LoadErrors.gojava -jar ../../cfggen.jar -datadir ../config -gen go,dir:.,encoding:UTF-8 -gen bytes测试 TypeScript
Section titled “测试 TypeScript”cd example/tsgents.batrun.batrm ConfigUtil.tsjava -jar ../../cfggen.jar -datadir ../config -gen ts -gen bytes