public bool IsMatch(string prefix, IgnoreActions action) { if (_pattern == null) { _pattern = new Regex("^" + Regex.Escape(this.Mask).Replace("\\*", ".*").Replace("\\?", ".") + "$", RegexOptions.IgnoreCase); } return (this.Actions & action) != IgnoreActions.None && _pattern.IsMatch(prefix); }
public bool IsMatch(string prefix, IgnoreActions action) { if (_pattern == null) { _pattern = new Regex("^" + Regex.Escape(this.Mask).Replace("\\*", ".*").Replace("\\?", ".") + "$", RegexOptions.IgnoreCase); } return((this.Actions & action) != IgnoreActions.None && _pattern.IsMatch(prefix)); }
public static void AddIgnore(string mask, IgnoreActions actions) { string key = mask.ToUpperInvariant(); if (!_ignores.ContainsKey(key)) { _ignores.Add(key, new IgnoreInfo(mask)); } _ignores[key].Actions |= actions; SaveIgnores(); }
public static bool IsIgnoreMatch(IrcPrefix prefix, IgnoreActions action) { if (prefix == null) { return false; } return (from ignore in _ignores.Values where ignore.IsMatch(prefix.Prefix, action) select true).Any(); }
public static bool IsIgnoreMatch(IrcPrefix prefix, IgnoreActions action) { if (prefix == null) { return(false); } return((from ignore in _ignores.Values where ignore.IsMatch(prefix.Prefix, action) select true).Any()); }
public static bool RemoveIgnore(string mask, IgnoreActions actions) { string key = mask.ToUpperInvariant(); if (!_ignores.ContainsKey(key) || (_ignores[key].Actions & actions) == 0) { return false; } _ignores[key].Actions &= ~actions; if (_ignores[key].Actions == IgnoreActions.None) { _ignores.Remove(key); } SaveIgnores(); return true; }
public static bool RemoveIgnore(string mask, IgnoreActions actions) { string key = mask.ToUpperInvariant(); if (!_ignores.ContainsKey(key) || (_ignores[key].Actions & actions) == 0) { return(false); } _ignores[key].Actions &= ~actions; if (_ignores[key].Actions == IgnoreActions.None) { _ignores.Remove(key); } SaveIgnores(); return(true); }