FF-1770: Updated Matches to use stringhelper

This commit is contained in:
John Andrews
2024-09-11 13:04:02 +12:00
parent aef63182e1
commit 05c0002254
3 changed files with 2 additions and 20 deletions

View File

@@ -2,8 +2,6 @@ using FileFlows.Plugin;
using FileFlows.Plugin.Attributes;
using System.ComponentModel.DataAnnotations;
using System.Text.RegularExpressions;
using FileFlows.BasicNodes.Helpers;
using FileFlows.Plugin.Helpers;
namespace FileFlows.BasicNodes.Functions;
@@ -52,26 +50,10 @@ public class Matches : Node
value = varValue;
else
value = args.ReplaceVariables(match.Key, stripMissing: true);
string strValue = value?.ToString()?.Trim() ?? string.Empty;
args.Logger?.ILog("Testing match value: " + strValue);
if (Regex.IsMatch(match.Value ??string.Empty, "^(true|1)$", RegexOptions.IgnoreCase) &&
Regex.IsMatch(strValue, "^(true|1)$", RegexOptions.IgnoreCase))
{
args.Logger?.ILog($"Match found '{match.Value}' = {strValue}");
return output;
}
if (Regex.IsMatch(match.Value ??string.Empty, "^(false|0)$", RegexOptions.IgnoreCase) &&
Regex.IsMatch(strValue, "^(false|0)$", RegexOptions.IgnoreCase))
{
args.Logger?.ILog($"Match found '{match.Value}' = {strValue}");
return output;
}
if (args.MathHelper.IsMathOperation(match.Value))
{
string strValue = value?.ToString()?.Trim() ?? string.Empty;
if (args.MathHelper.IsTrue(match.Value, strValue))
{
args.Logger?.ILog($"Match found '{match.Value}' = {strValue}");
@@ -79,7 +61,7 @@ public class Matches : Node
}
}
if (args.StringHelper.Matches(match.Value, strValue))
if (args.StringHelper.Matches(match.Value, value))
return output;
}
catch (Exception)

Binary file not shown.

Binary file not shown.