コード例 #1
0
ファイル: App_Ignore.cs プロジェクト: derrickcreamer/Floe
			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);
			}
コード例 #2
0
ファイル: App_Ignore.cs プロジェクト: ryanflannery/Floe
 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));
 }
コード例 #3
0
ファイル: App_Ignore.cs プロジェクト: derrickcreamer/Floe
		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();
		}
コード例 #4
0
ファイル: App_Ignore.cs プロジェクト: derrickcreamer/Floe
		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();
		}
コード例 #5
0
ファイル: App_Ignore.cs プロジェクト: ryanflannery/Floe
        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());
        }
コード例 #6
0
ファイル: App_Ignore.cs プロジェクト: ryanflannery/Floe
        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();
        }
コード例 #7
0
ファイル: App_Ignore.cs プロジェクト: derrickcreamer/Floe
		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;
		}
コード例 #8
0
ファイル: App_Ignore.cs プロジェクト: ryanflannery/Floe
        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);
        }