daily update on 20250122 by nitload youmu, architect rearrange

This commit is contained in:
Nitload
2025-01-22 11:34:49 +08:00
parent 6cfaa42ff3
commit 190d67a034
192 changed files with 25177 additions and 3156 deletions
@@ -1,6 +1,6 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="Blueprint.cs"
// file="BlueprintSchedueler.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
@@ -42,13 +42,13 @@ using System.Threading;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace StgSharp.BluePrint
namespace StgSharp.Blueprint
{
/// <summary>
/// A sets of complex logic designed for running in multi threads environment. Warning: do not
/// run a <see cref="Blueprint" /> instance in multi threads more than once.
/// run a <see cref="BlueprintSchedueler" /> instance in multi threads more than once.
/// </summary>
public partial class Blueprint : IConvertableToBlueprintNode
public partial class BlueprintSchedueler : IConvertableToBlueprintNode
{
private BeginningNode beginNode;
@@ -64,7 +64,7 @@ namespace StgSharp.BluePrint
internal int currentGlobalNodeIndex;
internal int currentNativeNodeIndex;
public Blueprint()
public BlueprintSchedueler()
{
allNode = new Dictionary<string, BlueprintNode>();
globalNodeList = new List<BlueprintNode>();
@@ -83,13 +83,22 @@ namespace StgSharp.BluePrint
get => runningStat.CurrentCount == 0;
}
/**/
internal Func<bool> ShouldClose
public ReadOnlySpan<string> InputInterfacesName
{
get => terminate;
set => terminate = value;
get { return beginNode.OutputInterfaces
.Select( p => p.Key )
.ToArray(); }
}
public ReadOnlySpan<string> OutputInterfacesName
{
get { return beginNode.OutputInterfaces
.Select( p => p.Key )
.ToArray(); }
}
/**/
internal SemaphoreSlim RunningStat
{
get => runningStat;
@@ -103,11 +112,17 @@ namespace StgSharp.BluePrint
allNode.Add( node.Name, node );
}
public void ExecuteMain(
in Dictionary<string, BlueprintPipeline> input,
in Dictionary<string, BlueprintPipeline> output )
in Dictionary<string, BlueprintPipeline> input,
in Dictionary<string, BlueprintPipeline> output )
{
BlueprintRunner.Run( this, () => true );
BlueprintRunner.Run( this );
}
public BlueprintNodeOperation Operation
{
get => ExecuteMain;
}
[MethodImpl( MethodImplOptions.AggressiveInlining )]
@@ -131,7 +146,7 @@ namespace StgSharp.BluePrint
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public void SetInput(
params (string name, BlueprintPipelineArgs arg)[] parameters )
params (string name, BlueprintPipelineArgs arg)[] parameters )
{
beginNode.InputData = parameters;
}
@@ -164,18 +179,9 @@ namespace StgSharp.BluePrint
return false;
}
string[] IConvertableToBlueprintNode.InputInterfacesName
~BlueprintSchedueler()
{
get { return beginNode.OutputInterfaces
.Select( p => p.Key )
.ToArray(); }
}
string[] IConvertableToBlueprintNode.OutputInterfacesName
{
get { return beginNode.OutputInterfaces
.Select( p => p.Key )
.ToArray(); }
runningStat.Dispose();
}
}
@@ -33,6 +33,7 @@ using StgSharp.Entities;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
@@ -41,7 +42,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace StgSharp.BluePrint
namespace StgSharp.Blueprint
{
/// <summary>
///
@@ -55,22 +56,26 @@ namespace StgSharp.BluePrint
#pragma warning restore CA1036
{
private protected bool levelAvailable, nativeRequested;
private static BlueprintNode _emptyNode = new BlueprintNode(
string.Empty, null!, false );
private static Dictionary<string, BlueprintPipeline> _emptyLayer = new();
private protected bool _levelAvailable, _nativeRequested;
private protected Dictionary<string, BlueprintPipeline> _inputInterfaces;
private protected Dictionary<string, BlueprintPipeline> _outputInterfaces;
private protected int _level;
private IConvertableToBlueprintNode mainOperation;
private string name;
private IConvertableToBlueprintNode _mainOperation;
private string _name;
internal BlueprintNode(
string name,
IConvertableToBlueprintNode node,
bool isNative )
string name,
IConvertableToBlueprintNode node,
bool isNative )
{
this.levelAvailable = false;
this.name = name;
nativeRequested = isNative;
mainOperation = node;
_levelAvailable = false;
_name = name;
_nativeRequested = isNative;
_mainOperation = node;
_inputInterfaces = new Dictionary<string, BlueprintPipeline>();
_outputInterfaces = new Dictionary<string, BlueprintPipeline>();
foreach( string portName in node.InputInterfacesName ) {
@@ -84,10 +89,11 @@ namespace StgSharp.BluePrint
#pragma warning disable CS8618
internal BlueprintNode(
string name,
bool isNative,
string[] inputPorts,
string[] outputPorts )
BlueprintNodeOperation operation,
string name,
bool isNative,
string[] inputPorts,
string[] outputPorts )
#pragma warning restore CS8618
{
if( ( inputPorts == null ) || ( inputPorts.Length == 0 ) ) {
@@ -96,30 +102,54 @@ namespace StgSharp.BluePrint
if( ( outputPorts == null ) || ( outputPorts.Length == 0 ) ) {
throw new ArgumentNullException( nameof( outputPorts ) );
}
levelAvailable = false;
this.name = name;
IsNative = isNative;
_levelAvailable = false;
_name = name;
_nativeRequested = isNative;
operation = operation ?? DefaultOperation;
_mainOperation = new DefaultConvertableToBlueprintNode(
operation,
inputPorts,
outputPorts);
_inputInterfaces = new Dictionary<string, BlueprintPipeline>();
_outputInterfaces = new Dictionary<string, BlueprintPipeline>();
foreach( string portName in inputPorts ) {
_inputInterfaces.Add( portName, null! );
_inputInterfaces.Add(
portName,
SealedBlueprintPiipeline.SealOutput( this, name ) );
}
foreach( string portName in outputPorts ) {
_outputInterfaces.Add( portName, null! );
}
}
protected static void DefaultOperation(
in Dictionary<string, BlueprintPipeline> input,
in Dictionary<string, BlueprintPipeline> output)
{
BlueprintPipeline.SkipAll(output);
}
public static BlueprintNode Empty
{
get => _emptyNode;
}
public bool IsNative
{
get => nativeRequested;
internal set => nativeRequested = value;
get => _nativeRequested;
internal set => _nativeRequested = value;
}
public static Dictionary<string, BlueprintPipeline> EmptyPortLayer
{
get => _emptyLayer;
}
public int Level
{
get
{
if( levelAvailable ) {
if( _levelAvailable ) {
return _level;
}
_level = 0;
@@ -127,16 +157,17 @@ namespace StgSharp.BluePrint
if( item.Value == null ) {
continue;
}
if( _level <= item.Value.Level ) {
if( _level < item.Value.Level ) {
_level = item.Value.Level;
}
}
_level += 1;
_levelAvailable = true;
return _level;
}
}
public string Name => name;
public string Name => _name;
internal Dictionary<string, BlueprintPipeline> InputInterfaces => _inputInterfaces;
@@ -144,15 +175,39 @@ namespace StgSharp.BluePrint
internal IConvertableToBlueprintNode Value
{
get => mainOperation;
get => _mainOperation;
}
public void AddAfter(
BlueprintNode former,
string formerOutputPortName,
string thisInputPortName )
public void Append(
[NotNull] BlueprintNode next,
string thisOutputPortName,
string afterInputPortName )
{
this.levelAvailable = false;
this._levelAvailable = false;
BlueprintPipeline pipeline = new BlueprintPipeline( this, next );
if( next is EndingNode enode ) {
enode.SetCertainInputPort( afterInputPortName, pipeline );
} else {
next.SetCertainInputPort( afterInputPortName, pipeline );
}
SetCertainOutputPort( thisOutputPortName, pipeline );
}
public int CompareTo( BlueprintNode other )
{
if( null == other ) {
throw new ArgumentNullException( nameof( other ) );
}
return this.Level.CompareTo( other.Level );
}
public void Prepend(
[NotNull] BlueprintNode former,
string formerOutputPortName,
string thisInputPortName )
{
this._levelAvailable = false;
BlueprintPipeline pipeline = new BlueprintPipeline( former, this );
if( former is BeginningNode bnode ) {
bnode.SetCertainOutputPort( formerOutputPortName, pipeline );
@@ -162,35 +217,13 @@ namespace StgSharp.BluePrint
SetCertainInputPort( thisInputPortName, pipeline );
}
public void AddBefore(
BlueprintNode after,
string thisOutputPortName,
string afterInputPortName )
{
this.levelAvailable = false;
BlueprintPipeline pipeline = new BlueprintPipeline( this, after );
if( after is EndingNode enode ) {
enode.SetCertainInputPort( afterInputPortName, pipeline );
} else {
after.SetCertainInputPort( afterInputPortName, pipeline );
}
SetCertainOutputPort( thisOutputPortName, pipeline );
}
public int CompareTo( BlueprintNode other )
{
#pragma warning disable CA1062
return this.Level.CompareTo( other.Level );
#pragma warning restore CA1062
}
public virtual void Run()
{
try {
//Console.WriteLine(name);
//Console.WriteLine(_name);
BlueprintPipeline.WaitAll( _inputInterfaces );
if( mainOperation != null ) {
mainOperation.ExecuteMain(
if( _mainOperation != null ) {
_mainOperation.Operation(
in _inputInterfaces, in _outputInterfaces );
}
}
@@ -201,43 +234,43 @@ namespace StgSharp.BluePrint
#region port operation
public BlueprintPipeline GetCertainInputPort( string name )
public BlueprintPipeline GetInputPort( string name )
{
BlueprintPipeline ret;
if( !_inputInterfaces.TryGetValue( name, out ret ) ) {
throw new Exception(
throw new ArgumentOutOfRangeException(
$"Cannot find the interface named {name} in node {Name}." );
}
return ret;
}
public BlueprintPipeline GetCertainOutputPort( string name )
public BlueprintPipeline GetOutputPort( string name )
{
BlueprintPipeline ret;
if( !_outputInterfaces.TryGetValue( name, out ret ) ) {
throw new Exception(
throw new ArgumentOutOfRangeException(
$"Cannot find the interface named {name} in node {Name}." );
}
return ret;
}
public void SetCertainInputPort(
string name,
BlueprintPipeline pipeline )
string name,
BlueprintPipeline pipeline )
{
if( !_inputInterfaces.ContainsKey( name ) ) {
throw new Exception(
throw new ArgumentException(
$"Cannot find the interface named {name} in node {Name}." );
}
_inputInterfaces[ name ] = pipeline;
}
public void SetCertainOutputPort(
string name,
BlueprintPipeline pipeline )
string name,
BlueprintPipeline pipeline )
{
if( !_outputInterfaces.ContainsKey( name ) ) {
throw new Exception(
throw new ArgumentOutOfRangeException(
$"Cannot find the interface named {name} in node {Name}." );
}
_outputInterfaces[ name ] = pipeline;
@@ -250,8 +283,8 @@ namespace StgSharp.BluePrint
{
protected BlueprintNodeRunException(
SerializationInfo info,
StreamingContext context )
SerializationInfo info,
StreamingContext context )
: base( info, context ) { }
public BlueprintNodeRunException() { }
@@ -262,8 +295,8 @@ namespace StgSharp.BluePrint
public BlueprintNodeRunException( string message ) : base( message ) { }
public BlueprintNodeRunException(
string message,
Exception innerException )
string message,
Exception innerException )
: base( message, innerException ) { }
}
@@ -0,0 +1,58 @@
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="BlueprintNodeCraeater.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Blueprint
{
public partial class BlueprintSchedueler
{
public BlueprintNode CreateBlueprintNode(
string name,
BlueprintNodeOperation operation,
string[] inputPort,
string[] outputPort,
bool isNative )
{
BlueprintNode node = new BlueprintNode(
operation, name, isNative, inputPort, outputPort );
if( isNative ) {
nativeNodeList.Add( node );
} else {
globalNodeList.Add( node );
}
return node;
}
}
}
@@ -42,25 +42,36 @@ using System.Threading;
using System.Threading.Tasks;
namespace StgSharp.BluePrint
namespace StgSharp.Blueprint
{
public static class BlueprintRunner
{
private static NodeRunner[] allAvailableTask = new NodeRunner[1];
private static CancellationTokenSource cts = new CancellationTokenSource(
);
private static ConcurrentStack<Blueprint> blueprintInWaiting = new ConcurrentStack<Blueprint>(
);
private static NodeRunner[] allAvailableTask = CreateBlueprintRunnerArray();
private static CancellationTokenSource cts = new CancellationTokenSource();
private static ConcurrentStack<BlueprintSchedueler> blueprintInWaiting
= new ConcurrentStack<BlueprintSchedueler>();
private static int _callingThread;
private static SemaphoreSlim bpLock = new SemaphoreSlim( 0, 1 );
private static NodeRunner[] CreateBlueprintRunnerArray()
{
int count = Environment.ProcessorCount;
return new NodeRunner[ count < 2 ? count : count - 2];
}
/// <summary>
/// Only the fallowing occasions of calling are valid:
/// 1. no bp is running or the only bp is quitting.
/// 2. calling from the main thread and the current running bp.
/// </summary>
internal static bool IsValidCalling
{
get
{
if( ( NodeRunner.CurrentBlueprint == null ) || //no bp running at all
( ( blueprintInWaiting.Count == 0 ) && ( NodeRunner.CurrentBlueprint.IsRunning == false ) ) ) // a bp is quiting
( ( blueprintInWaiting.IsEmpty ) && ( NodeRunner.CurrentBlueprint.IsRunning == false ) ) )
// a bp is quiting
{
//in case no bp is running
return true;
@@ -68,9 +79,7 @@ namespace StgSharp.BluePrint
int? id = Task.CurrentId;
if( id is null ) {
// in case calling from main thread and current running bp
//Console.WriteLine($"\t{_callingThread}");
//Console.WriteLine($"\t{Thread.CurrentThread.ManagedThreadId}");
return _callingThread == Thread.CurrentThread.ManagedThreadId;
return _callingThread == Environment.CurrentManagedThreadId;
}
foreach( NodeRunner item in allAvailableTask ) {
if( item.Id == id ) {
@@ -82,34 +91,27 @@ namespace StgSharp.BluePrint
}
}
public static void Run(
Blueprint blueprint,
Func<bool> terminateInstructor )
public static void Run(BlueprintSchedueler blueprint)
{
//Console.WriteLine();
if( blueprint == null ) {
return;
}
if( terminateInstructor == null ) {
throw new ArgumentNullException( nameof( terminateInstructor ) );
}
if( blueprint.IsRunning ) {
throw new InvalidOperationException(
"Attempt to run a blueprint instance twice." );
}
blueprint.ShouldClose = terminateInstructor;
if( IsValidCalling ) {
//Console.WriteLine("valid and run");
if( InterruptAndRunNewBp( blueprint ) ) {
do { } while (InterruptAndRunNewBp(
NodeRunner.CurrentBlueprint ));
while (InterruptAndRunNewBp(
NodeRunner.CurrentBlueprint )){ };
}
} else {
bpLock.Wait();
if( InterruptAndRunNewBp( blueprint ) ) {
do { } while (InterruptAndRunNewBp(
NodeRunner.CurrentBlueprint ));
while (InterruptAndRunNewBp(
NodeRunner.CurrentBlueprint)) { }
}
bpLock.Release();
@@ -139,13 +141,13 @@ namespace StgSharp.BluePrint
foreach( NodeRunner task in allAvailableTask ) {
task.Cts.Cancel();
}
foreach( Blueprint bp in blueprintInWaiting ) {
foreach( BlueprintSchedueler bp in blueprintInWaiting ) {
bp.Terminate();
}
blueprintInWaiting.Clear();
}
internal static bool InterruptAndRunNewBp( Blueprint newBp )
internal static bool InterruptAndRunNewBp( BlueprintSchedueler newBp )
{
Debug.Assert( newBp != null );
if( ( newBp != NodeRunner.CurrentBlueprint ) && ( NodeRunner.CurrentBlueprint != null ) ) {
@@ -156,12 +158,11 @@ namespace StgSharp.BluePrint
//load new bp to current bp
Interlocked.Exchange( ref NodeRunner.CurrentBlueprint!, newBp );
Interlocked.Exchange(
ref _callingThread, Thread.CurrentThread.ManagedThreadId );
ref _callingThread, Environment.CurrentManagedThreadId );
//run beginning node to init it first.
if( !NodeRunner.CurrentBlueprint.IsRunning ) {
( NodeRunner.CurrentBlueprint.BeginLayer as BeginningNode )!.Run(
);
( NodeRunner.CurrentBlueprint.BeginLayer as BeginningNode )!.Run();
}
//refresh all tasks
@@ -188,7 +189,7 @@ namespace StgSharp.BluePrint
internal class NodeRunner : CancellableTask
{
private static Blueprint _current;
private static BlueprintSchedueler _current;
internal NodeRunner()
: base()
@@ -196,7 +197,7 @@ namespace StgSharp.BluePrint
_startup = InternalRun;
}
internal static ref Blueprint CurrentBlueprint
internal static ref BlueprintSchedueler CurrentBlueprint
{
get => ref _current;
}
@@ -28,7 +28,7 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.BluePrint;
using StgSharp.Blueprint;
using System;
using System.Collections.Generic;
@@ -36,14 +36,13 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace StgSharp.BluePrint
namespace StgSharp.Blueprint
{
public class CrossFrameOperation : IConvertableToBlueprintNode
{
private int currentCount;
private readonly int cycleCount;
private Action _mainExecution;
public CrossFrameOperation( Action startup, int cycleCount )
{
@@ -57,13 +56,17 @@ namespace StgSharp.BluePrint
public Action MainExecution
{
get;
private protected set;
get => _mainExecution;
private protected set => _mainExecution = value;
}
public static string InputInterfacesName => "TaskIn";
private static string[] _inputName = ["TaskIn"];
private static string[] _outputName = ["TaskOut"];
public static string OutputInterfacesName => "TaskOut";
public BlueprintNodeOperation Operation
{
get => ExecuteMain;
}
public void ExecuteMain(
in Dictionary<string, BlueprintPipeline> input,
@@ -80,9 +83,9 @@ namespace StgSharp.BluePrint
BlueprintPipeline.SkipAll( output );
}
string[] IConvertableToBlueprintNode.InputInterfacesName => [InputInterfacesName];
public ReadOnlySpan<string> InputInterfacesName => _inputName;
string[] IConvertableToBlueprintNode.OutputInterfacesName => [OutputInterfacesName];
public ReadOnlySpan<string> OutputInterfacesName => _outputName;
}
}
@@ -33,7 +33,7 @@ using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;
namespace StgSharp.BluePrint
namespace StgSharp.Blueprint
{
public delegate void BlueprintNodeOperation(
in Dictionary<string, BlueprintPipeline> input,
@@ -41,24 +41,17 @@ namespace StgSharp.BluePrint
public interface IConvertableToBlueprintNode
{
#pragma warning disable CA1819
public string[] InputInterfacesName
public ReadOnlySpan<string> InputInterfacesName
{
get;
}
#pragma warning restore CA1819
#pragma warning disable CA1819
public string[] OutputInterfacesName
public ReadOnlySpan<string> OutputInterfacesName
{
get;
}
#pragma warning restore CA1819
[MethodImpl( MethodImplOptions.AggressiveInlining )]
public void ExecuteMain(
in Dictionary<string, BlueprintPipeline> input,
in Dictionary<string, BlueprintPipeline> output );
BlueprintNodeOperation Operation { get; }
}
@@ -79,16 +72,11 @@ namespace StgSharp.BluePrint
_execution = execution;
}
void IConvertableToBlueprintNode.ExecuteMain(
in Dictionary<string, BlueprintPipeline> input,
in Dictionary<string, BlueprintPipeline> output )
{
_execution( in input, in output );
}
public BlueprintNodeOperation Operation => _execution;
string[] IConvertableToBlueprintNode.InputInterfacesName => _input;
public ReadOnlySpan<string> InputInterfacesName => _input;
string[] IConvertableToBlueprintNode.OutputInterfacesName => _output;
public ReadOnlySpan<string> OutputInterfacesName => _output;
}
}
@@ -38,15 +38,15 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace StgSharp.BluePrint
namespace StgSharp.Blueprint
{
public class BlueprintPipeline
{
private BlueprintNode after;
private BlueprintNode former;
private BlueprintPipelineArgs args;
private SemaphoreSlim formerCompleteSemaphore;
private protected BlueprintNode after;
private protected BlueprintNode former;
private protected BlueprintPipelineArgs args;
private protected SemaphoreSlim formerCompleteSemaphore;
public BlueprintPipeline( BlueprintNode former, BlueprintNode after )
{
@@ -72,7 +72,7 @@ namespace StgSharp.BluePrint
Dictionary<string, BlueprintPipeline> ports )
{
if( ports == null ) {
throw new ArgumentNullException( nameof( ports ) );
return;
}
foreach( KeyValuePair<string, BlueprintPipeline> item in ports ) {
if( item.Value != null ) {
@@ -85,7 +85,7 @@ namespace StgSharp.BluePrint
Dictionary<string, BlueprintPipeline> ports )
{
if( ports == null ) {
throw new ArgumentNullException( nameof( ports ) );
return;
}
foreach( KeyValuePair<string, BlueprintPipeline> item in ports ) {
if( item.Value != null ) {
@@ -94,7 +94,7 @@ namespace StgSharp.BluePrint
}
}
public void WaitForStart()
public virtual void WaitForStart()
{
//Console.WriteLine($"Waiting \t{former.ContextName}\t->\t{after.ContextName}");
formerCompleteSemaphore.Wait();
@@ -126,12 +126,39 @@ namespace StgSharp.BluePrint
public abstract class BlueprintPipelineArgs
{
public object? Value
{
get;
set;
}
public object? ValueDefault
{
get;
}
}
public sealed class SealedBlueprintPiipeline:BlueprintPipeline
{
internal SealedBlueprintPiipeline(BlueprintNode former, BlueprintNode after):
base(former, after)
{
}
public static SealedBlueprintPiipeline SealOutput(BlueprintNode node, string portName)
{
return new SealedBlueprintPiipeline(node, BlueprintNode.Empty);
}
public static SealedBlueprintPiipeline SealInput(BlueprintNode node, string portName)
{
return new SealedBlueprintPiipeline(BlueprintNode.Empty, node);
}
public sealed override void WaitForStart()
{
}
}
}
@@ -35,7 +35,7 @@ using System.Reflection.Emit;
using System.Security.Cryptography.X509Certificates;
using System.Text;
namespace StgSharp.BluePrint
namespace StgSharp.Blueprint
{
public class RouteSwitch : BlueprintNode
{
@@ -43,7 +43,7 @@ namespace StgSharp.BluePrint
private protected Dictionary<string, (BlueprintPipeline pipeline, Func<bool> openingRule)> outputDictionary;
public RouteSwitch( string name, bool isNative, string inputPorts )
: base( name, isNative, [inputPorts], [string.Empty] )
: base(DefaultOperation, name, isNative, [inputPorts], [string.Empty] )
{
outputDictionary = new Dictionary<string, (BlueprintPipeline pipeline, Func<bool> openingRule)>(
);
@@ -53,7 +53,7 @@ namespace StgSharp.BluePrint
{
get
{
if( levelAvailable ) {
if( _levelAvailable ) {
return _level;
}
_level = 0;
@@ -37,15 +37,15 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace StgSharp.BluePrint
namespace StgSharp.Blueprint
{
internal sealed class BeginningNode : BlueprintNode
{
private Blueprint _bp;
private BlueprintSchedueler _bp;
public BeginningNode( Blueprint bp )
: base( name: "BeginningNode", true, ["default"], ["default"] )
public BeginningNode( BlueprintSchedueler bp )
: base(DefaultOperation, name: "BeginningNode", true, ["default"], ["default"] )
{
_bp = bp;
}
@@ -84,10 +84,10 @@ namespace StgSharp.BluePrint
internal sealed class EndingNode : BlueprintNode
{
private Blueprint _bp;
private BlueprintSchedueler _bp;
public EndingNode( Blueprint bp )
: base( name: "EndingNode", true, ["default"], ["default"] )
public EndingNode( BlueprintSchedueler bp )
: base(DefaultOperation, name: "EndingNode", true, ["default"], ["default"] )
{
_bp = bp;
}