daily uodate on 20240626 by nitload youmu

This commit is contained in:
Nitload
2024-06-26 07:33:12 +08:00
parent b2cb0cbddf
commit 8f9f1c4012
44 changed files with 722 additions and 383 deletions
+23 -19
View File
@@ -52,26 +52,26 @@ namespace StgSharp.Logic
/// </summary>
public partial class Blueprint : IConvertableToBlueprintNode
{
private int runningFlag;
private BeginningNode beginNode;
private Dictionary<string, BlueprintNode> allNode;
private EndingNode endNode;
private Func<bool> terminate;
private List<BlueprintNode> globalNodeList;
private List<BlueprintNode> nativeNodeList;
private SemaphoreSlim runningStat;
internal int currentGlobalNodeIndex;
internal int currentNativeNodeIndex;
private List<BlueprintNode> nativeNodeList;
private List<BlueprintNode> globalNodeList;
public Blueprint()
{
allNode = new Dictionary<string, BlueprintNode>();
globalNodeList = new List<BlueprintNode>();
nativeNodeList = new List<BlueprintNode>();
//terminate = () => true;
runningStat = new SemaphoreSlim(1, 1);
beginNode = new BeginningNode(this);
endNode = new EndingNode(this);
}
@@ -79,10 +79,14 @@ namespace StgSharp.Logic
public BlueprintNode BeginLayer => beginNode;
public BlueprintNode EndLayer => endNode;
internal SemaphoreSlim RunningStat
{
get => runningStat;
}
public bool IsRunning
{
get => runningFlag == 1;
internal set => Interlocked.Exchange(ref runningFlag ,(value ? 1 : 0));
get => runningStat.CurrentCount == 0;
}
/**/
@@ -100,6 +104,12 @@ namespace StgSharp.Logic
allNode.Add(node.Name, node);
}
public void ExecuteMain(in Dictionary<string, BlueprintPipeline> input,
in Dictionary<string, BlueprintPipeline> output)
{
BlueprintRunner.Run(this, () => true);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public (string name, BlueprintPipelineArgs arg)[] GetOutput()
{
@@ -123,18 +133,18 @@ namespace StgSharp.Logic
globalNodeList.Sort();
}
public void ExecuteMain(in Dictionary<string, BlueprintPipeline> input,
in Dictionary<string, BlueprintPipeline> output)
{
BlueprintRunner.Run(this, () => true);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetInput(params (string name, BlueprintPipelineArgs arg)[] parameters)
{
beginNode.InputData = parameters;
}
public void Terminate()
{
Interlocked.Exchange(ref currentGlobalNodeIndex, int.MaxValue);
Interlocked.Exchange(ref currentNativeNodeIndex, int.MaxValue);
}
internal bool RequestNexGlobalNode(out BlueprintNode node)
{
if (currentGlobalNodeIndex < globalNodeList.Count)
@@ -170,12 +180,6 @@ namespace StgSharp.Logic
get { return beginNode.OutputInterfaces.Select(p => p.Key).ToArray(); }
}
public void Terminate()
{
Interlocked.Exchange(ref currentGlobalNodeIndex, int.MaxValue);
Interlocked.Exchange(ref currentNativeNodeIndex, int.MaxValue);
}
}
}