├── docs
├── _config.yml
├── images
│ ├── ui.png
│ ├── web.png
│ ├── icon.png
│ ├── logo.png
│ ├── more.png
│ ├── other.png
│ ├── python.png
│ ├── weixin.jpg
│ ├── favicon.ico
│ ├── favicon.png
│ ├── pipeline.jpg
│ ├── process.jpg
│ ├── zhifubao.jpg
│ ├── adv
│ │ ├── def_01.png
│ │ ├── def_02.png
│ │ ├── def_03.png
│ │ ├── def_04.png
│ │ ├── def_05.png
│ │ ├── def_06.png
│ │ ├── def_07.png
│ │ ├── def_08.png
│ │ ├── def_09.png
│ │ ├── def_10.png
│ │ ├── def_11.png
│ │ ├── def_12.png
│ │ ├── def_13.png
│ │ ├── def_14.png
│ │ ├── def_15.png
│ │ ├── def_16.png
│ │ ├── def_17.png
│ │ ├── def_18.png
│ │ ├── def_19.png
│ │ ├── def_20.png
│ │ ├── def_21.png
│ │ ├── def_22.png
│ │ ├── def_23.png
│ │ ├── def_24.png
│ │ ├── def_25.png
│ │ ├── def_26.png
│ │ ├── def_27.png
│ │ ├── def_28.png
│ │ ├── def_29.png
│ │ ├── def_30.png
│ │ ├── def_31.png
│ │ ├── def_32.png
│ │ ├── def_33.png
│ │ ├── def_34.png
│ │ ├── def_35.png
│ │ ├── def_36.png
│ │ ├── def_37.png
│ │ ├── def_38.png
│ │ ├── def_39.png
│ │ ├── def_40.png
│ │ ├── def_41.png
│ │ ├── def_42.png
│ │ ├── def_43.png
│ │ ├── def_44.png
│ │ ├── def_45.png
│ │ ├── def_46.png
│ │ ├── def_47.png
│ │ ├── def_48.png
│ │ ├── def_49.png
│ │ └── def_50.png
│ ├── cases
│ │ ├── bean.jpg
│ │ ├── bean2.jpg
│ │ ├── enum.jpg
│ │ ├── tag.jpg
│ │ ├── tag2.jpg
│ │ ├── simple1.jpg
│ │ ├── stream.jpg
│ │ ├── collection.jpg
│ │ ├── l10n_text.jpg
│ │ ├── multiline.jpg
│ │ ├── nullable.jpg
│ │ ├── sep_bean.jpg
│ │ ├── singleton.jpg
│ │ ├── singleton2.jpg
│ │ ├── title_enum.jpg
│ │ ├── title_map.jpg
│ │ ├── titlelimit.jpg
│ │ ├── ignorefield.jpg
│ │ ├── multileveltitle.jpg
│ │ ├── primitive_type.jpg
│ │ ├── sep_container1.jpg
│ │ ├── sep_container2.jpg
│ │ ├── quickstart_reward.jpg
│ │ ├── quickstart_table.jpg
│ │ ├── table_list_indep_key.jpg
│ │ ├── table_list_not_key.jpg
│ │ ├── table_list_union_key.jpg
│ │ └── title_dynamic_bean.jpg
│ ├── docusaurus.png
│ ├── excel_bean.jpg
│ ├── excel_enum.jpg
│ ├── excel_table.jpg
│ ├── Client_Server.png
│ ├── dots_release.png
│ ├── panda-waving.png
│ ├── flying-seagull.jpg
│ ├── luban_edit_tool.png
│ ├── install
│ │ ├── install_01.png
│ │ ├── install_02.png
│ │ ├── install_03.png
│ │ ├── install_04.png
│ │ ├── install_05.png
│ │ ├── install_06.png
│ │ ├── install_07.png
│ │ ├── install_08.png
│ │ ├── install_09.png
│ │ └── install_10.png
│ ├── docusaurus-social-card.jpg
│ └── reliable.svg
└── sponsor
│ ├── weixin.JPG
│ └── zhifubao.JPG
├── src
├── Luban.PHP
│ ├── Templates
│ │ └── common
│ │ │ └── php
│ │ │ └── enum.sbn
│ └── AssemblyInfo.cs
├── Luban.Javascript
│ ├── Templates
│ │ └── common
│ │ │ └── js
│ │ │ └── enum.sbn
│ └── AssemblyInfo.cs
├── Luban.Typescript
│ ├── Templates
│ │ ├── common
│ │ │ └── ts
│ │ │ │ └── enum.sbn
│ │ └── typescript-protobuf
│ │ │ └── schema.sbn
│ └── AssemblyInfo.cs
├── .dockerignore
├── Luban.Rust
│ ├── Templates
│ │ ├── common
│ │ │ └── rs
│ │ │ │ └── macros
│ │ │ │ └── Cargo.toml.sbn
│ │ ├── rust-bin
│ │ │ ├── toml.sbn
│ │ │ └── lib.sbn
│ │ └── rust-json
│ │ │ ├── toml.sbn
│ │ │ └── lib.sbn
│ ├── AssemblyInfo.cs
│ └── ConstantStrings.cs
├── Luban.sln.DotSettings
├── Luban.DataValidator.Builtin
│ ├── Luban.DataValidator.Builtin.csproj
│ ├── AssemblyInfo.cs
│ ├── Path
│ │ ├── IPathPattern.cs
│ │ └── GodotResourcePattern.cs
│ └── Set
│ │ └── StringDataSet.cs
├── Luban.CSharp
│ ├── CodeTarget
│ │ └── CsharpCodeCodeTarget.cs
│ ├── TemplateExtensions
│ │ └── CsharpCodeTemplateExtension.cs
│ ├── Templates
│ │ ├── common
│ │ │ └── cs
│ │ │ │ └── enum.sbn
│ │ ├── cs-bin
│ │ │ └── tables.sbn
│ │ ├── cs-code
│ │ │ └── tables.sbn
│ │ ├── cs-simple-json
│ │ │ └── tables.sbn
│ │ ├── cs-dotnet-json
│ │ │ └── tables.sbn
│ │ └── cs-newtonsoft-json
│ │ │ └── tables.sbn
│ ├── AssemblyInfo.cs
│ ├── ConstStrings.cs
│ └── TypeVisitors
│ │ └── EditorUnderlyingTypeNameVisitor.cs
├── Luban.Golang
│ ├── Templates
│ │ ├── common
│ │ │ └── go
│ │ │ │ └── enum.sbn
│ │ ├── go-json
│ │ │ └── tables.sbn
│ │ └── go-bin
│ │ │ └── tables.sbn
│ └── AssemblyInfo.cs
├── Luban.L10N
│ ├── Luban.L10N.csproj
│ ├── AssemblyInfo.cs
│ └── DataTarget
│ │ └── TextKeyCollection.cs
├── Luban.Cpp
│ ├── Templates
│ │ ├── cpp-rawptr-bin
│ │ │ ├── schema_h.sbn
│ │ │ ├── tables.sbn
│ │ │ ├── bean.sbn
│ │ │ └── schema_cpp.sbn
│ │ ├── cpp-sharedptr-bin
│ │ │ ├── schema_h.sbn
│ │ │ ├── tables.sbn
│ │ │ └── bean.sbn
│ │ └── common
│ │ │ └── cpp
│ │ │ └── enum.sbn
│ ├── AssemblyInfo.cs
│ └── TypeVisitors
│ │ └── CppRawptrUnderlyingDeserializeVisitor.cs
├── Luban.Bson
│ ├── Luban.Bson.csproj
│ └── AssemblyInfo.cs
├── Luban.MsgPack
│ ├── Luban.MsgPack.csproj
│ └── AssemblyInfo.cs
├── Luban.Java
│ ├── Templates
│ │ ├── common
│ │ │ └── java
│ │ │ │ └── enum.sbn
│ │ ├── java-bin
│ │ │ └── tables.sbn
│ │ └── java-json
│ │ │ └── tables.sbn
│ └── AssemblyInfo.cs
├── nuget.config
├── Luban.Gdscript
│ ├── Luban.Gdscript.csproj
│ └── AssemblyInfo.cs
├── Luban.Dart
│ ├── Templates
│ │ ├── common
│ │ │ └── dart
│ │ │ │ └── enum.sbn
│ │ └── dart-json
│ │ │ └── tables.sbn
│ ├── Luban.Dart.csproj
│ └── AssemblyInfo.cs
├── Luban.Lua
│ ├── Luban.Lua.csproj
│ ├── AssemblyInfo.cs
│ └── CodeTarget
│ │ └── LuaLuaCodeTarget.cs
├── Luban.Protobuf
│ ├── Luban.Protobuf.csproj
│ ├── Templates
│ │ ├── pb
│ │ │ └── schema.sbn
│ │ └── cs_pb
│ │ │ └── tables.sbn
│ ├── AssemblyInfo.cs
│ ├── CodeTarget
│ │ ├── CSharpProtobuf2CodeTarget.cs
│ │ └── CSharpProtobuf3CodeTarget.cs
│ └── DataTarget
│ │ └── Protobuf3BinDataTarget.cs
├── Luban.FlatBuffers
│ ├── Luban.FlatBuffers.csproj
│ ├── AssemblyInfo.cs
│ └── Templates
│ │ └── flatbuffers
│ │ └── schema.sbn
├── Luban.Python
│ ├── Luban.Python.csproj
│ ├── AssemblyInfo.cs
│ └── CodeTarget
│ │ └── Python2JsonCodeTarget.cs
├── Luban
│ └── nlog.xml
├── Luban.Core
│ ├── AssemblyInfo.cs
│ ├── Defs
│ │ ├── TableMode.cs
│ │ └── DefRefGroup.cs
│ ├── Serialization
│ │ ├── ITypeId.cs
│ │ ├── EUnmarshalError.cs
│ │ ├── ISerializable.cs
│ │ └── BeanBase.cs
│ ├── Validator
│ │ ├── ValidatorType.cs
│ │ ├── ITableValidator.cs
│ │ └── IDataValidator.cs
│ ├── Schema
│ │ ├── IConfigLoader.cs
│ │ ├── SchemaFileInfo.cs
│ │ ├── ISchemaLoader.cs
│ │ ├── IBeanSchemaLoader.cs
│ │ ├── SchemaLoaderBase.cs
│ │ ├── SchemaCollectorAttribute.cs
│ │ ├── ITableImporter.cs
│ │ └── BeanSchemaLoaderAttribute.cs
│ ├── CustomBehaviour
│ │ ├── IPriorityBehaviour.cs
│ │ ├── ICustomBehaviour.cs
│ │ └── BehaviourBaseAttribute.cs
│ ├── CodeFormat
│ │ ├── INamingConventionFormatter.cs
│ │ ├── CodeStyleAttribute.cs
│ │ ├── NamingConventionFormatters
│ │ │ ├── NoneFormatter.cs
│ │ │ ├── UpperCaseFormatter.cs
│ │ │ ├── SnakeCaseFormatter.cs
│ │ │ ├── PascalCaseFormatter.cs
│ │ │ └── CamelCaseFormatter.cs
│ │ └── NamingConventionAttribute.cs
│ ├── RegisterBehaviourAttribute.cs
│ ├── RawDefs
│ │ ├── RawGroup.cs
│ │ ├── RawRefGroup.cs
│ │ ├── TypeMapper.cs
│ │ └── RawTarget.cs
│ ├── Pipeline
│ │ ├── IPipeline.cs
│ │ └── PipelineAttribute.cs
│ ├── CodeTarget
│ │ ├── NameLocation.cs
│ │ └── CodeTargetAttribute.cs
│ ├── DataTarget
│ │ ├── IDataExporter.cs
│ │ ├── DataTargetAttribute.cs
│ │ └── DataExporterAttribute.cs
│ ├── TypeVisitors
│ │ ├── AllTrueVisitor.cs
│ │ └── AllFalseVisitor.cs
│ ├── L10N
│ │ ├── TextProviderAttribute.cs
│ │ └── ITextProvider.cs
│ ├── OutputSaver
│ │ ├── IOutputSaver.cs
│ │ ├── OutputSaverAttribute.cs
│ │ └── NullSaver.cs
│ ├── Utils
│ │ ├── TimeUtil.cs
│ │ ├── TemplateUtil.cs
│ │ └── CollectionExtensions.cs
│ ├── DataLoader
│ │ ├── DataLoaderAttribute.cs
│ │ └── IDataLoader.cs
│ ├── IGenerationContext.cs
│ ├── PostProcess
│ │ └── IPostProcess.cs
│ ├── DataTransformer
│ │ └── IDataTransformer.cs
│ └── DataVisitors
│ │ └── ToStringVisitor2.cs
├── Luban.Schema.Builtin
│ └── AssemblyInfo.cs
├── Luban.DataLoader.Builtin
│ ├── AssemblyInfo.cs
│ ├── DataVisitors
│ │ └── UnityAssetDataCreator.cs
│ └── Excel
│ │ └── RawSheet.cs
└── Luban.DataTarget.Builtin
│ ├── AssemblyInfo.cs
│ ├── Res
│ └── ResourceInfo.cs
│ ├── DefaultDataExporter.cs
│ └── NullDataExporter.cs
├── scripts
├── format.bat
└── format.sh
├── .travis.yml
├── .github
├── FUNDING.yml
└── workflows
│ └── sync_gitee.yml
└── LICENSE
/docs/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-slate
--------------------------------------------------------------------------------
/src/Luban.PHP/Templates/common/php/enum.sbn:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/src/Luban.Javascript/Templates/common/js/enum.sbn:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/src/Luban.Typescript/Templates/common/ts/enum.sbn:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/scripts/format.bat:
--------------------------------------------------------------------------------
1 | cd ../src
2 | dotnet format --severity error -v n
3 |
--------------------------------------------------------------------------------
/scripts/format.sh:
--------------------------------------------------------------------------------
1 | cd ../src
2 | dotnet format --severity error -v n
3 |
--------------------------------------------------------------------------------
/docs/images/ui.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/ui.png
--------------------------------------------------------------------------------
/docs/images/web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/web.png
--------------------------------------------------------------------------------
/docs/images/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/icon.png
--------------------------------------------------------------------------------
/docs/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/logo.png
--------------------------------------------------------------------------------
/docs/images/more.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/more.png
--------------------------------------------------------------------------------
/docs/images/other.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/other.png
--------------------------------------------------------------------------------
/docs/images/python.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/python.png
--------------------------------------------------------------------------------
/docs/images/weixin.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/weixin.jpg
--------------------------------------------------------------------------------
/docs/images/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/favicon.ico
--------------------------------------------------------------------------------
/docs/images/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/favicon.png
--------------------------------------------------------------------------------
/docs/images/pipeline.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/pipeline.jpg
--------------------------------------------------------------------------------
/docs/images/process.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/process.jpg
--------------------------------------------------------------------------------
/docs/images/zhifubao.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/zhifubao.jpg
--------------------------------------------------------------------------------
/docs/sponsor/weixin.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/sponsor/weixin.JPG
--------------------------------------------------------------------------------
/docs/images/adv/def_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_01.png
--------------------------------------------------------------------------------
/docs/images/adv/def_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_02.png
--------------------------------------------------------------------------------
/docs/images/adv/def_03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_03.png
--------------------------------------------------------------------------------
/docs/images/adv/def_04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_04.png
--------------------------------------------------------------------------------
/docs/images/adv/def_05.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_05.png
--------------------------------------------------------------------------------
/docs/images/adv/def_06.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_06.png
--------------------------------------------------------------------------------
/docs/images/adv/def_07.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_07.png
--------------------------------------------------------------------------------
/docs/images/adv/def_08.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_08.png
--------------------------------------------------------------------------------
/docs/images/adv/def_09.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_09.png
--------------------------------------------------------------------------------
/docs/images/adv/def_10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_10.png
--------------------------------------------------------------------------------
/docs/images/adv/def_11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_11.png
--------------------------------------------------------------------------------
/docs/images/adv/def_12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_12.png
--------------------------------------------------------------------------------
/docs/images/adv/def_13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_13.png
--------------------------------------------------------------------------------
/docs/images/adv/def_14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_14.png
--------------------------------------------------------------------------------
/docs/images/adv/def_15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_15.png
--------------------------------------------------------------------------------
/docs/images/adv/def_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_16.png
--------------------------------------------------------------------------------
/docs/images/adv/def_17.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_17.png
--------------------------------------------------------------------------------
/docs/images/adv/def_18.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_18.png
--------------------------------------------------------------------------------
/docs/images/adv/def_19.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_19.png
--------------------------------------------------------------------------------
/docs/images/adv/def_20.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_20.png
--------------------------------------------------------------------------------
/docs/images/adv/def_21.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_21.png
--------------------------------------------------------------------------------
/docs/images/adv/def_22.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_22.png
--------------------------------------------------------------------------------
/docs/images/adv/def_23.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_23.png
--------------------------------------------------------------------------------
/docs/images/adv/def_24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_24.png
--------------------------------------------------------------------------------
/docs/images/adv/def_25.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_25.png
--------------------------------------------------------------------------------
/docs/images/adv/def_26.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_26.png
--------------------------------------------------------------------------------
/docs/images/adv/def_27.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_27.png
--------------------------------------------------------------------------------
/docs/images/adv/def_28.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_28.png
--------------------------------------------------------------------------------
/docs/images/adv/def_29.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_29.png
--------------------------------------------------------------------------------
/docs/images/adv/def_30.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_30.png
--------------------------------------------------------------------------------
/docs/images/adv/def_31.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_31.png
--------------------------------------------------------------------------------
/docs/images/adv/def_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_32.png
--------------------------------------------------------------------------------
/docs/images/adv/def_33.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_33.png
--------------------------------------------------------------------------------
/docs/images/adv/def_34.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_34.png
--------------------------------------------------------------------------------
/docs/images/adv/def_35.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_35.png
--------------------------------------------------------------------------------
/docs/images/adv/def_36.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_36.png
--------------------------------------------------------------------------------
/docs/images/adv/def_37.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_37.png
--------------------------------------------------------------------------------
/docs/images/adv/def_38.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_38.png
--------------------------------------------------------------------------------
/docs/images/adv/def_39.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_39.png
--------------------------------------------------------------------------------
/docs/images/adv/def_40.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_40.png
--------------------------------------------------------------------------------
/docs/images/adv/def_41.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_41.png
--------------------------------------------------------------------------------
/docs/images/adv/def_42.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_42.png
--------------------------------------------------------------------------------
/docs/images/adv/def_43.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_43.png
--------------------------------------------------------------------------------
/docs/images/adv/def_44.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_44.png
--------------------------------------------------------------------------------
/docs/images/adv/def_45.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_45.png
--------------------------------------------------------------------------------
/docs/images/adv/def_46.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_46.png
--------------------------------------------------------------------------------
/docs/images/adv/def_47.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_47.png
--------------------------------------------------------------------------------
/docs/images/adv/def_48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_48.png
--------------------------------------------------------------------------------
/docs/images/adv/def_49.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_49.png
--------------------------------------------------------------------------------
/docs/images/adv/def_50.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/adv/def_50.png
--------------------------------------------------------------------------------
/docs/images/cases/bean.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/cases/bean.jpg
--------------------------------------------------------------------------------
/docs/images/cases/bean2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/cases/bean2.jpg
--------------------------------------------------------------------------------
/docs/images/cases/enum.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/cases/enum.jpg
--------------------------------------------------------------------------------
/docs/images/cases/tag.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/cases/tag.jpg
--------------------------------------------------------------------------------
/docs/images/cases/tag2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/cases/tag2.jpg
--------------------------------------------------------------------------------
/docs/images/docusaurus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/docusaurus.png
--------------------------------------------------------------------------------
/docs/images/excel_bean.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/excel_bean.jpg
--------------------------------------------------------------------------------
/docs/images/excel_enum.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/excel_enum.jpg
--------------------------------------------------------------------------------
/docs/images/excel_table.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/excel_table.jpg
--------------------------------------------------------------------------------
/docs/sponsor/zhifubao.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/sponsor/zhifubao.JPG
--------------------------------------------------------------------------------
/docs/images/Client_Server.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/Client_Server.png
--------------------------------------------------------------------------------
/docs/images/cases/simple1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/cases/simple1.jpg
--------------------------------------------------------------------------------
/docs/images/cases/stream.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/cases/stream.jpg
--------------------------------------------------------------------------------
/docs/images/dots_release.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/dots_release.png
--------------------------------------------------------------------------------
/docs/images/panda-waving.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/panda-waving.png
--------------------------------------------------------------------------------
/src/.dockerignore:
--------------------------------------------------------------------------------
1 | **/bin/
2 | **/obj/
3 | /lubanAssistant/
4 | /packages/
5 | /TestResults/
6 | LubanTools.sln
7 |
--------------------------------------------------------------------------------
/docs/images/cases/collection.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/cases/collection.jpg
--------------------------------------------------------------------------------
/docs/images/cases/l10n_text.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/cases/l10n_text.jpg
--------------------------------------------------------------------------------
/docs/images/cases/multiline.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/cases/multiline.jpg
--------------------------------------------------------------------------------
/docs/images/cases/nullable.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/cases/nullable.jpg
--------------------------------------------------------------------------------
/docs/images/cases/sep_bean.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/cases/sep_bean.jpg
--------------------------------------------------------------------------------
/docs/images/cases/singleton.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/cases/singleton.jpg
--------------------------------------------------------------------------------
/docs/images/cases/singleton2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/cases/singleton2.jpg
--------------------------------------------------------------------------------
/docs/images/cases/title_enum.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/cases/title_enum.jpg
--------------------------------------------------------------------------------
/docs/images/cases/title_map.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/cases/title_map.jpg
--------------------------------------------------------------------------------
/docs/images/cases/titlelimit.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/cases/titlelimit.jpg
--------------------------------------------------------------------------------
/docs/images/flying-seagull.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/flying-seagull.jpg
--------------------------------------------------------------------------------
/docs/images/luban_edit_tool.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/luban_edit_tool.png
--------------------------------------------------------------------------------
/docs/images/cases/ignorefield.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/cases/ignorefield.jpg
--------------------------------------------------------------------------------
/docs/images/install/install_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/install/install_01.png
--------------------------------------------------------------------------------
/docs/images/install/install_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/install/install_02.png
--------------------------------------------------------------------------------
/docs/images/install/install_03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/install/install_03.png
--------------------------------------------------------------------------------
/docs/images/install/install_04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/install/install_04.png
--------------------------------------------------------------------------------
/docs/images/install/install_05.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/install/install_05.png
--------------------------------------------------------------------------------
/docs/images/install/install_06.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/install/install_06.png
--------------------------------------------------------------------------------
/docs/images/install/install_07.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/install/install_07.png
--------------------------------------------------------------------------------
/docs/images/install/install_08.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/install/install_08.png
--------------------------------------------------------------------------------
/docs/images/install/install_09.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/install/install_09.png
--------------------------------------------------------------------------------
/docs/images/install/install_10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/install/install_10.png
--------------------------------------------------------------------------------
/docs/images/cases/multileveltitle.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/cases/multileveltitle.jpg
--------------------------------------------------------------------------------
/docs/images/cases/primitive_type.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/cases/primitive_type.jpg
--------------------------------------------------------------------------------
/docs/images/cases/sep_container1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/cases/sep_container1.jpg
--------------------------------------------------------------------------------
/docs/images/cases/sep_container2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/cases/sep_container2.jpg
--------------------------------------------------------------------------------
/docs/images/cases/quickstart_reward.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/cases/quickstart_reward.jpg
--------------------------------------------------------------------------------
/docs/images/cases/quickstart_table.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/cases/quickstart_table.jpg
--------------------------------------------------------------------------------
/docs/images/docusaurus-social-card.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/docusaurus-social-card.jpg
--------------------------------------------------------------------------------
/docs/images/cases/table_list_indep_key.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/cases/table_list_indep_key.jpg
--------------------------------------------------------------------------------
/docs/images/cases/table_list_not_key.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/cases/table_list_not_key.jpg
--------------------------------------------------------------------------------
/docs/images/cases/table_list_union_key.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/cases/table_list_union_key.jpg
--------------------------------------------------------------------------------
/docs/images/cases/title_dynamic_bean.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/XuToWei/Luban-Extension/HEAD/docs/images/cases/title_dynamic_bean.jpg
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: csharp
2 | solution: src/Luban.sln
3 |
4 | mono: none
5 | dotnet: 6.0
6 | script:
7 | - cd src
8 | - dotnet restore Luban.sln
9 | - dotnet build Luban.sln
--------------------------------------------------------------------------------
/src/Luban.Rust/Templates/common/rs/macros/Cargo.toml.sbn:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "macros"
3 | version = "0.1.0"
4 | edition = "2021"
5 |
6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7 |
8 | [dependencies]
9 | quote = "1.0.36"
10 | syn = "2.0.60"
11 | proc-macro2 = "1.0.82"
12 |
13 | [lib]
14 | proc-macro = true
--------------------------------------------------------------------------------
/src/Luban.Rust/Templates/rust-bin/toml.sbn:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "{{__name}}"
3 | version = "0.1.0"
4 | edition = "2021"
5 |
6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7 |
8 | [dependencies]
9 | bitflags = { version = "2.5.x" , features = ["serde"] }
10 | macros = { path = "../macros" }
11 | luban_lib = { path = "../../luban_lib" }
--------------------------------------------------------------------------------
/src/Luban.Rust/Templates/rust-json/toml.sbn:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "{{__name}}"
3 | version = "0.1.0"
4 | edition = "2021"
5 |
6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7 |
8 | [dependencies]
9 | serde = { version = "1.0.x", features = ["derive"] }
10 | serde_json = "1.0.x"
11 | bitflags = { version = "2.5.x" , features = ["serde"]}
12 | macros = {path = "../macros"}
--------------------------------------------------------------------------------
/src/Luban.sln.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | False
--------------------------------------------------------------------------------
/src/Luban.DataValidator.Builtin/Luban.DataValidator.Builtin.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | enable
6 | disable
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/Luban.CSharp/CodeTarget/CsharpCodeCodeTarget.cs:
--------------------------------------------------------------------------------
1 | using Luban.CodeTarget;
2 | using Luban.CSharp.TemplateExtensions;
3 | using Scriban;
4 |
5 | namespace Luban.CSharp.CodeTarget;
6 |
7 | [CodeTarget("cs-code")]
8 | public class CsharpCodeCodeTarget : CsharpCodeTargetBase
9 | {
10 | protected override void OnCreateTemplateContext(TemplateContext ctx)
11 | {
12 | base.OnCreateTemplateContext(ctx);
13 | ctx.PushGlobal(new CsharpCodeTemplateExtension());
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Luban.Golang/Templates/common/go/enum.sbn:
--------------------------------------------------------------------------------
1 | {{~if ___top_module != ''~}}
2 | package {{__top_module}};
3 | {{~end~}}
4 |
5 | {{~if __this.comment != '' ~}}
6 | /**
7 | * {{escape_comment __this.comment}}
8 | */
9 | {{~end~}}
10 | const (
11 | {{~ for item in __this.items ~}}
12 | {{~if item.comment_or_alias != '' ~}}
13 | /**
14 | * {{escape_comment item.comment_or_alias}}
15 | */
16 | {{~end~}}
17 | {{full_name __this}}_{{item.name}} = {{item.int_value}};
18 | {{~end~}}
19 | )
20 |
--------------------------------------------------------------------------------
/src/Luban.L10N/Luban.L10N.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | enable
6 | disable
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/src/Luban.Cpp/Templates/cpp-rawptr-bin/schema_h.sbn:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 |
5 | #include "CfgBean.h"
6 |
7 | {{namespace_with_grace_begin __top_module}}
8 |
9 | {{__enum_codes~}}
10 |
11 | {{~for b in __beans~}}
12 | {{namespace_with_grace_begin b.namespace}} struct {{b.name}}; {{namespace_with_grace_end b.namespace}}
13 | {{~end~}}
14 |
15 | {{~__bean_codes~}}
16 |
17 | {{~__table_codes~}}
18 |
19 | {{__tables_code}}
20 |
21 | {{namespace_with_grace_end __top_module}}
22 |
--------------------------------------------------------------------------------
/src/Luban.Cpp/Templates/cpp-sharedptr-bin/schema_h.sbn:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 |
5 | #include "CfgBean.h"
6 |
7 | {{namespace_with_grace_begin __top_module}}
8 |
9 | {{__enum_codes~}}
10 |
11 | {{~for b in __beans~}}
12 | {{namespace_with_grace_begin b.namespace}} struct {{b.name}}; {{namespace_with_grace_end b.namespace}}
13 | {{~end~}}
14 |
15 | {{~__bean_codes~}}
16 |
17 | {{~__table_codes~}}
18 |
19 | {{__tables_code}}
20 |
21 | {{namespace_with_grace_end __top_module}}
22 |
--------------------------------------------------------------------------------
/src/Luban.Bson/Luban.Bson.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | enable
6 | disable
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/Luban.MsgPack/Luban.MsgPack.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | enable
6 | disable
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/Luban.Java/Templates/common/java/enum.sbn:
--------------------------------------------------------------------------------
1 | {{~if __namespace_with_top_module != ''~}}
2 | package {{__namespace_with_top_module}};
3 | {{~end~}}
4 |
5 | {{~if __this.comment != '' ~}}
6 | /**
7 | * {{escape_comment __this.comment}}
8 | */
9 | {{~end~}}
10 | public final class {{__name}} {
11 | {{~ for item in __this.items ~}}
12 | {{~if item.comment_or_alias != '' ~}}
13 | /**
14 | * {{escape_comment item.comment_or_alias}}
15 | */
16 | {{~end~}}
17 | public static final int {{item.name}} = {{item.int_value}};
18 | {{~end~}}
19 | }
20 |
--------------------------------------------------------------------------------
/src/nuget.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/Luban.CSharp/TemplateExtensions/CsharpCodeTemplateExtension.cs:
--------------------------------------------------------------------------------
1 | using Luban.CSharp.DataVisitors;
2 | using Luban.Defs;
3 |
4 | namespace Luban.CSharp.TemplateExtensions;
5 |
6 | public class CsharpCodeTemplateExtension : CsharpTemplateExtension
7 | {
8 | public static string ApplyValue(Record record)
9 | {
10 | return record.Data.Apply(ToCsharpCodeLiteralVisitor.Ins);
11 | }
12 |
13 | public static string ApplyKey(DefTable table, Record record)
14 | {
15 | return record.Data.GetField(table.IndexField.Name).Apply(ToCsharpCodeLiteralVisitor.Ins);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Luban.Cpp/Templates/common/cpp/enum.sbn:
--------------------------------------------------------------------------------
1 | {{~
2 | comment = __enum.comment
3 | items = __enum.items
4 | ~}}
5 | {{namespace_with_grace_begin __namespace}}
6 | {{~if comment != '' ~}}
7 | ///
8 | /// {{escape_comment comment}}
9 | ///
10 | {{~end~}}
11 | enum class {{__name}}
12 | {
13 | {{~ for item in items ~}}
14 | {{~if item.comment != '' ~}}
15 | ///
16 | /// {{escape_comment item.comment_or_alias}}
17 | ///
18 | {{~end~}}
19 | {{format_enum_item_name __code_style item.name}} = {{item.value}},
20 | {{~end~}}
21 | };
22 |
23 | {{namespace_with_grace_end __namespace}}
24 |
--------------------------------------------------------------------------------
/src/Luban.Cpp/Templates/cpp-rawptr-bin/tables.sbn:
--------------------------------------------------------------------------------
1 | class {{__name}}
2 | {
3 | public:
4 | {{~for table in __tables ~}}
5 | {{~if table.comment != '' ~}}
6 | /**
7 | * {{escape_comment table.comment}}
8 | */
9 | {{~end~}}
10 | {{make_cpp_name table.full_name}} {{table.name}};
11 | {{~end~}}
12 |
13 | bool load(::luban::Loader<::luban::ByteBuf> loader)
14 | {
15 | ::luban::ByteBuf buf;
16 | {{~for table in __tables~}}
17 | buf.clear();
18 | if (!loader(buf, "{{table.output_data_file}}")) return false;
19 | if (!{{table.name}}.load(buf)) return false;
20 | {{~end~}}
21 | return true;
22 | }
23 | };
24 |
--------------------------------------------------------------------------------
/src/Luban.Cpp/Templates/cpp-sharedptr-bin/tables.sbn:
--------------------------------------------------------------------------------
1 | class {{__name}}
2 | {
3 | public:
4 | {{~for table in __tables ~}}
5 | {{~if table.comment != '' ~}}
6 | /**
7 | * {{escape_comment table.comment}}
8 | */
9 | {{~end~}}
10 | {{make_cpp_name table.full_name}} {{table.name}};
11 | {{~end~}}
12 |
13 | bool load(::luban::Loader<::luban::ByteBuf> loader)
14 | {
15 | ::luban::ByteBuf buf;
16 | {{~for table in __tables~}}
17 | buf.clear();
18 | if (!loader(buf, "{{table.output_data_file}}")) return false;
19 | if (!{{table.name}}.load(buf)) return false;
20 | {{~end~}}
21 | return true;
22 | }
23 | };
24 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: # [pirunxi]
4 | patreon: # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: walon
10 | issuehunt: # Replace with a single IssueHunt username
11 | otechie: # Replace with a single Otechie username
12 | custom: ['https://raw.githubusercontent.com/focus-creative-games/luban/main/docs/sponsor/weixin.JPG','https://raw.githubusercontent.com/focus-creative-games/luban/main/docs/sponsor/zhifubao.JPG']
13 |
--------------------------------------------------------------------------------
/src/Luban.CSharp/Templates/common/cs/enum.sbn:
--------------------------------------------------------------------------------
1 | {{~
2 | comment = __enum.comment
3 | items = __enum.items
4 | ~}}
5 |
6 |
7 | {{namespace_with_grace_begin __namespace_with_top_module}}
8 | {{~if comment != '' ~}}
9 | ///
10 | /// {{escape_comment comment}}
11 | ///
12 | {{~end~}}
13 | {{~if __enum.is_flags~}}
14 | [System.Flags]
15 | {{~end~}}
16 | public enum {{__name}}
17 | {
18 | {{~ for item in items ~}}
19 | {{~if item.comment != '' ~}}
20 | ///
21 | /// {{escape_comment item.comment_or_alias}}
22 | ///
23 | {{~end~}}
24 | {{format_enum_item_name __code_style item.name}} = {{item.value}},
25 | {{~end~}}
26 | }
27 |
28 | {{namespace_with_grace_end __namespace_with_top_module}}
29 |
--------------------------------------------------------------------------------
/src/Luban.Golang/Templates/go-json/tables.sbn:
--------------------------------------------------------------------------------
1 | {{~if __namespace != ''~}}
2 | package {{__namespace}};
3 | {{~end~}}
4 |
5 | type JsonLoader func(string) ([]map[string]interface{}, error)
6 |
7 | type {{__name}} struct {
8 | {{~for table in __tables ~}}
9 | {{table.name}} *{{full_name table}}
10 | {{~end~}}
11 | }
12 |
13 | func NewTables(loader JsonLoader) (*{{__name}}, error) {
14 | var err error
15 | var buf []map[string]interface{}
16 |
17 | tables := &{{__name}}{}
18 | {{~for table in __tables ~}}
19 | if buf, err = loader("{{table.output_data_file}}") ; err != nil {
20 | return nil, err
21 | }
22 | if tables.{{table.name}}, err = New{{full_name table}}(buf) ; err != nil {
23 | return nil, err
24 | }
25 | {{~end~}}
26 | return tables, nil
27 | }
28 |
29 |
--------------------------------------------------------------------------------
/src/Luban.Gdscript/Luban.Gdscript.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | enable
6 | enable
7 |
8 |
9 |
10 |
11 | Always
12 |
13 |
14 | Always
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/Luban.Dart/Templates/common/dart/enum.sbn:
--------------------------------------------------------------------------------
1 | {{~if __this.comment != '' ~}}
2 | //{{escape_comment __this.comment}}
3 | {{~end~}}
4 | enum {{__name}}
5 | {
6 | {{~if !has_enum_item __this~}}
7 | empty_placeholder(0);
8 | {{~else~}}
9 | {{~if !__this.has_zero_value_item ~}}
10 | None(0),
11 | {{~end~}}
12 | {{~end~}}
13 |
14 |
15 | {{~ for item in __this.items ~}}
16 | {{~if item.comment_or_alias != '' ~}}
17 | //{{escape_comment item.comment_or_alias}}
18 | {{~end~}}
19 | {{item.name}}({{item.int_value}}) {{is_last_enum_item __this item.int_value ? ';' : ','}}
20 |
21 | {{~end~}}
22 | final int value;
23 |
24 | const {{__name}}(this.value);
25 |
26 | static {{__name}} fromValue(int value)
27 | {
28 | return {{__name}}.values.firstWhere((element) => element.value == value, orElse: () => fromValue(0));
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/Luban.Golang/Templates/go-bin/tables.sbn:
--------------------------------------------------------------------------------
1 | {{~if __namespace != ''~}}
2 | package {{__namespace}};
3 | {{~end~}}
4 |
5 | import (
6 | "{{__luban_module_name}}"
7 | "errors"
8 | )
9 |
10 | type ByteBufLoader func(string) (*luban.ByteBuf, error)
11 |
12 | type {{__name}} struct {
13 | {{~for table in __tables ~}}
14 | {{table.name}} *{{full_name table}}
15 | {{~end~}}
16 | }
17 |
18 | func NewTables(loader ByteBufLoader) (*{{__name}}, error) {
19 | var err error
20 | var buf *luban.ByteBuf
21 |
22 | tables := &{{__name}}{}
23 | {{~for table in __tables ~}}
24 | if buf, err = loader("{{table.output_data_file}}") ; err != nil {
25 | return nil, err
26 | }
27 | if tables.{{table.name}}, err = New{{full_name table}}(buf) ; err != nil {
28 | return nil, errors.Join(errors.New("failed to load {{table.name}}"), err)
29 | }
30 | {{~end~}}
31 | return tables, nil
32 | }
33 |
34 |
--------------------------------------------------------------------------------
/src/Luban.Lua/Luban.Lua.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | enable
6 | enable
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | Always
20 |
21 |
22 | Always
23 |
24 |
25 | Always
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/src/Luban.Protobuf/Luban.Protobuf.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | enable
6 | disable
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | Always
21 |
22 |
23 | Always
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/src/Luban.FlatBuffers/Luban.FlatBuffers.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | enable
6 | disable
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | Always
17 |
18 |
19 | PreserveNewest
20 |
21 |
22 | Always
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/src/Luban.CSharp/Templates/cs-bin/tables.sbn:
--------------------------------------------------------------------------------
1 | using Luban;
2 |
3 | {{namespace_with_grace_begin __namespace}}
4 | public partial class {{__name}}
5 | {
6 | {{~for table in __tables ~}}
7 | {{~if table.comment != '' ~}}
8 | ///
9 | /// {{escape_comment table.comment}}
10 | ///
11 | {{~end~}}
12 | public {{table.full_name}} {{format_property_name __code_style table.name}} {get; }
13 | {{~end~}}
14 |
15 | public {{__name}}(System.Func loader)
16 | {
17 | {{~for table in __tables ~}}
18 | {{format_property_name __code_style table.name}} = new {{table.full_name}}(loader("{{table.output_data_file}}"));
19 | {{~end~}}
20 | ResolveRef();
21 | }
22 |
23 | private void ResolveRef()
24 | {
25 | {{~for table in __tables ~}}
26 | {{format_property_name __code_style table.name}}.ResolveRef(this);
27 | {{~end~}}
28 | }
29 | }
30 |
31 | {{namespace_with_grace_end __namespace}}
--------------------------------------------------------------------------------
/src/Luban.CSharp/Templates/cs-code/tables.sbn:
--------------------------------------------------------------------------------
1 | using Luban;
2 |
3 | {{namespace_with_grace_begin __namespace}}
4 | public partial class {{__name}}
5 | {
6 | {{~for table in __tables ~}}
7 | {{~if table.comment != '' ~}}
8 | ///
9 | /// {{escape_comment table.comment}}
10 | ///
11 | {{~end~}}
12 | public {{table.full_name}} {{format_property_name __code_style table.name}} { private set; get; }
13 | {{~end~}}
14 |
15 | public {{__name}}()
16 | {
17 | {{~for table in __tables ~}}
18 | {{format_property_name __code_style table.name}} = new {{table.full_name}}();
19 | {{~end~}}
20 |
21 | PostInit();
22 | ResolveRef();
23 | }
24 |
25 | private void ResolveRef()
26 | {
27 | {{~for table in __tables ~}}
28 | {{format_property_name __code_style table.name}}.ResolveRef(this);
29 | {{~end~}}
30 | }
31 |
32 | partial void PostInit();
33 | }
34 | {{namespace_with_grace_end __namespace}}
--------------------------------------------------------------------------------
/src/Luban.CSharp/Templates/cs-simple-json/tables.sbn:
--------------------------------------------------------------------------------
1 | using Luban;
2 | using SimpleJSON;
3 |
4 | {{namespace_with_grace_begin __namespace}}
5 | public partial class {{__name}}
6 | {
7 | {{~for table in __tables ~}}
8 | {{~if table.comment != '' ~}}
9 | ///
10 | /// {{escape_comment table.comment}}
11 | ///
12 | {{~end~}}
13 | public {{table.full_name}} {{format_property_name __code_style table.name}} {get; }
14 | {{~end~}}
15 |
16 | public {{__name}}(System.Func loader)
17 | {
18 | {{~for table in __tables ~}}
19 | {{format_property_name __code_style table.name}} = new {{table.full_name}}(loader("{{table.output_data_file}}"));
20 | {{~end~}}
21 | ResolveRef();
22 | }
23 |
24 | private void ResolveRef()
25 | {
26 | {{~for table in __tables ~}}
27 | {{format_property_name __code_style table.name}}.ResolveRef(this);
28 | {{~end~}}
29 | }
30 | }
31 |
32 | {{namespace_with_grace_end __namespace}}
--------------------------------------------------------------------------------
/src/Luban.Cpp/Templates/cpp-rawptr-bin/bean.sbn:
--------------------------------------------------------------------------------
1 | {{namespace_with_grace_begin __namespace}}
2 |
3 | {{~if __this.comment != '' ~}}
4 | /**
5 | * {{escape_comment __this.comment}}
6 | */
7 | {{~end~}}
8 | struct {{__name}} : public{{if __parent_def_type}} {{make_cpp_name __parent_def_type.full_name}} {{else}} luban::CfgBean {{end}}
9 | {
10 | static bool deserialize{{__name}}(::luban::ByteBuf& _buf, {{__name}}*& _out);
11 |
12 | virtual ~{{__name}}() {}
13 |
14 | bool deserialize(::luban::ByteBuf& _buf);
15 |
16 | {{~ for field in __export_fields ~}}
17 | {{~if field.comment != '' ~}}
18 | /**
19 | * {{escape_comment field.comment}}
20 | */
21 | {{~end~}}
22 | {{declaring_type_name field.ctype}} {{format_field_name __code_style field.name}};
23 | {{~end~}}
24 |
25 | {{~if !__this.is_abstract_type~}}
26 | static constexpr int __ID__ = {{__this.id}};
27 |
28 | int getTypeId() const override { return __ID__; }
29 | {{~end~}}
30 | };
31 |
32 | {{namespace_with_grace_end __namespace}}
33 |
--------------------------------------------------------------------------------
/src/Luban.Typescript/Templates/typescript-protobuf/schema.sbn:
--------------------------------------------------------------------------------
1 | import pb from 'pb';
2 |
3 | type BufLoader = (file: string) => Uint8Array;
4 |
5 | export class {{__name}} {
6 | {{~ for table in __tables ~}}
7 | private _{{table.name}}: pb.cfg.{{table.name}}
8 | {{~if table.comment != '' ~}}
9 | /**
10 | * {{escape_comment table.comment}}
11 | */
12 | {{~end~}}
13 | get {{table.name}}(): pb.cfg.{{table.name}} { return this._{{table.name}};}
14 | {{~end~}}
15 |
16 | static getTableNames(): string[] {
17 | let names: string[] = [];
18 | {{~for table in __tables ~}}
19 | names.push('{{table.output_data_file}}');
20 | {{~end~}}
21 | return names;
22 | }
23 |
24 | constructor(loader: BufLoader) {
25 | let buffer: Uint8Array;
26 | {{~for table in __tables ~}}
27 | buffer = loader('{{table.output_data_file}}');
28 | this._{{table.name}} = pb.cfg.{{table.name}}.decode(buffer, buffer.length);
29 | {{~end~}}
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Luban.CSharp/Templates/cs-dotnet-json/tables.sbn:
--------------------------------------------------------------------------------
1 | using Luban;
2 | using System.Text.Json;
3 |
4 | {{namespace_with_grace_begin __namespace}}
5 | public partial class {{__name}}
6 | {
7 | {{~for table in __tables ~}}
8 | {{~if table.comment != '' ~}}
9 | ///
10 | /// {{escape_comment table.comment}}
11 | ///
12 | {{~end~}}
13 | public {{table.full_name}} {{format_property_name __code_style table.name}} {get; }
14 | {{~end~}}
15 |
16 | public {{__name}}(System.Func loader)
17 | {
18 | {{~for table in __tables ~}}
19 | {{format_property_name __code_style table.name}} = new {{table.full_name}}(loader("{{table.output_data_file}}"));
20 | {{~end~}}
21 | ResolveRef();
22 | }
23 |
24 | private void ResolveRef()
25 | {
26 | {{~for table in __tables ~}}
27 | {{format_property_name __code_style table.name}}.ResolveRef(this);
28 | {{~end~}}
29 | }
30 | }
31 |
32 | {{namespace_with_grace_end __namespace}}
--------------------------------------------------------------------------------
/src/Luban.CSharp/Templates/cs-newtonsoft-json/tables.sbn:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json.Linq;
2 |
3 | {{namespace_with_grace_begin __namespace}}
4 | public partial class {{__name}}
5 | {
6 | {{~for table in __tables ~}}
7 | {{~if table.comment != '' ~}}
8 | ///
9 | /// {{escape_comment table.comment}}
10 | ///
11 | {{~end~}}
12 | public {{table.full_name}} {{format_property_name __code_style table.name}} {get; }
13 | {{~end~}}
14 |
15 |
16 | public {{__name}}(System.Func loader)
17 | {
18 | {{~for table in __tables ~}}
19 | {{format_property_name __code_style table.name}} = new {{table.full_name}}(loader("{{table.output_data_file}}"));
20 | {{~end~}}
21 | ResolveRef();
22 | }
23 |
24 | private void ResolveRef()
25 | {
26 | {{~for table in __tables ~}}
27 | {{format_property_name __code_style table.name}}.ResolveRef(this);
28 | {{~end~}}
29 | }
30 | }
31 |
32 | {{namespace_with_grace_end __namespace}}
33 |
--------------------------------------------------------------------------------
/src/Luban.Cpp/Templates/cpp-sharedptr-bin/bean.sbn:
--------------------------------------------------------------------------------
1 | {{namespace_with_grace_begin __namespace}}
2 |
3 | {{~if __this.comment != '' ~}}
4 | /**
5 | * {{escape_comment __this.comment}}
6 | */
7 | {{~end~}}
8 | struct {{__name}} : public{{if __parent_def_type}} {{make_cpp_name __parent_def_type.full_name}} {{else}} luban::CfgBean {{end}}
9 | {
10 | static bool deserialize{{__name}}(::luban::ByteBuf& _buf, ::luban::SharedPtr<{{__name}}>& _out);
11 |
12 | virtual ~{{__name}}() {}
13 |
14 | bool deserialize(::luban::ByteBuf& _buf);
15 |
16 | {{~ for field in __export_fields ~}}
17 | {{~if field.comment != '' ~}}
18 | /**
19 | * {{escape_comment field.comment}}
20 | */
21 | {{~end~}}
22 | {{declaring_type_name field.ctype}} {{format_field_name __code_style field.name}};
23 | {{~end~}}
24 |
25 | {{~if !__this.is_abstract_type~}}
26 | static constexpr int __ID__ = {{__this.id}};
27 |
28 | int getTypeId() const override { return __ID__; }
29 | {{~end~}}
30 | };
31 |
32 | {{namespace_with_grace_end __namespace}}
--------------------------------------------------------------------------------
/src/Luban.Dart/Luban.Dart.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | enable
6 | disable
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | Always
20 |
21 |
22 | Always
23 |
24 |
25 | Always
26 |
27 |
28 | Always
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/src/Luban.Python/Luban.Python.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | enable
6 | disable
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | PreserveNewest
21 |
22 |
23 | Always
24 |
25 |
26 | Always
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 Code Philosophy Technology Ltd.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/src/Luban.Java/Templates/java-bin/tables.sbn:
--------------------------------------------------------------------------------
1 | {{~if __namespace != ''~}}
2 | package {{__namespace}};
3 | {{~end~}}
4 |
5 | import luban.*;
6 | {{~
7 | func get_table_inner_name
8 | ret '_' + ($0 | string.downcase)
9 | end
10 | ~}}
11 |
12 | public final class {{__name}}
13 | {
14 | public static interface IByteBufLoader {
15 | ByteBuf load(String file) throws java.io.IOException;
16 | }
17 |
18 | {{~for table in __tables
19 | inner_name = get_table_inner_name table.name
20 | ~}}
21 | {{~if table.comment != '' ~}}
22 | /**
23 | * {{escape_comment table.comment}}
24 | */
25 | {{~end~}}
26 | private final {{table.full_name_with_top_module}} {{inner_name}};
27 | public {{table.full_name_with_top_module}} get{{table.name}}() { return {{inner_name}}; }
28 | {{~end~}}
29 |
30 | public {{__name}}(IByteBufLoader loader) throws java.io.IOException {
31 | {{~for table in __tables
32 | inner_name = get_table_inner_name table.name
33 | ~}}
34 | {{inner_name}} = new {{table.full_name_with_top_module}}(loader.load("{{table.output_data_file}}"));
35 | {{~end~}}
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/Luban.Protobuf/Templates/pb/schema.sbn:
--------------------------------------------------------------------------------
1 | syntax = "{{__syntax}}";
2 |
3 | package {{__namespace}};
4 |
5 | {{~for enum in __enums
6 | typeName = full_name enum
7 | ~}}
8 | enum {{typeName}} {
9 | {{~if !enum.has_zero_value_item ~}}
10 | {{typeName}}_EMPTY_PLACEHOLDER = 0;
11 | {{~end~}}
12 | {{~for item in enum.items ~}}
13 | {{typeName}}_{{item.name}} = {{item.int_value}};
14 | {{~end~}}
15 | }
16 | {{~end~}}
17 |
18 | {{~for bean in __beans
19 | typeName = full_name bean
20 | ~}}
21 | message {{typeName}} {
22 | {{~if bean.is_abstract_type ~}}
23 | oneof value {
24 | {{~for c in bean.hierarchy_not_abstract_children~}}
25 | {{full_name c}} {{c.name}} = {{c.auto_id}};
26 | {{~end~}}
27 | }
28 | {{~else~}}
29 | {{~for f in bean.hierarchy_export_fields ~}}
30 | {{pre_decorator f.ctype}} {{declaring_type_name f.ctype}} {{f.name}} = {{f.auto_id}} {{suffix_options f.ctype}};
31 | {{~end~}}
32 | {{~end~}}
33 | }
34 | {{~end~}}
35 |
36 | {{~for table in __tables~}}
37 | message {{full_name table}} {
38 | repeated {{declaring_type_name table.value_ttype}} data_list = 1 [packed = false];
39 | }
40 | {{~end~}}
41 |
42 |
--------------------------------------------------------------------------------
/src/Luban.Protobuf/Templates/cs_pb/tables.sbn:
--------------------------------------------------------------------------------
1 | using Google.Protobuf;
2 | using Google.Protobuf.Collections;
3 | using System.Reflection;
4 |
5 | {{namespace_with_grace_begin __namespace}}
6 | public partial class {{__name}}
7 | {
8 | {{~for table in __tables ~}}
9 | {{~if table.comment != '' ~}}
10 | ///
11 | /// {{escape_comment table.comment}}
12 | ///
13 | {{~end~}}
14 | public {{proto_full_name table.full_name}} {{format_property_name __code_style table.name}} { get; }
15 |
16 | {{~end~}}
17 |
18 | public {{__name}}(System.Func loader)
19 | {
20 | {{~for table in __tables ~}}
21 | {{format_property_name __code_style table.name}} = {{proto_full_name table.full_name}}.Parser.ParseFrom(loader("{{table.output_data_file}}"));
22 | {{~end~}}
23 | }
24 | public {{__name}}(System.Func loader)
25 | {
26 | {{~for table in __tables ~}}
27 | {{format_property_name __code_style table.name}} = {{proto_full_name table.full_name}}.Parser.ParseJson(loader("{{table.output_data_file}}"));
28 | {{~end~}}
29 | }
30 | }
31 |
32 | {{namespace_with_grace_end __namespace}}
33 |
--------------------------------------------------------------------------------
/src/Luban.Java/Templates/java-json/tables.sbn:
--------------------------------------------------------------------------------
1 | {{~if __namespace != ''~}}
2 | package {{__namespace}};
3 | {{~end~}}
4 |
5 | import luban.*;
6 | import com.google.gson.JsonElement;
7 | {{~
8 | func get_table_inner_name
9 | ret '_' + ($0 | string.downcase)
10 | end
11 | ~}}
12 |
13 | public final class {{__name}}
14 | {
15 |
16 | public interface IJsonLoader {
17 | JsonElement load(String file) throws java.io.IOException;
18 | }
19 |
20 | {{~for table in __tables
21 | inner_name = get_table_inner_name table.name
22 | ~}}
23 | {{~if table.comment != '' ~}}
24 | /**
25 | * {{escape_comment table.comment}}
26 | */
27 | {{~end~}}
28 | private final {{table.full_name_with_top_module}} {{inner_name}};
29 | public {{table.full_name_with_top_module}} get{{table.name}}() { return {{inner_name}}; }
30 | {{~end~}}
31 |
32 | public {{__name}}(IJsonLoader loader) throws java.io.IOException {
33 | {{~for table in __tables
34 | inner_name = get_table_inner_name table.name
35 | ~}}
36 | {{inner_name}} = new {{table.full_name_with_top_module}}(loader.load("{{table.output_data_file}}"));
37 | {{~end~}}
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/Luban/nlog.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
13 |
14 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/src/Luban.Bson/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 |
22 |
23 | using Luban;
24 |
25 | [assembly: RegisterBehaviour]
26 |
--------------------------------------------------------------------------------
/src/Luban.Core/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 |
22 |
23 | using Luban;
24 |
25 | [assembly: RegisterBehaviour]
26 |
--------------------------------------------------------------------------------
/src/Luban.Cpp/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 |
22 |
23 | using Luban;
24 |
25 | [assembly: RegisterBehaviour]
26 |
--------------------------------------------------------------------------------
/src/Luban.Dart/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 |
22 |
23 | using Luban;
24 |
25 | [assembly: RegisterBehaviour]
26 |
--------------------------------------------------------------------------------
/src/Luban.Java/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 |
22 |
23 | using Luban;
24 |
25 | [assembly: RegisterBehaviour]
26 |
--------------------------------------------------------------------------------
/src/Luban.L10N/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 |
22 |
23 | using Luban;
24 |
25 | [assembly: RegisterBehaviour]
26 |
--------------------------------------------------------------------------------
/src/Luban.Lua/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 |
22 |
23 | using Luban;
24 |
25 | [assembly: RegisterBehaviour]
26 |
--------------------------------------------------------------------------------
/src/Luban.PHP/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 |
22 |
23 | using Luban;
24 |
25 | [assembly: RegisterBehaviour]
26 |
--------------------------------------------------------------------------------
/src/Luban.Rust/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 |
22 |
23 | using Luban;
24 |
25 | [assembly: RegisterBehaviour]
26 |
--------------------------------------------------------------------------------
/src/Luban.CSharp/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 |
22 |
23 | using Luban;
24 |
25 | [assembly: RegisterBehaviour]
26 |
--------------------------------------------------------------------------------
/src/Luban.Gdscript/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 |
22 |
23 | using Luban;
24 |
25 | [assembly: RegisterBehaviour]
26 |
--------------------------------------------------------------------------------
/src/Luban.Golang/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 |
22 |
23 | using Luban;
24 |
25 | [assembly: RegisterBehaviour]
26 |
--------------------------------------------------------------------------------
/src/Luban.Javascript/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 |
22 |
23 | using Luban;
24 |
25 | [assembly: RegisterBehaviour]
26 |
--------------------------------------------------------------------------------
/src/Luban.MsgPack/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 |
22 |
23 | using Luban;
24 |
25 | [assembly: RegisterBehaviour]
26 |
--------------------------------------------------------------------------------
/src/Luban.Protobuf/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 |
22 |
23 | using Luban;
24 |
25 | [assembly: RegisterBehaviour]
26 |
--------------------------------------------------------------------------------
/src/Luban.Python/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 |
22 |
23 | using Luban;
24 |
25 | [assembly: RegisterBehaviour]
26 |
--------------------------------------------------------------------------------
/src/Luban.Typescript/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 |
22 |
23 | using Luban;
24 |
25 | [assembly: RegisterBehaviour]
26 |
--------------------------------------------------------------------------------
/src/Luban.FlatBuffers/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 |
22 |
23 | using Luban;
24 |
25 | [assembly: RegisterBehaviour]
26 |
--------------------------------------------------------------------------------
/src/Luban.Schema.Builtin/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 |
22 |
23 | using Luban;
24 |
25 | [assembly: RegisterBehaviour]
26 |
--------------------------------------------------------------------------------
/src/Luban.DataLoader.Builtin/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 |
22 |
23 | using Luban;
24 |
25 | [assembly: RegisterBehaviour]
26 |
--------------------------------------------------------------------------------
/src/Luban.DataTarget.Builtin/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 |
22 |
23 | using Luban;
24 |
25 | [assembly: RegisterBehaviour]
26 |
--------------------------------------------------------------------------------
/.github/workflows/sync_gitee.yml:
--------------------------------------------------------------------------------
1 | # This is a basic workflow to help you get started with Actions
2 |
3 | name: sync-gitee-mirror
4 |
5 | # Controls when the workflow will run
6 | on:
7 | # Triggers the workflow on push or pull request events but only for the main branch
8 | push:
9 | branches: [ main ]
10 |
11 | # Allows you to run this workflow manually from the Actions tab
12 | workflow_dispatch:
13 |
14 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel
15 | jobs:
16 | # This workflow contains a single job called "build"
17 | sync:
18 | # The type of runner that the job will run on
19 | runs-on: ubuntu-latest
20 |
21 | # Steps represent a sequence of tasks that will be executed as part of the job
22 | steps:
23 | - uses: actions/checkout@v2
24 | with:
25 | fetch-depth: 0
26 | - name: sync-gitee-mirror
27 | uses: wangchucheng/git-repo-sync@v0.1.0
28 | with:
29 | # Target Repo URL
30 | target-url: https://gitee.com/focus-creative-games/luban.git
31 | # Target Repo Username
32 | target-username: ${{ secrets.GITEE_USERNAME }}
33 | # Target Token
34 | target-token: ${{ secrets.GITEE_PASSWORD }}
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/src/Luban.DataValidator.Builtin/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 |
22 |
23 | using Luban;
24 |
25 | [assembly: RegisterBehaviour]
26 |
--------------------------------------------------------------------------------
/src/Luban.Core/Defs/TableMode.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.Defs;
22 |
23 | public enum TableMode
24 | {
25 | ONE,
26 | MAP,
27 | LIST,
28 | }
29 |
--------------------------------------------------------------------------------
/src/Luban.Core/Serialization/ITypeId.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.Serialization;
22 |
23 | public interface ITypeId
24 | {
25 | int GetTypeId();
26 | }
27 |
--------------------------------------------------------------------------------
/src/Luban.Core/Validator/ValidatorType.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.Validator;
22 |
23 | public enum ValidatorType
24 | {
25 | Data,
26 | Table,
27 | }
28 |
--------------------------------------------------------------------------------
/src/Luban.Core/Schema/IConfigLoader.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.Schema;
22 |
23 | public interface IConfigLoader
24 | {
25 | LubanConfig Load(string fileName);
26 | }
27 |
--------------------------------------------------------------------------------
/src/Luban.Core/CustomBehaviour/IPriorityBehaviour.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.CustomBehaviour;
22 |
23 | public interface IPriorityBehaviour
24 | {
25 | int Priority { get; }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Luban.Core/CodeFormat/INamingConventionFormatter.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.CodeFormat;
22 |
23 | public interface INamingConventionFormatter
24 | {
25 | string FormatName(string name);
26 | }
27 |
--------------------------------------------------------------------------------
/src/Luban.Core/RegisterBehaviourAttribute.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban;
22 |
23 | [AttributeUsage(AttributeTargets.Assembly)]
24 | public class RegisterBehaviourAttribute : Attribute
25 | {
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/src/Luban.Core/RawDefs/RawGroup.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.RawDefs;
22 |
23 | public class RawGroup
24 | {
25 | public bool IsDefault { get; set; }
26 |
27 | public List Names { get; set; }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Luban.Core/Pipeline/IPipeline.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.Defs;
22 | using Luban.RawDefs;
23 |
24 | namespace Luban.Pipeline;
25 |
26 | public interface IPipeline
27 | {
28 | void Run(PipelineArguments args);
29 | }
30 |
--------------------------------------------------------------------------------
/src/Luban.Core/RawDefs/RawRefGroup.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.RawDefs;
22 |
23 | public class RawRefGroup
24 | {
25 | public string Name { get; set; }
26 |
27 | public List Refs { get; set; }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Luban.Core/Schema/SchemaFileInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.Schema;
22 |
23 | public class SchemaFileInfo
24 | {
25 | public string FileName { get; set; }
26 |
27 | public string Type { get; set; }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Luban.Core/CustomBehaviour/ICustomBehaviour.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.CustomBehaviour;
22 |
23 | public interface ICustomBehaviour
24 | {
25 | public string Name { get; }
26 |
27 | int Priority { get; }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Luban.Core/Serialization/EUnmarshalError.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.Serialization;
22 |
23 | public enum EDeserializeError
24 | {
25 | OK,
26 | NOT_ENOUGH,
27 | EXCEED_SIZE,
28 | // UNMARSHAL_ERR,
29 | }
30 |
--------------------------------------------------------------------------------
/src/Luban.Core/Validator/ITableValidator.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.Defs;
22 |
23 | namespace Luban.Validator;
24 |
25 | public interface ITableValidator
26 | {
27 | void Validate(DefTable table, List records);
28 | }
29 |
--------------------------------------------------------------------------------
/src/Luban.Core/CodeTarget/NameLocation.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.CodeTarget;
22 |
23 | public enum NameLocation
24 | {
25 | TableName,
26 | BeanName,
27 | EnumName,
28 | BeanFieldName,
29 | EnumItemName,
30 | }
31 |
--------------------------------------------------------------------------------
/src/Luban.Core/DataTarget/IDataExporter.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 |
22 | namespace Luban.DataTarget;
23 |
24 | public interface IDataExporter
25 | {
26 | void Handle(GenerationContext ctx, IDataTarget dataTarget, OutputFileManifest manifest);
27 | }
28 |
--------------------------------------------------------------------------------
/src/Luban.DataTarget.Builtin/Res/ResourceInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.DataExporter.Builtin.Res;
22 |
23 | public class ResourceInfo
24 | {
25 | public string Resource { get; set; }
26 |
27 | public string Tag { get; set; }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Luban.DataTarget.Builtin/DefaultDataExporter.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.DataTarget;
22 |
23 | namespace Luban.DataExporter.Builtin;
24 |
25 | [DataExporter("default")]
26 | public class DefaultDataExporter : DataExporterBase
27 | {
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/src/Luban.DataValidator.Builtin/Path/IPathPattern.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.DataValidator.Builtin.Path;
22 |
23 | interface IPathPattern
24 | {
25 | bool ExistPath(string rootDir, string subFile);
26 |
27 | bool EmptyAble { get; set; }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Luban.Core/Schema/ISchemaLoader.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.Schema;
22 |
23 | public interface ISchemaLoader
24 | {
25 | string Type { get; set; }
26 |
27 | ISchemaCollector Collector { get; set; }
28 |
29 | void Load(string fileName);
30 | }
31 |
--------------------------------------------------------------------------------
/src/Luban.DataLoader.Builtin/DataVisitors/UnityAssetDataCreator.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.DataLoader.Builtin.DataVisitors;
22 |
23 | class UnityAssetDataCreator : YamlDataCreator
24 | {
25 | public new static UnityAssetDataCreator Ins = new();
26 | }
27 |
--------------------------------------------------------------------------------
/src/Luban.Core/Schema/IBeanSchemaLoader.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.Defs;
22 | using Luban.RawDefs;
23 |
24 | namespace Luban.Schema;
25 |
26 | public interface IBeanSchemaLoader
27 | {
28 | RawBean Load(string fileName, string beanFullName, RawTable table);
29 | }
30 |
--------------------------------------------------------------------------------
/src/Luban.Lua/CodeTarget/LuaLuaCodeTarget.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.CodeTarget;
22 | using Luban.Defs;
23 | using Scriban;
24 |
25 | namespace Luban.Lua.CodeTarget;
26 |
27 | [CodeTarget("lua-lua")]
28 | public class LuaLuaCodeTarget : LuaCodeTargetBase
29 | {
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/src/Luban.Dart/Templates/dart-json/tables.sbn:
--------------------------------------------------------------------------------
1 | {{~
2 | func get_table_inner_name
3 | ret '_' + ($0 | string.downcase)
4 | end
5 | ~}}
6 | {{~for table in __tables ~}}
7 | {{declaring_import_table table '/gen/'}}
8 | {{~end~}}
9 | final class {{__name}}
10 | {
11 | final Future Function(String filePath) _asyncloadFunction;
12 | Tables(this._asyncloadFunction);
13 |
14 | {{~for table in __tables ~}}
15 | {{~if table.comment != '' ~}}
16 | //{{escape_comment table.comment}}
17 | {{~end~}}
18 | {{table.name}}? _{{format_property_name __code_style table.name}};
19 | {{~end~}}
20 |
21 | Future waitLoad() async {
22 | var results = await Future.wait([
23 | {{~for table in __tables ~}}
24 | _asyncloadFunction("{{table.output_data_file}}"),
25 | {{~end~}}
26 | ]);
27 | {{ idx=0 }}
28 | {{~for table in __tables ~}}
29 | _{{format_property_name __code_style table.name}} = {{table.name}}(results[{{idx}}]);{{idx=idx+1}}
30 | {{~end~}}
31 | resolveRef();
32 | }
33 | {{~for table in __tables ~}}
34 | {{table.name}}? get {{format_name_lower_camel table.name}} => _{{format_property_name __code_style table.name}};
35 | {{~end~}}
36 |
37 | void resolveRef(){
38 | {{~for table in __tables ~}}
39 | _{{format_property_name __code_style table.name}}?.resolveRef(this);
40 | {{~end~}}
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/Luban.Core/Serialization/ISerializable.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.Serialization;
22 |
23 | ///
24 | /// 非兼容binary序列化
25 | ///
26 | public interface ISerializable
27 | {
28 | void Serialize(ByteBuf os);
29 |
30 | void Deserialize(ByteBuf os);
31 | }
32 |
--------------------------------------------------------------------------------
/src/Luban.Python/CodeTarget/Python2JsonCodeTarget.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.CodeTarget;
22 | using Luban.Defs;
23 | using Scriban;
24 |
25 | namespace Luban.Python.CodeTarget;
26 |
27 | [CodeTarget("python-json")]
28 | public class Python2JsonCodeTarget : PythonCodeTargetBase
29 | {
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/src/Luban.Rust/Templates/rust-bin/lib.sbn:
--------------------------------------------------------------------------------
1 | pub mod prelude{
2 | pub use crate::*;
3 | {{~ for ns in __ns ~}}
4 | pub use {{ns}}::*;
5 | {{~end~}}
6 | }
7 | {{~ if __polymorphic_beans.count != 0 ~}}
8 |
9 | type AbstractBase = dyn std::any::Any + Sync + Send;
10 |
11 | pub trait GetBase<'a, T> {
12 | fn get_base(&'a self) -> Result;
13 | }
14 | {{~end~}}
15 |
16 | #[derive(Debug)]
17 | pub enum LubanError {
18 | Loader(String),
19 | Table(String),
20 | Bean(String),
21 | Polymorphic(String),
22 | Unknown(String),
23 | }
24 |
25 | impl std::fmt::Display for LubanError {
26 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
27 | f.write_str(match self {
28 | LubanError::Loader(msg) |
29 | LubanError::Table(msg) |
30 | LubanError::Bean(msg) |
31 | LubanError::Polymorphic(msg) |
32 | LubanError::Unknown(msg) => msg,
33 | })
34 | }
35 | }
36 |
37 | pub struct Tables{
38 | {{~ for table in __tables ~}}
39 | pub {{table.name}}: std::sync::Arc<{{full_name table}}>,
40 | {{~end~}}
41 | }
42 |
43 | impl Tables {
44 | pub fn new Result>(loader: T) -> Result {
45 | Ok(Tables {
46 | {{~ for table in __tables ~}}
47 | {{table.name}}: {{full_name table}}::new(loader("{{table.output_data_file}}")?)?,
48 | {{~end~}}
49 | })
50 | }
51 | }
--------------------------------------------------------------------------------
/src/Luban.DataLoader.Builtin/Excel/RawSheet.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.DataLoader.Builtin.Excel;
22 |
23 | public class RawSheet
24 | {
25 | public Title Title { get; set; }
26 |
27 | public string SheetName { get; set; }
28 |
29 | public List> Cells { get; set; }
30 | }
31 |
--------------------------------------------------------------------------------
/src/Luban.Core/RawDefs/TypeMapper.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.RawDefs;
22 |
23 | public class TypeMapper
24 | {
25 | public List Targets { get; set; }
26 |
27 | public List CodeTargets { get; set; }
28 |
29 | public Dictionary Options { get; set; }
30 | }
31 |
--------------------------------------------------------------------------------
/src/Luban.Core/TypeVisitors/AllTrueVisitor.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.Types;
22 |
23 | namespace Luban.TypeVisitors;
24 |
25 | public abstract class AllTrueVisitor : DecoratorFuncVisitor
26 | {
27 | public override bool DoAccept(TType type)
28 | {
29 | return true;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Luban.Rust/Templates/rust-json/lib.sbn:
--------------------------------------------------------------------------------
1 | pub mod prelude{
2 | pub use crate::*;
3 | {{~ for ns in __ns ~}}
4 | pub use {{ns}}::*;
5 | {{~end~}}
6 | }
7 | {{~ if __polymorphic_beans.count != 0 ~}}
8 |
9 | type AbstractBase = dyn std::any::Any + Sync + Send;
10 |
11 | pub trait GetBase<'a, T> {
12 | fn get_base(&'a self) -> Result;
13 | }
14 | {{~end~}}
15 |
16 | #[derive(Debug)]
17 | pub enum LubanError {
18 | Loader(String),
19 | Table(String),
20 | Bean(String),
21 | Polymorphic(String),
22 | Unknown(String),
23 | }
24 |
25 | impl std::fmt::Display for LubanError {
26 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
27 | f.write_str(match self {
28 | LubanError::Loader(msg) |
29 | LubanError::Table(msg) |
30 | LubanError::Bean(msg) |
31 | LubanError::Polymorphic(msg) |
32 | LubanError::Unknown(msg) => msg,
33 | })
34 | }
35 | }
36 |
37 | pub struct Tables{
38 | {{~ for table in __tables ~}}
39 | pub {{table.name}}: std::sync::Arc<{{full_name table}}>,
40 | {{~end~}}
41 | }
42 |
43 | impl Tables {
44 | pub fn new Result>(loader: T) -> Result {
45 | Ok(Tables {
46 | {{~ for table in __tables ~}}
47 | {{table.name}}: {{full_name table}}::new(&loader("{{table.output_data_file}}")?)?,
48 | {{~end~}}
49 | })
50 | }
51 | }
--------------------------------------------------------------------------------
/src/Luban.Core/TypeVisitors/AllFalseVisitor.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.Types;
22 |
23 | namespace Luban.TypeVisitors;
24 |
25 | public abstract class AllFalseVisitor : DecoratorFuncVisitor
26 | {
27 | public override bool DoAccept(TType type)
28 | {
29 | return false;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Luban.Core/Schema/SchemaLoaderBase.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.Schema;
22 |
23 | public abstract class SchemaLoaderBase : ISchemaLoader
24 | {
25 | public string Type { get; set; }
26 |
27 | public ISchemaCollector Collector { get; set; }
28 |
29 | public abstract void Load(string fileName);
30 | }
31 |
--------------------------------------------------------------------------------
/src/Luban.Core/Serialization/BeanBase.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.Serialization;
22 |
23 | public abstract class BeanBase : ITypeId, ISerializable
24 | {
25 | public abstract int GetTypeId();
26 |
27 | public abstract void Serialize(ByteBuf os);
28 |
29 | public abstract void Deserialize(ByteBuf os);
30 | }
31 |
--------------------------------------------------------------------------------
/src/Luban.Core/RawDefs/RawTarget.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.RawDefs;
22 |
23 | public class RawTarget
24 | {
25 | public string Name { get; set; }
26 |
27 | public string Manager { get; set; }
28 |
29 | public string TopModule { get; set; }
30 |
31 | public List Groups { get; set; } = new();
32 | }
33 |
--------------------------------------------------------------------------------
/src/Luban.Core/CodeFormat/CodeStyleAttribute.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.CustomBehaviour;
22 |
23 | namespace Luban.CodeFormat;
24 |
25 | [AttributeUsage(AttributeTargets.Class)]
26 | public class CodeStyleAttribute : BehaviourBaseAttribute
27 | {
28 | public CodeStyleAttribute(string name) : base(name)
29 | {
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Luban.Core/L10N/TextProviderAttribute.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.CustomBehaviour;
22 |
23 | namespace Luban.L10N;
24 |
25 | [AttributeUsage(AttributeTargets.Class)]
26 | public class TextProviderAttribute : BehaviourBaseAttribute
27 | {
28 | public TextProviderAttribute(string name) : base(name)
29 | {
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Luban.Core/OutputSaver/IOutputSaver.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.OutputSaver;
22 |
23 | public interface IOutputSaver
24 | {
25 | string Name { get; }
26 |
27 | void Save(OutputFileManifest outputFileManifest);
28 |
29 | void SaveFile(OutputFileManifest fileManifest, string outputDir, OutputFile outputFile);
30 | }
31 |
--------------------------------------------------------------------------------
/src/Luban.Core/Pipeline/PipelineAttribute.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.CustomBehaviour;
22 |
23 | namespace Luban.Pipeline;
24 |
25 | [AttributeUsage(AttributeTargets.Class)]
26 | public class PipelineAttribute : BehaviourBaseAttribute
27 | {
28 | public PipelineAttribute(string name) : base(name)
29 | {
30 |
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Luban.Core/CodeFormat/NamingConventionFormatters/NoneFormatter.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.CodeFormat.NamingConventionFormatters;
22 |
23 | [NamingConvention("none")]
24 | public class NoneFormatter : INamingConventionFormatter
25 | {
26 | public string FormatName(string name)
27 | {
28 | return name;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/Luban.Core/DataTarget/DataTargetAttribute.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.CustomBehaviour;
22 |
23 | namespace Luban.DataTarget;
24 |
25 | [AttributeUsage(AttributeTargets.Class)]
26 | public class DataTargetAttribute : BehaviourBaseAttribute
27 | {
28 | public DataTargetAttribute(string name) : base(name)
29 | {
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Luban.Core/OutputSaver/OutputSaverAttribute.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.CustomBehaviour;
22 |
23 | namespace Luban.OutputSaver;
24 |
25 | [AttributeUsage(AttributeTargets.Class)]
26 | public class OutputSaverAttribute : BehaviourBaseAttribute
27 | {
28 | public OutputSaverAttribute(string name) : base(name)
29 | {
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Luban.Core/Schema/SchemaCollectorAttribute.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.CustomBehaviour;
22 |
23 | namespace Luban.Schema;
24 |
25 | [AttributeUsage(AttributeTargets.Class)]
26 | public class SchemaCollectorAttribute : BehaviourBaseAttribute
27 | {
28 | public SchemaCollectorAttribute(string name) : base(name)
29 | {
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Luban.Core/DataTarget/DataExporterAttribute.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.CustomBehaviour;
22 |
23 | namespace Luban.DataTarget;
24 |
25 | [AttributeUsage(AttributeTargets.Class)]
26 | public class DataExporterAttribute : BehaviourBaseAttribute
27 | {
28 |
29 | public DataExporterAttribute(string name) : base(name)
30 | {
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Luban.Core/Schema/ITableImporter.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.RawDefs;
22 | using System;
23 | using System.Collections.Generic;
24 | using System.Linq;
25 | using System.Text;
26 | using System.Threading.Tasks;
27 |
28 | namespace Luban.Schema;
29 |
30 | public interface ITableImporter
31 | {
32 | List LoadImportTables();
33 | }
34 |
--------------------------------------------------------------------------------
/src/Luban.Core/Utils/TimeUtil.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.Utils;
22 |
23 | public static class TimeUtil
24 | {
25 | public static int Now => (int)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
26 |
27 | public static long NowMillis => (long)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalMilliseconds;
28 | }
29 |
--------------------------------------------------------------------------------
/src/Luban.Core/CodeFormat/NamingConventionAttribute.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.CustomBehaviour;
22 |
23 | namespace Luban.CodeFormat;
24 |
25 | [AttributeUsage(AttributeTargets.Class)]
26 | public class NamingConventionAttribute : BehaviourBaseAttribute
27 | {
28 | public NamingConventionAttribute(string name) : base(name)
29 | {
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Luban.Core/CodeTarget/CodeTargetAttribute.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.CustomBehaviour;
22 |
23 | namespace Luban.CodeTarget;
24 |
25 | [AttributeUsage(AttributeTargets.Class, Inherited = false)]
26 | public class CodeTargetAttribute : BehaviourBaseAttribute
27 | {
28 | public CodeTargetAttribute(string name) : base(name)
29 | {
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Luban.Core/DataLoader/DataLoaderAttribute.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.CustomBehaviour;
22 |
23 | namespace Luban.DataLoader;
24 |
25 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
26 | public class DataLoaderAttribute : BehaviourBaseAttribute
27 | {
28 | public DataLoaderAttribute(string name) : base(name)
29 | {
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Luban.Rust/ConstantStrings.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.Rust;
22 |
23 | public static class ConstantStrings
24 | {
25 | public const string ArrayType = "Vec";
26 | public const string ListType = "Vec";
27 | public const string SetType = "std::collections::HashSet";
28 | public const string MapType = "std::collections::HashMap";
29 | }
30 |
--------------------------------------------------------------------------------
/docs/images/reliable.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/Luban.Protobuf/CodeTarget/CSharpProtobuf2CodeTarget.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.CodeTarget;
22 | using Luban.Protobuf.TemplateExtensions;
23 | using Luban.Utils;
24 | using Scriban;
25 |
26 | namespace Luban.Protobuf.CodeTarget;
27 |
28 | [CodeTarget("cs-protobuf2")]
29 | public class CSharpProtobuf2CodeTarget : CSharpProtobufCodeTargetBase
30 | {
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/src/Luban.Protobuf/CodeTarget/CSharpProtobuf3CodeTarget.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.CodeTarget;
22 | using Luban.Protobuf.TemplateExtensions;
23 | using Luban.Utils;
24 | using Scriban;
25 |
26 | namespace Luban.Protobuf.CodeTarget;
27 |
28 | [CodeTarget("cs-protobuf3")]
29 | public class CSharpProtobuf3CodeTarget : CSharpProtobufCodeTargetBase
30 | {
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/src/Luban.Core/CodeFormat/NamingConventionFormatters/UpperCaseFormatter.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.CodeFormat.NamingConventionFormatters;
22 |
23 | [NamingConvention("upper")]
24 | public class UpperCaseFormatter : INamingConventionFormatter
25 | {
26 | public string FormatName(string name)
27 | {
28 | return name.ToUpperInvariant();
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/Luban.Core/Schema/BeanSchemaLoaderAttribute.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.CustomBehaviour;
22 |
23 | namespace Luban.Schema;
24 |
25 | [AttributeUsage(AttributeTargets.Class, Inherited = false)]
26 | public class BeanSchemaLoaderAttribute : BehaviourBaseAttribute
27 | {
28 | public BeanSchemaLoaderAttribute(string name) : base(name)
29 | {
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Luban.CSharp/ConstStrings.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.CSharp;
22 |
23 | public static class ConstStrings
24 | {
25 | public const string ListTypeName = "System.Collections.Generic.List";
26 | public const string HashSetTypeName = "System.Collections.Generic.HashSet";
27 | public const string HashMapTypeName = "System.Collections.Generic.Dictionary";
28 | }
29 |
--------------------------------------------------------------------------------
/src/Luban.Core/IGenerationContext.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban;
22 |
23 | // public interface IGenerationContext
24 | // {
25 | // public static IGenerationContext Ins { get; set; }
26 | //
27 | // bool NeedExport(List groups);
28 | //
29 | // string TopModule { get; }
30 | //
31 | // public GenerationArguments Arguments { get; }
32 | // }
33 |
--------------------------------------------------------------------------------
/src/Luban.DataTarget.Builtin/NullDataExporter.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.DataTarget;
22 |
23 | namespace Luban.DataExporter.Builtin;
24 |
25 | [DataExporter("null")]
26 | public class NullDataExporter : DataExporterBase
27 | {
28 | public override void Handle(GenerationContext ctx, IDataTarget dataTarget, OutputFileManifest manifest)
29 | {
30 |
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Luban.Core/PostProcess/IPostProcess.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.PostProcess;
22 |
23 | public interface IPostProcess
24 | {
25 | void PostProcess(OutputFileManifest oldOutputFileManifest, OutputFileManifest newOutputFileManifest);
26 | void PostProcess(OutputFileManifest oldOutputFileManifest, OutputFileManifest newOutputFileManifest, OutputFile outputFile);
27 | }
28 |
--------------------------------------------------------------------------------
/src/Luban.Protobuf/DataTarget/Protobuf3BinDataTarget.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Google.Protobuf;
22 | using Luban.DataTarget;
23 | using Luban.Defs;
24 | using Luban.Protobuf.DataVisitors;
25 | using Luban.Utils;
26 |
27 | namespace Luban.Protobuf.DataTarget;
28 |
29 | [DataTarget("protobuf3-bin")]
30 | public class Protobuf3BinDataTarget : Protobuf2BinDataTarget
31 | {
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/src/Luban.Core/DataLoader/IDataLoader.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.Defs;
22 | using Luban.Types;
23 |
24 | namespace Luban.DataLoader;
25 |
26 | public interface IDataLoader
27 | {
28 | string RawUrl { get; }
29 |
30 | Record ReadOne(TBean type);
31 |
32 | List ReadMulti(TBean type);
33 |
34 | void Load(string rawUrl, string subAsset, Stream stream);
35 | }
36 |
--------------------------------------------------------------------------------
/src/Luban.Core/Defs/DefRefGroup.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.RawDefs;
22 |
23 | namespace Luban.Defs;
24 |
25 | public class DefRefGroup
26 | {
27 | public string Name { get; }
28 |
29 | public List Refs { get; }
30 |
31 | public DefRefGroup(RawRefGroup group)
32 | {
33 | this.Name = group.Name;
34 | this.Refs = group.Refs;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/Luban.Core/L10N/ITextProvider.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.L10N;
22 |
23 | public interface ITextProvider
24 | {
25 | void Load();
26 |
27 | void ProcessDatas();
28 |
29 | bool IsValidKey(string key);
30 |
31 | bool TryGetText(string key, out string text);
32 |
33 | void AddUnknownKey(string key);
34 |
35 | bool ConvertTextKeyToValue { get; }
36 | }
37 |
--------------------------------------------------------------------------------
/src/Luban.Core/Utils/TemplateUtil.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Scriban;
22 |
23 | namespace Luban.Utils;
24 |
25 | public static class TemplateUtil
26 | {
27 | public static TemplateContext CreateDefaultTemplateContext()
28 | {
29 | return new TemplateContext()
30 | {
31 | LoopLimit = 0,
32 | NewLine = "\n",
33 | };
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/Luban.Core/Validator/IDataValidator.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.Datas;
22 | using Luban.Defs;
23 | using Luban.Types;
24 |
25 | namespace Luban.Validator;
26 |
27 | public interface IDataValidator
28 | {
29 | string Args { get; set; }
30 |
31 | void Compile(DefField owner, TType type);
32 |
33 | void Validate(DataValidatorContext ctx, TType type, DType data);
34 | }
35 |
--------------------------------------------------------------------------------
/src/Luban.Core/Utils/CollectionExtensions.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.Utils;
22 |
23 | public static class CollectionExtensions
24 | {
25 | public static void AddAll(this Dictionary resultDic, Dictionary addDic) where K : notnull
26 | {
27 | foreach (var e in addDic)
28 | {
29 | resultDic[e.Key] = e.Value;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Luban.Core/CodeFormat/NamingConventionFormatters/SnakeCaseFormatter.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.Utils;
22 |
23 | namespace Luban.CodeFormat.NamingConventionFormatters;
24 |
25 | [NamingConvention("snake")]
26 | public class SnakeCaseFormatter : INamingConventionFormatter
27 | {
28 | public string FormatName(string name)
29 | {
30 | return TypeUtil.ToUnderScores(name);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Luban.Core/DataTransformer/IDataTransformer.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.Datas;
22 | using Luban.Types;
23 | using System;
24 | using System.Collections.Generic;
25 | using System.Linq;
26 | using System.Text;
27 | using System.Threading.Tasks;
28 |
29 | namespace Luban.DataTransformer;
30 |
31 | public interface IDataTransformer
32 | {
33 | DType Transform(DType originalData, TType type);
34 | }
35 |
--------------------------------------------------------------------------------
/src/Luban.FlatBuffers/Templates/flatbuffers/schema.sbn:
--------------------------------------------------------------------------------
1 | namespace {{__namespace}};
2 |
3 | {{~for enum in __enums
4 | typeName = full_name enum
5 | ~}}
6 | enum {{typeName}}:int {
7 | {{~if !enum.has_zero_value_item~}}
8 | __GENERATE_DEFAULT_VALUE = 0,
9 | {{~end~}}
10 | {{~for item in enum.items ~}}
11 | {{typeName}}_{{item.name}} = {{item.int_value}},
12 | {{~end~}}
13 | }
14 | {{~end~}}
15 |
16 | {{~for bean in __beans~}}
17 | {{~if bean.is_abstract_type ~}}
18 | union {{full_name bean}} {
19 | {{~for c in bean.hierarchy_not_abstract_children~}}
20 | {{full_name c}},
21 | {{~end~}}
22 | }
23 | {{~end~}}
24 | {{~end~}}
25 |
26 | {{~for bean in __beans~}}
27 | {{~if !bean.is_abstract_type ~}}
28 | table {{full_name bean}} {
29 | {{~for f in bean.hierarchy_export_fields ~}}
30 | {{f.name}}:{{declaring_type_name f.ctype}}{{type_metadata f.ctype}};
31 | {{~end~}}
32 | }
33 | {{~end~}}
34 | {{~end~}}
35 |
36 | {{~for map in __maps~}}
37 | table KeyValue_{{declaring_type_name map.key_type}}_{{declaring_type_name map.value_type}} {
38 | key: {{declaring_type_name map.key_type}}{{type_metadata map.key_type}};
39 | value: {{declaring_type_name map.value_type}}{{type_metadata map.value_type}};
40 | }
41 | {{~end~}}
42 |
43 | {{~for table in __tables~}}
44 | table {{full_name table}} {
45 | // WARN! The name 'data_list' is used by FlatBuffersJsonExporter. don't modify it!
46 | data_list:[{{declaring_type_name table.value_ttype}}](required);
47 | }
48 |
49 | root_type {{full_name table}};
50 | {{~end~}}
51 |
52 |
--------------------------------------------------------------------------------
/src/Luban.Core/CodeFormat/NamingConventionFormatters/PascalCaseFormatter.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.Utils;
22 |
23 | namespace Luban.CodeFormat.NamingConventionFormatters;
24 |
25 | [NamingConvention("pascal")]
26 | public class PascalCaseFormatter : INamingConventionFormatter
27 | {
28 | public string FormatName(string name)
29 | {
30 | return TypeUtil.ToPascalCase(name);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Luban.Cpp/TypeVisitors/CppRawptrUnderlyingDeserializeVisitor.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.Cpp.TemplateExtensions;
22 | using Luban.Types;
23 | using Luban.TypeVisitors;
24 |
25 | namespace Luban.Cpp.TypeVisitors;
26 |
27 | public class CppRawptrUnderlyingDeserializeVisitor : CppUnderlyingDeserializeVisitorBase
28 | {
29 | public static CppRawptrUnderlyingDeserializeVisitor Ins { get; } = new();
30 | }
31 |
--------------------------------------------------------------------------------
/src/Luban.Core/CodeFormat/NamingConventionFormatters/CamelCaseFormatter.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.Utils;
22 |
23 | namespace Luban.CodeFormat.NamingConventionFormatters;
24 |
25 | [NamingConvention("camel")]
26 | public class CamelCaseFormatter : INamingConventionFormatter
27 | {
28 | public string FormatName(string fieldName)
29 | {
30 | return TypeUtil.ToCamelCase(fieldName);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/Luban.Core/DataVisitors/ToStringVisitor2.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.Datas;
22 | using Luban.Utils;
23 |
24 | namespace Luban.DataVisitors;
25 |
26 | public class ToStringVisitor2 : ToStringVisitor
27 | {
28 | public new static ToStringVisitor2 Ins { get; } = new();
29 |
30 | public override string Accept(DString type)
31 | {
32 | return DataUtil.EscapeString(type.Value);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/Luban.Core/CustomBehaviour/BehaviourBaseAttribute.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.CustomBehaviour;
22 |
23 | public abstract class BehaviourBaseAttribute : Attribute, ICustomBehaviour
24 | {
25 | public string Name { get; }
26 |
27 | public int Priority { get; set; }
28 |
29 | protected BehaviourBaseAttribute(string name)
30 | {
31 | Name = name;
32 | Priority = 0;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/Luban.Core/OutputSaver/NullSaver.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.OutputSaver;
22 |
23 | [OutputSaver("null")]
24 | public class NullSaver : OutputSaverBase
25 | {
26 | public override void Save(OutputFileManifest outputFileManifest)
27 | {
28 |
29 | }
30 |
31 | public override void SaveFile(OutputFileManifest fileManifest, string outputDir, OutputFile outputFile)
32 | {
33 |
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/Luban.DataValidator.Builtin/Path/GodotResourcePattern.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.DataValidator.Builtin.Path;
22 |
23 | class GodotResourcePattern : IPathPattern
24 | {
25 | public bool EmptyAble { get; set; }
26 | public bool ExistPath(string rootDir, string subFile)
27 | {
28 | return subFile.StartsWith("res://") && File.Exists(System.IO.Path.Combine(rootDir, subFile.Substring(6)));
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/Luban.Cpp/Templates/cpp-rawptr-bin/schema_cpp.sbn:
--------------------------------------------------------------------------------
1 | #include "{{__schema_header_file}}"
2 |
3 | {{namespace_with_grace_begin __top_module}}
4 |
5 | {{~for bean in __beans~}}
6 |
7 | bool {{make_cpp_name bean.full_name}}::deserialize(::luban::ByteBuf& _buf)
8 | {
9 | {{~if bean.parent_def_type~}}
10 | if (!{{make_cpp_name bean.parent_def_type.full_name}}::deserialize(_buf))
11 | {
12 | return false;
13 | }
14 | {{~end~}}
15 |
16 | {{~ for field in bean.export_fields ~}}
17 | {{deserialize '_buf' (format_field_name __code_style field.name) field.ctype}}
18 | {{~end~}}
19 |
20 | return true;
21 | }
22 |
23 | {{~if bean.is_abstract_type~}}
24 | bool {{make_cpp_name bean.full_name}}::deserialize{{bean.name}}(::luban::ByteBuf& _buf, {{make_cpp_name bean.full_name}}*& _out)
25 | {
26 | int32_t id;
27 | if (!_buf.readInt(id)) return false;
28 | switch (id)
29 | {
30 | {{~for child in bean.hierarchy_not_abstract_children~}}
31 | case {{make_type_cpp_name child}}::__ID__: { _out = LUBAN_NEW({{make_type_cpp_name child}}); if (_out->deserialize(_buf)) { return true; } else { _out = nullptr; return false;} }
32 | {{~end~}}
33 | default: { _out = nullptr; return false;}
34 | }
35 | }
36 | {{~else~}}
37 | bool {{make_cpp_name bean.full_name}}::deserialize{{bean.name}}(::luban::ByteBuf& _buf, {{make_cpp_name bean.full_name}}*& _out)
38 | {
39 | _out = LUBAN_NEW({{make_type_cpp_name bean}});
40 | return _out->deserialize(_buf);
41 | }
42 | {{~end~}}
43 |
44 | {{~end~}}
45 | {{namespace_with_grace_end __top_module}}
46 |
--------------------------------------------------------------------------------
/src/Luban.DataValidator.Builtin/Set/StringDataSet.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.DataValidator.Builtin.Set;
22 |
23 | public class StringDataSet
24 | {
25 | private readonly HashSet _values;
26 | public StringDataSet(string args)
27 | {
28 | _values = args.Split(',').ToHashSet();
29 | }
30 |
31 | public bool Contains(string value)
32 | {
33 | return _values.Contains(value);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/Luban.L10N/DataTarget/TextKeyCollection.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | namespace Luban.L10N.DataTarget;
22 |
23 | public class TextKeyCollection
24 | {
25 | private readonly HashSet _keys = new();
26 |
27 | public void AddKey(string key)
28 | {
29 | if (!string.IsNullOrWhiteSpace(key))
30 | {
31 | _keys.Add(key);
32 | }
33 | }
34 |
35 | public IEnumerable Keys => _keys;
36 | }
37 |
--------------------------------------------------------------------------------
/src/Luban.CSharp/TypeVisitors/EditorUnderlyingTypeNameVisitor.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2025 Code Philosophy
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a copy
4 | // of this software and associated documentation files (the "Software"), to deal
5 | // in the Software without restriction, including without limitation the rights
6 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | // copies of the Software, and to permit persons to whom the Software is
8 | // furnished to do so, subject to the following conditions:
9 | //
10 | // The above copyright notice and this permission notice shall be included in all
11 | // copies or substantial portions of the Software.
12 | //
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | // SOFTWARE.
20 |
21 | using Luban.Types;
22 |
23 | namespace Luban.CSharp.TypeVisitors;
24 |
25 | public class EditorUnderlyingTypeNameVisitor : UnderlyingDeclaringTypeNameVisitor
26 | {
27 | public new static EditorUnderlyingTypeNameVisitor Ins { get; } = new();
28 |
29 | public override string Accept(TDateTime type)
30 | {
31 | return "string";
32 | }
33 | }
34 |
--------------------------------------------------------------------------------