/// <summary> /// Shoulds the file be processed. /// </summary> /// <remarks> /// http://www.codeproject.com/KB/recipes/wildcardtoregex.aspx /// </remarks> /// <param name="fileNameBeingProcessed">The file.</param> /// <returns></returns> public bool ShouldProcess(string fileNameBeingProcessed) { if (string.IsNullOrEmpty(FileSpec)) { return(true); } foreach (string filePattern in FileSpec.Split(';')) { Regex r = new Regex("^" + Regex.Escape(filePattern).Replace("\\*", ".*").Replace("\\?", ".") + "$", RegexOptions.IgnoreCase); if (r.IsMatch(Path.GetFileName(fileNameBeingProcessed))) { return(true); } } return(false); }