added goto flow node

This commit is contained in:
reven
2022-01-01 14:48:16 +13:00
parent 58fec18194
commit e5f843c871
3 changed files with 60 additions and 0 deletions

View File

@@ -83,6 +83,12 @@
"Code-Help": "return -1 for error and flow to stop\nreturn 0 for flow to complete\nreturn 1 or more for the desired output to be called"
}
},
"GotoFlow": {
"Description": "This lets you switch to a different flow to process. This flow will exit and the parameters and working file will be passed into the new Flow",
"Fields": {
"Flow": "Flow"
}
},
"Log": {
"Description": "Logs a message to the flow log",
"Fields": {

View File

@@ -0,0 +1,24 @@
namespace FileFlows.BasicNodes.Functions
{
using FileFlows.Plugin;
using FileFlows.Plugin.Attributes;
public class GotoFlow : Node
{
public override int Inputs => 1;
public override int Outputs => 0;
public override FlowElementType Type => FlowElementType.Logic;
public override string Icon => "fas fa-sitemap";
[Select("FLOW_LIST", 1)]
public ObjectReference Flow { get; set; }
public override int Execute(NodeParameters args)
{
args.GotoFlow(Flow);
return 0;
}
}
}

View File

@@ -0,0 +1,30 @@
#if(DEBUG)
namespace BasicNodes.Tests
{
using FileFlows.BasicNodes.File;
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public class ExecutorTests
{
[TestMethod]
public void Executor_OutputVariable()
{
var logger = new TestLogger();
var args = new FileFlows.Plugin.NodeParameters(@"c:\test\testfile.mkv", logger, false, string.Empty);
Executor node = new Executor();
string file = @"D:\Videos\dummy.mkv";
node.FileName = @"C:\utils\ffmpeg\ffmpeg.exe";
node.Arguments = "-i \"" + file + "\"";
node.OutputVariable = "ExecOutput";
var result = node.Execute(args);
Assert.IsTrue(args.Variables.ContainsKey("ExecOutput"));
string output = args.Variables["ExecOutput"] as string;
Assert.IsNotNull(output);
}
}
}
#endif