using FileFlows.Plugin;
using FileFlows.Plugin.Attributes;
using System.ComponentModel.DataAnnotations;
namespace FileFlows.BasicNodes.Functions;
///
/// A special flow element that iterates all files in a folder and process them through a sub flow
///
public class FolderIterator : Node
{
///
public override int Inputs => 1;
///
public override int Outputs => 1;
///
public override FlowElementType Type => FlowElementType.Process;
///
public override string HelpUrl => "https://fileflows.com/docs/plugins/basic-nodes/folder-iterator";
///
public override string Icon => "fas fa-sitemap";
///
public override string CustomColor => "var(--flow-subflow)";
///
/// Gets or sets the flow to execute
///
[Select("SUB_FLOW_LIST", 1)]
public ObjectReference? Flow { get; set; }
///
/// Gets or sets the folder to iterate
///
[Required]
[Folder(2)]
public string? Folder { get; set; }
///
/// Gets or set the pattern to iterate over
///
[Text(3)]
public string? Pattern { get; set; }
///
/// Gets or sets if all files or just the top directory files should be iterated over
///
[Boolean(4)]
public bool Recursive { get; set; }
///
public override int Execute(NodeParameters args)
{
args.Logger?.ELog("Should not be called here, but directly from the runner.");
return -1;
}
}