修复了已知的bug

This commit is contained in:
fengjiayi
2025-09-04 10:39:57 +08:00
parent f9ab920939
commit 51c268baad
28 changed files with 1099 additions and 108 deletions

View File

@@ -257,7 +257,16 @@ namespace Serein.Library.Utils
object result;
if (type.IsEnum)
{
result = Enum.Parse(type, valueStr);
if (int.TryParse(valueStr, out int numericValue))
{
// 输入是数字,直接转换
result = Enum.ToObject(type, numericValue);
}
else
{
// 输入是枚举名称
result = Enum.Parse(type, valueStr, ignoreCase: true);
}
}
else if (type == typeof(bool))
{