コード例 #1
0
 /// <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));
 }
コード例 #2
0
        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;
        }
コード例 #3
0
 /// <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);
コード例 #4
0
        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;
        }