From 129ac1bb78b67373b6456b39cd5baf4162affc7d Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Mon, 22 Mar 2021 01:18:49 -0700 Subject: [PATCH] More granular on path search --- BurnOutSharp/Matching/PathMatch.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/BurnOutSharp/Matching/PathMatch.cs b/BurnOutSharp/Matching/PathMatch.cs index fafe9fcc..ba9b702c 100644 --- a/BurnOutSharp/Matching/PathMatch.cs +++ b/BurnOutSharp/Matching/PathMatch.cs @@ -12,9 +12,15 @@ namespace BurnOutSharp.Matching /// public string Needle { get; set; } - public PathMatch(string needle) + /// + /// Match that values end with the needle and not just contains + /// + public bool UseEndsWith { get; set; } + + public PathMatch(string needle, bool useEndsWith = false) { Needle = needle; + UseEndsWith = useEndsWith; } #region Matching @@ -31,7 +37,9 @@ namespace BurnOutSharp.Matching foreach (string stackItem in stack) { - if (stackItem.Contains(Needle)) + if (UseEndsWith && stackItem.EndsWith(Needle)) + return (true, stackItem); + else if (!UseEndsWith && stackItem.Contains(Needle)) return (true, stackItem); }