using System.ComponentModel; using FileFlows.Plugin; using FileFlows.Plugin.Attributes; namespace FileFlows.BasicNodes.Conditions; /// /// A flow element that test if a string matches another string /// public class IfString: IfBase { /// /// Gets or sets the URL to the help page /// public override string HelpUrl => "https://fileflows.com/docs/plugins/basic-nodes/conditions/if-string"; /// /// Gets the number of outputs /// [DefaultValue(2)] [NumberInt(2)] public new int Outputs { get; set; } /// /// Gets or sets the options the variable can match /// [StringArray(3)] public string[] Options { get; set; } /// /// Checks the variable value /// /// the node parameters /// the variable value /// true if matches, otherwise false protected override int DoCheck(NodeParameters args, object value) { args?.Logger?.ILog("Value is: " + (value == null ? "null" : value.ToString())); if (Options?.Any() != true) { args.FailureReason = "No Options configured"; args.Logger?.ELog(args.FailureReason); return -1; } for(int i=0;i x?.EmptyAsNull() == strValue?.EmptyAsNull()); args.Logger?.ILog("Index of option: " + index); if (index >= 0) return index + 1; // index is then -1 args.Logger?.ELog("Failed to locate value in options"); args.FailureReason = "Failed to locate value in options: " + strValue; return index; } }