/// <summary> /// Returns true if it can handle the path, false otherwise /// </summary> /// <param name="Path">The path to check against</param> /// <returns>True if it can handle the path, false otherwise</returns> public bool CanHandle(string Path) { return(HandleRegex.IsMatch(Path)); }
public object TryRegexForVar(IList<string> directories, string regex, HandleRegex handleRegex) { foreach (var path in directories) { Match m = Regex.Match(path, regex); if (m.Success) { if(handleRegex != null) { return handleRegex.Invoke(m.Groups[1].Value); } return m.Groups[1].Value; } } return null; }
/// <summary> /// Returns true if it can handle the path, false otherwise /// </summary> /// <param name="path">The path to check against</param> /// <returns>True if it can handle the path, false otherwise</returns> public bool CanHandle(string path) => !string.IsNullOrEmpty(path) && HandleRegex.IsMatch(path);
public object TryRegexesForVar(IList<string> directories, IList<string> regexes, HandleRegex handleRegex = null) { foreach (var regex in regexes) { var result = TryRegexForVar(directories, regex, handleRegex); if (result != null) return result; } return null; }