Excel快速轉換CSV工具,並生成CSharp讀取配置文件。git
包含功能: 轉客戶端csv,客戶端讀取配置的CSharp代碼;轉服務器csv,後續支持直轉數據庫github
具體代碼:https://github.com/garsonlab/TinyConfig數據庫
輸出 | OtherDef | ||||||||
---|---|---|---|---|---|---|---|---|---|
服務器 | Level | Exp | Max | Property | Type | Name | Model | ||
客戶端 | Id | Level | Name | Exp#Min | Exp#Max | Property#1 | Property#2 | Monster#1#1#Name | Monster#1#2#Name |
類型 | _key | _key | text | int | int | int | int | text | text |
說明 | id | 等級 | 名字 | 經驗 | 最大經驗 | 屬性 | 類型 | 名字1 | 名字2 |
生成CSharp文件中,字段分割使用「#」,遇到數字自動識別成數組,其餘識別成類。數組下標從1開始數組
public struct Options { public string excelPath;//excel public string serverFolder;//server csv public string clientFolder;//client csv public string csFolder;//csharp public string nameSpace;//csharp 命名空間 }
使用「測試.xlsx」進行轉換,根據下方的table生成兩個CSharp文件, CombatExpDef, OtherExpDef服務器
每一個類包含3個靜態模塊:工具
- Load(string),加載讀取的csv數據
- Values,全部def的List
- Find(int ...), 根據上方標識的「_key」獲取單個配置項