DirectOutputR1
DirectOutput framework R1 for virtual pinball cabinets.
Go to:
Overview 
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros Pages
FilePatternList.cs
Go to the documentation of this file.
1 using System.Collections.Generic;
2 using System.IO;
3 using System.Linq;
4 
5 namespace DirectOutput.GlobalConfiguration
6 {
10  public class FilePatternList : List<FilePattern>
11  {
17  public List<FileInfo> GetMatchingFiles(Dictionary<string, string> ReplaceValues=null)
18  {
19  List<FileInfo> L = new List<FileInfo>();
20  foreach(FilePattern P in this) {
21  List<FileInfo> PL = P.GetMatchingFiles(ReplaceValues);
22  foreach (FileInfo FI in PL)
23  {
24  if (!L.Any(x=>x.FullName==FI.FullName))
25  {
26  L.Add(FI);
27  }
28  }
29  }
30  return L;
31  }
32 
33 
39  public FileInfo GetFirstMatchingFile(Dictionary<string, string> ReplaceValues = null)
40  {
41  foreach (FilePattern P in this)
42  {
43  FileInfo F = P.GetFirstMatchingFile(ReplaceValues);
44  if (F != null)
45  {
46  return F;
47  }
48  }
49  return null;
50  }
51 
52 
53  }
54 }