Files
stgsharp/源代码/StgSharp/Logic/Blueprint/SideNode.cs
T

86 lines
2.2 KiB
C#

using StgSharp.Logic;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StgSharp.Logic
{
internal sealed class BeginningNode : BlueprintNode
{
public BeginningNode() : base(name: "BeginningNode", null,
true, ["default"], ["default"]
)
{ }
internal (string name, BlueprintPipelineArgs arg)[] InputData
{
set
{
if (value == null)
{
return;
}
foreach (var parameter in value)
{
OutputInterfaces[parameter.name].Args = parameter.arg;
}
}
}
public new void SetCertainOutputPort(string name, BlueprintPipeline pipeline)
{
if (_outputInterfaces.ContainsKey(name))
{
_outputInterfaces[name] = pipeline;
}
_outputInterfaces.Add(name, pipeline);
}
public new void Run()
{
BlueprintPipeline.SkipAll(_outputInterfaces);
}
}
internal sealed class EndingNode : BlueprintNode
{
public EndingNode() : base(name: "EndingNode",
operation: (
in Dictionary<string, BlueprintPipeline> input,
in Dictionary<string, BlueprintPipeline> output
) =>
{
},
true, ["default"], ["default"]
)
{ }
internal (string name, BlueprintPipelineArgs arg)[] OutputData
{
get
{
return InputInterfaces.Select(
key => (key.Key, key.Value.Args)).
ToArray();
}
}
public new void SetCertainInputPort(string name, BlueprintPipeline pipeline)
{
if (_inputInterfaces.ContainsKey(name))
{
_inputInterfaces[name] = pipeline;
}
_inputInterfaces.Add(name, pipeline);
}
public new void Run()
{
BlueprintPipeline.WaitAll(_inputInterfaces);
}
}
}