forked from kermado/NeuralBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFileFilter.cs
55 lines (47 loc) · 1.24 KB
/
FileFilter.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System.Collections.Generic;
using System.IO;
using Newtonsoft.Json;
namespace AimBot
{
public class FileFilter
{
public delegate void FileChanged(FileFilter obj);
private string directory;
private string pattern;
private string filename;
public event FileChanged OnFileChanged;
public FileFilter(string directory, string pattern, string filename)
{
this.directory = directory;
this.pattern = pattern;
this.filename = filename;
}
public string FileName
{
get { return filename; }
set
{
if (filename != value)
{
filename = value;
OnFileChanged?.Invoke(this);
}
}
}
public string FilePath
{
get { return Path.Combine(directory, filename); }
}
[JsonIgnore]
public IEnumerable<string> FileNames
{
get
{
foreach (var path in Directory.GetFiles(directory, pattern))
{
yield return Path.GetFileName(path);
}
}
}
}
}