修改了流程运行中的bug

This commit is contained in:
fengjiayi
2024-10-28 21:52:45 +08:00
parent 561b6d764f
commit 66141533b1
27 changed files with 518 additions and 373 deletions

View File

@@ -0,0 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Version>1.0.0</Version>
<!--<TargetFrameworks>net8.0</TargetFrameworks>-->
<BaseOutputPath>D:\Project\C#\DynamicControl\SereinFlow\.Output</BaseOutputPath>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Title>SereinFow</Title>
<Description>基础节点</Description>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/fhhyyp/serein-flow</RepositoryUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Library\Serein.Library.csproj" />
</ItemGroup>
<ItemGroup>
<None Include="..\LICENSE">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<None Include="..\README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,52 @@
using Serein.Library;
using Serein.Library.Api;
using Serein.Library.Utils.SereinExpression;
namespace Serein.BaseNode
{
public enum ExpType
{
Get,
Set
}
[DynamicFlow(Name ="基础节点")]
internal class SereinBaseNodes
{
[NodeAction(NodeType.Action,"条件节点")]
private bool SereinConditionNode(IDynamicContext context,
object targetObject,
string exp = "ISPASS")
{
var isPass = SereinConditionParser.To(targetObject, exp);
context.NextOrientation = isPass ? ConnectionInvokeType.IsSucceed : ConnectionInvokeType.IsFail;
return isPass;
}
[NodeAction(NodeType.Action, "表达式节点")]
private object SereinExpNode(IDynamicContext context,
object targetObject,
string exp)
{
exp = "@" + exp;
var newData = SerinExpressionEvaluator.Evaluate(exp, targetObject, out bool isChange);
object result;
if (isChange || exp.StartsWith("@GET",System.StringComparison.OrdinalIgnoreCase))
{
result = newData;
}
else
{
result = targetObject;
}
context.NextOrientation = ConnectionInvokeType.IsSucceed;
return result;
}
}
}