mirror of
https://github.com/revenz/FileFlowsPlugins.git
synced 2026-02-25 15:28:26 -06:00
added goto flow node
This commit is contained in:
@@ -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": {
|
||||
|
||||
24
BasicNodes/Functions/GotoFlow.cs
Normal file
24
BasicNodes/Functions/GotoFlow.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
30
BasicNodes/Tests/ExecutorTests.cs
Normal file
30
BasicNodes/Tests/ExecutorTests.cs
Normal 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
|
||||
Reference in New Issue
Block a user