-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTrigger.cs
64 lines (62 loc) · 1.63 KB
/
Trigger.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
56
57
58
59
60
61
62
63
64
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
namespace TriggerTrigger
{
public class Trigger
{
Regex _regex=null;
public string Name { get; set; }
public string Match { get; set; }
private string _regex_str;
public string Key
{
get
{
return RegEx + "/" + Name+"/" + Match;
}
}
public string RegEx {
get
{
return _regex_str;
}
set
{
_regex_str = value;
try
{
if (_regex_str != string.Empty)
_regex = new Regex(_regex_str, RegexOptions.Compiled);
else
_regex = null;
}
catch
{
_regex = null;
}
}
}
public List<string> EnableCustomTriggers = new List<string>();
public List<string> DisableCustomTriggers = new List<string>();
public List<string> EnableSpellTimers = new List<string>();
public List<string> DisableSpellTimers = new List<string>();
public bool EnableRegex()
{
return _regex != null;
}
public Regex GetRegex()
{
return _regex;
}
public bool Check(string str)
{
if (_regex == null)
return false;
return _regex.IsMatch(str);
}
}
}