diff --git a/README.md b/README.md
index f421b83..76ed3f9 100644
--- a/README.md
+++ b/README.md
@@ -325,6 +325,44 @@ xml中定义如下
+或者可以用多级标题头对每个元素单独限定
+
+
+
+
+ | ## |
+ id |
+ name |
+ rewards |
+
+
+ | ##type |
+ int |
+ string |
+ list,Reward |
+
+
+
+ | ##+ |
+ |
+ |
+ 0 |
+ 1 |
+ 2 |
+
+
+ | ##+ |
+ |
+ |
+ item_id | num | desc |
+ item_id | num | desc |
+ item_id | num | desc |
+
+
+ | 1 | task1 | 1 | 10 | desc1 | 2 | 12 | desc2 | 3 | 13 | desc3 |
+ | 2 | task1 | 3 | 30 | desc3 | 4 | 40 | desc4 |
+ | 3 | task1 | 5 | 50 | desc5 |
+
### 多行结构列表
有时候列表结构的每个结构字段较多,如果水平展开则占据太多列,不方便编辑,如果拆表,无论程序还是策划都不方便,此时可以使用多行模式。支持任意层次的多行结构列表(也即多行结构中的每个元素也可以是多行), name&multi_rows=1或者 *name 都可以表达一个多行解析的字段。
@@ -579,6 +617,27 @@ xml中定义如下
+
+ | ##+ |
+ |
+ |
+ 0 |
+ 1 |
+ 2 |
+
+
+ | ##+ |
+ |
+ |
+ item_id | num | desc |
+ item_id | num | desc |
+ item_id | num | desc |
+
+
+ | 1 | task1 | 1 | 10 | desc1 | 2 | 12 | desc2 | 3 | 13 | desc3 |
+ | 2 | task1 | 3 | 30 | desc3 | 4 | 40 | desc4 |
+ | 3 | task1 | 5 | 50 | desc5 |
+
### 可空数据类型
配置数据中经常有空值的语义需求,实际项目中往往混杂地使用0或-1表达空值,既不自然清晰也不统一。luban借鉴了c#中的可空变量的概念,特地提供可空数据支持。所有原生数据类型,以及enum、bean、和多态bean类型都有相应的可空数据类型。定义方式为 <类型名>?,与c#里的Nullable类型定义方式相同。例如 bool?,int?,long?,double?, EColor?, DemoType?
diff --git a/src/Luban.ClientServer/Program.cs b/src/Luban.ClientServer/Program.cs
index e6b91ab..efff373 100644
--- a/src/Luban.ClientServer/Program.cs
+++ b/src/Luban.ClientServer/Program.cs
@@ -219,6 +219,8 @@ Options:
LogUtil.InitSimpleNLogConfigure(NLog.LogLevel.FromString(options.LogLevel));
s_logger = NLog.LogManager.GetCurrentClassLogger();
+ TimeZoneUtil.InitDefaultTimeZone("");
+
int processorCount = System.Environment.ProcessorCount;
ThreadPool.SetMinThreads(Math.Max(4, processorCount), 5);
ThreadPool.SetMaxThreads(Math.Max(16, processorCount * 4), 10);
diff --git a/src/Luban.Common/Source/Utils/TimeZoneUtil.cs b/src/Luban.Common/Source/Utils/TimeZoneUtil.cs
index 739b759..83518ce 100644
--- a/src/Luban.Common/Source/Utils/TimeZoneUtil.cs
+++ b/src/Luban.Common/Source/Utils/TimeZoneUtil.cs
@@ -8,6 +8,45 @@ namespace Luban.Common.Utils
{
public static class TimeZoneUtil
{
+ private static readonly NLog.Logger s_logger = NLog.LogManager.GetCurrentClassLogger();
+
+ public static void InitDefaultTimeZone(string timeZoneName)
+ {
+ if (timeZoneName?.ToLower() == "local")
+ {
+ DefaultTimeZone = TimeZoneInfo.Local;
+ return;
+ }
+ if (timeZoneName?.ToLower() == "utc")
+ {
+ DefaultTimeZone = TimeZoneInfo.Utc;
+ return;
+ }
+ if (string.IsNullOrEmpty(timeZoneName))
+ {
+ try
+ {
+ DefaultTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Asia/Shanghai");
+ }
+ catch (Exception)
+ {
+ try
+ {
+ DefaultTimeZone = TimeZoneInfo.FindSystemTimeZoneById("China Standard Time");
+ }
+ catch (Exception ex)
+ {
+ s_logger.Error(ex);
+ throw new ArgumentException("The default timezone ID 'Asia/Shanghai' and 'China Standard Time' was not found on local computer. please set valid timezone manually.");
+ }
+ }
+ }
+ else
+ {
+ DefaultTimeZone = TimeZoneInfo.FindSystemTimeZoneById(timeZoneName);
+ }
+ }
+
public static TimeZoneInfo DefaultTimeZone { get; set; } = TimeZoneInfo.Utc;
}
}
diff --git a/src/Luban.Server/Source/Program.cs b/src/Luban.Server/Source/Program.cs
index 08579b2..b4106d7 100644
--- a/src/Luban.Server/Source/Program.cs
+++ b/src/Luban.Server/Source/Program.cs
@@ -26,8 +26,8 @@ namespace Luban.Server
[Option("disable_cache", Required = false, HelpText = "disable generation cache")]
public bool DisableCache { get; set; }
- [Option("i10n:default_timezone", Required = false, HelpText = "default timezone")]
- public string L10nDefaultTimeZone { get; set; } = "Asia/Shanghai";
+ [Option("i10n:default_timezone", Required = false, HelpText = "default timezone id. 'Asia/Shanghai', 'China Standard Time' eg. you can also use two special values: local,utc")]
+ public string L10nDefaultTimeZone { get; set; }
}
static void Main(string[] args)
@@ -50,7 +50,7 @@ namespace Luban.Server
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
- TimeZoneUtil.DefaultTimeZone = TimeZoneInfo.FindSystemTimeZoneById(options.L10nDefaultTimeZone);
+ TimeZoneUtil.InitDefaultTimeZone(options.L10nDefaultTimeZone);
GenServer.Ins.Start(false, options.Port, ProtocolStub.Factories);