mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-20 00:06:45 +08:00
重新设计了@get 表达式,修改了 Workbench后台长时间运行时,重新切换到前台会产生参数连接线错误显示的问题
This commit is contained in:
57
Library/Utils/SereinExpression/SereinExpressionExtension.cs
Normal file
57
Library/Utils/SereinExpression/SereinExpressionExtension.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serein.Library.Utils.SereinExpression
|
||||
{
|
||||
internal class SereinExpressionExtension
|
||||
{
|
||||
/// <summary>
|
||||
/// 尝试获取类型
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="elementName"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
public static bool TryGetType(string context, out string elementName , out Type type)
|
||||
{
|
||||
int startIndex = context.IndexOf('<');
|
||||
int endIndex = context.IndexOf('>');
|
||||
if (startIndex < 0 || endIndex < 0 || startIndex > endIndex)
|
||||
{
|
||||
type = null;
|
||||
elementName = null;
|
||||
return false;
|
||||
}
|
||||
elementName = context.Substring(0,startIndex);
|
||||
type = context.Substring(startIndex + 1, endIndex - startIndex - 1).ToTypeOfString();
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 尝试获取下标
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="strIndexKey">文本形式的key/索引</param>
|
||||
/// <returns></returns>
|
||||
public static bool TryGetIndex(string context,out string elementName, out string strIndexKey)
|
||||
{
|
||||
int startIndex = context.IndexOf('[');
|
||||
int endIndex = context.IndexOf(']');
|
||||
if (startIndex < 0 || endIndex < 0 || startIndex > endIndex)
|
||||
{
|
||||
strIndexKey = null;
|
||||
elementName = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
elementName = context.Substring(0,startIndex);
|
||||
strIndexKey = context.Substring(startIndex + 1, endIndex - startIndex - 1);
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user