public DirPattern(string DirName, string EntryPattern)
{
this.dirName = DirName;
this.entryPattern = EntryPattern;
Regex regex = new Regex(entryPattern + "$", RegexOptions.Compiled);
dirFiles = new List<string>();
string[] entries = {};
try
{
entries = Directory.GetFileSystemEntries(dirName);
}
catch (DirectoryNotFoundException) { }
foreach (string entry in entries)
{
string fileName = Path.GetFileName(entry);
Match match = regex.Match(entry);
if (match.Success && fileName == match.Value)
dirFiles.Add(match.Groups[match.Groups.Count - 1].Value);
}
}