mirror of
https://github.com/revenz/FileFlowsPlugins.git
synced 2026-02-14 14:59:25 -06:00
new flow elements
This commit is contained in:
@@ -34,7 +34,6 @@ public class Delete : Node
|
||||
/// </summary>
|
||||
[TextVariable(1)] public string FileName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Executes the flow element
|
||||
/// </summary>
|
||||
@@ -46,7 +45,6 @@ public class Delete : Node
|
||||
if (string.IsNullOrEmpty(path))
|
||||
path = args.WorkingFile;
|
||||
|
||||
|
||||
if (args.FileService.DirectoryExists(path).Is(true))
|
||||
{
|
||||
try
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using FileFlows.Plugin;
|
||||
|
||||
namespace FileFlows.BasicNodes.File;
|
||||
@@ -5,7 +6,7 @@ namespace FileFlows.BasicNodes.File;
|
||||
/// <summary>
|
||||
/// Basic Input file, the default input node
|
||||
/// </summary>
|
||||
public class InputFile : Node
|
||||
public partial class InputFile : Node
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the number of outputs
|
||||
@@ -31,6 +32,11 @@ public class InputFile : Node
|
||||
/// <returns>the output to call next</returns>
|
||||
public override int Execute(NodeParameters args)
|
||||
{
|
||||
if (UrlRegex().IsMatch(args.WorkingFile))
|
||||
{
|
||||
args.Logger?.ILog("URL Detected: " + args.WorkingFile);
|
||||
return 1;
|
||||
}
|
||||
try
|
||||
{
|
||||
if(args.FileService.FileExists(args.WorkingFile).Is(true) == false)
|
||||
@@ -49,4 +55,11 @@ public class InputFile : Node
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Regex to detect a URL
|
||||
/// </summary>
|
||||
/// <returns>the URL regex</returns>
|
||||
[GeneratedRegex("^http(s)://", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant)]
|
||||
private static partial Regex UrlRegex();
|
||||
}
|
||||
25
BasicNodes/Functions/CompleteFlow.cs
Normal file
25
BasicNodes/Functions/CompleteFlow.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using FileFlows.Plugin;
|
||||
|
||||
namespace FileFlows.BasicNodes.Functions;
|
||||
|
||||
/// <summary>
|
||||
/// A flow element that simply completes/finishes a flow
|
||||
/// </summary>
|
||||
public class CompleteFlow : Node
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override int Inputs => 1;
|
||||
/// <inheritdoc />
|
||||
public override FlowElementType Type => FlowElementType.Logic;
|
||||
/// <inheritdoc />
|
||||
public override string Icon => "fas fa-check-square";
|
||||
/// <inheritdoc />
|
||||
public override string HelpUrl => "https://fileflows.com/docs/plugins/basic-nodes/complete-flow";
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string CustomColor => "var(--success)";
|
||||
|
||||
/// <inheritdoc />
|
||||
public override int Execute(NodeParameters args)
|
||||
=> 0;
|
||||
}
|
||||
46
BasicNodes/Functions/ListIterator.cs
Normal file
46
BasicNodes/Functions/ListIterator.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System.ComponentModel;
|
||||
using FileFlows.Plugin;
|
||||
using FileFlows.Plugin.Attributes;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace FileFlows.BasicNodes.Functions;
|
||||
|
||||
/// <summary>
|
||||
/// A special flow element that iterates all strings in a list and process them through a sub flow
|
||||
/// </summary>
|
||||
public class ListIterator : Node
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override int Inputs => 1;
|
||||
/// <inheritdoc />
|
||||
public override int Outputs => 1;
|
||||
/// <inheritdoc />
|
||||
public override FlowElementType Type => FlowElementType.Process;
|
||||
/// <inheritdoc />
|
||||
public override string HelpUrl => "https://fileflows.com/docs/plugins/basic-nodes/list-iterator";
|
||||
/// <inheritdoc />
|
||||
public override string Icon => "fas fa-sitemap";
|
||||
/// <inheritdoc />
|
||||
public override string CustomColor => "var(--flow-subflow)";
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the flow to execute
|
||||
/// </summary>
|
||||
[Select("SUB_FLOW_LIST", 1)]
|
||||
public ObjectReference? Flow { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the list to iterate
|
||||
/// </summary>
|
||||
[Required]
|
||||
[TextVariable(2)]
|
||||
[DefaultValue("{CurrentList}")]
|
||||
public string? List { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public override int Execute(NodeParameters args)
|
||||
{
|
||||
args.Logger?.ELog("Should not be called here, but directly from the runner.");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,13 @@ public class WebRequest : Node
|
||||
/// <inheritdoc />
|
||||
public override string HelpUrl => "https://fileflows.com/docs/plugins/basic-nodes/web-request";
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool Obsolete => true;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string ObsoleteMessage =>
|
||||
"This flow element has been replaced by the Web Request flow element in the Web plugin. This flow element will be removed in a future update.";
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the URL
|
||||
/// </summary>
|
||||
|
||||
@@ -97,6 +97,9 @@
|
||||
"Code": "Code"
|
||||
}
|
||||
},
|
||||
"CompleteFlow": {
|
||||
"Description": "Completes/ends the flow as successful"
|
||||
},
|
||||
"CopyFile": {
|
||||
"Description": "Copies a file to the destination folder",
|
||||
"Outputs": {
|
||||
@@ -245,6 +248,18 @@
|
||||
"Recursive-Help": "If files in all sub directories should also be iterated, or if only the top level files should be iterated."
|
||||
}
|
||||
},
|
||||
"ListIterator": {
|
||||
"Description": "Iterates all strings in a given list and executes those strings against a sub flow.",
|
||||
"Outputs": {
|
||||
"1": "List iterated"
|
||||
},
|
||||
"Fields": {
|
||||
"Flow": "Flow",
|
||||
"Flow-Help": "The sub flow to execute the strings against.",
|
||||
"List": "List",
|
||||
"List-Help": "A name of a variable containing the list to iterate."
|
||||
}
|
||||
},
|
||||
"FailFlow": {
|
||||
"Description": "Fails a flow immediately, useful if you want a certain path to just fail.",
|
||||
"Fields": {
|
||||
|
||||
Reference in New Issue
Block a user