diff --git a/Apewer/Apewer.csproj b/Apewer/Apewer.csproj
index 17df3fb..fbd845c 100644
--- a/Apewer/Apewer.csproj
+++ b/Apewer/Apewer.csproj
@@ -7,7 +7,7 @@
Apewer
Apewer
Apewer
- 6.0.12
+ 6.0.13
diff --git a/Apewer/Internals/TextConverter.cs b/Apewer/Internals/TextConverter.cs
index 4f2d108..aa4238f 100644
--- a/Apewer/Internals/TextConverter.cs
+++ b/Apewer/Internals/TextConverter.cs
@@ -243,6 +243,9 @@ namespace Apewer.Internals
try
{
var t = text.Trim();
+ t = t.Replace(" ", "").Replace(",", "").Replace(",", "");
+ t = t.Replace("。", ".");
+
var p = 0;
while (t.Length > 0 && t.EndsWith("%"))
{
@@ -267,6 +270,9 @@ namespace Apewer.Internals
try
{
var t = text.Trim();
+ t = t.Replace(" ", "").Replace(",", "").Replace(",", "");
+ t = t.Replace("。", ".");
+
var p = 0;
while (t.Length > 0 && t.EndsWith("%"))
{
@@ -291,6 +297,9 @@ namespace Apewer.Internals
try
{
var t = text.Trim();
+ t = t.Replace(" ", "").Replace(",", "").Replace(",", "");
+ t = t.Replace("。", ".");
+
var p = 0;
while (t.Length > 0 && t.EndsWith("%"))
{
@@ -306,6 +315,9 @@ namespace Apewer.Internals
try
{
var t = text.Trim();
+ t = t.Replace(" ", "").Replace(",", "").Replace(",", "");
+ t = t.Replace("。", ".");
+
var p = 0;
while (t.Length > 0 && t.EndsWith("%"))
{
diff --git a/Apewer/Web/ApiInternals.cs b/Apewer/Web/ApiInternals.cs
index f7efb90..2275411 100644
--- a/Apewer/Web/ApiInternals.cs
+++ b/Apewer/Web/ApiInternals.cs
@@ -34,7 +34,7 @@ namespace Apewer.Web
public static List Assemblies { get { return _assemblies; } set { _assemblies = value; } }
- internal static Dictionary GetEntries(IEnumerable assemblies, bool sort = false)
+ internal static Dictionary GetEntries(IEnumerable assemblies, bool sort = true)
{
var entries = new Dictionary();
@@ -67,14 +67,14 @@ namespace Apewer.Web
var fns = new List();
fns.AddRange(ClassUtility.GetOrigin(fes).Keys);
- if (sort) fns = SortUtility.Ascend(fns);
+ if (sort) fns.Sort();
foreach (var i in fns) application.Functions.Add(i, fes[i]);
}
}
var ans = new List();
ans.AddRange(ClassUtility.GetOrigin(aes).Keys);
- if (sort) ans = SortUtility.Ascend(ans);
+ if (sort) ans.Sort();
foreach (var i in ans) entries.Add(i, aes[i]);
return entries;
diff --git a/Apewer/Web/ApiInvoker.cs b/Apewer/Web/ApiInvoker.cs
index 825c0fa..bb120ea 100644
--- a/Apewer/Web/ApiInvoker.cs
+++ b/Apewer/Web/ApiInvoker.cs
@@ -458,12 +458,20 @@ namespace Apewer.Web
/// 设置 Kestrel 的 API 入口。
///
- public static void SetKestrelEntries(IEnumerable assemblies, bool sort = false)
+ public static void SetKestrelEntries(IEnumerable assemblies, bool sort = true)
{
if (assemblies == null) throw new ArgumentNullException(nameof(assemblies));
KestrelEntries = ApiInternals.GetEntries(assemblies, sort);
}
+ /// 设置 Kestrel 的 API 入口。
+ public static void SetKestrelEntries(Assembly assembly, bool sort = true)
+ {
+ var assemblies = new Assembly[] { assembly };
+ if (assemblies[0] == null) assemblies[0] = Assembly.GetCallingAssembly();
+ KestrelEntries = ApiInternals.GetEntries(assemblies, sort);
+ }
+
// internal static async Task Execute(HttpContext context)
// {
// Invoke(context, ApiInternals.Entries);
@@ -479,11 +487,10 @@ namespace Apewer.Web
}
/// 运行 Kestrel 服务器,可指定端口和最大请求 Body 长度。默认同步运行,阻塞当前线程。
- /// 注意:启动前必须设置 Kestrel Entries。
- ///
+ /// 注意:启动前应使用 SetKestrelEntries 方法设置 Kestrel Entries。
public static IHost RunKestrel(int port = 80, int request = 1073741824, bool async = false)
{
- if (KestrelEntries == null) throw new MissingMemberException();
+ if (KestrelEntries == null) SetKestrelEntries(Assembly.GetCallingAssembly());
var builder1 = Host.CreateDefaultBuilder();
var builder2 = builder1.ConfigureWebHostDefaults((builder3) =>
diff --git a/Apewer/_ChangeLog.md b/Apewer/_ChangeLog.md
index 3486b86..db3a0ab 100644
--- a/Apewer/_ChangeLog.md
+++ b/Apewer/_ChangeLog.md
@@ -5,6 +5,10 @@
### 最新提交
+### 6.0.13
+- 从文本转换到 Single、Double 和 Decimal,在转换前将自动修剪;
+- 不再强制要求在启动 Kestrel 前调用 SetKestrelEntries。
+
### 6.0.12
- 扩展方法 ToSingle、ToDouble、ToDecimal 支持输入百分号。