Beispiel #1
0
        /// <summary>
        /// Tests whether an error record applies to the provider
        /// </summary>
        /// <param name="Record">The error record to test</param>
        /// <returns>Whether it applies to the provider</returns>
        public bool MessageApplies(Message.PsfExceptionRecord Record)
        {
            if ((IncludeModules.Count == 0) && (ExcludeModules.Count == 0) && (IncludeTags.Count == 0) && (ExcludeTags.Count == 0))
            {
                return(true);
            }

            if (IncludeModules.Count > 0)
            {
                bool test = false;
                foreach (string module in IncludeModules)
                {
                    if (Record.ModuleName.ToLower() == module.ToLower())
                    {
                        test = true;
                    }
                }

                if (!test)
                {
                    return(false);
                }
            }

            foreach (string module in ExcludeModules)
            {
                if (Record.ModuleName.ToLower() == module.ToLower())
                {
                    return(false);
                }
            }

            if (IncludeTags.Count > 0)
            {
                if (IncludeTags.Except(Record.Tags).ToList().Count == IncludeTags.Count)
                {
                    return(false);
                }
            }

            if (ExcludeTags.Except(Record.Tags).ToList().Count < ExcludeTags.Count)
            {
                return(false);
            }

            return(true);
        }
Beispiel #2
0
        /// <summary>
        /// Tests whether an error record applies to the provider instance
        /// </summary>
        /// <param name="Record">The error record to test</param>
        /// <returns>Whether it applies to the provider instance</returns>
        public bool MessageApplies(Message.PsfExceptionRecord Record)
        {
            // Modules
            if (IncludeModules.Count > 0)
            {
                bool test = false;
                foreach (string module in IncludeModules)
                {
                    if (string.Equals(Record.ModuleName, module, StringComparison.InvariantCultureIgnoreCase))
                    {
                        test = true;
                    }
                }

                if (!test)
                {
                    return(false);
                }
            }

            foreach (string module in ExcludeModules)
            {
                if (string.Equals(Record.ModuleName, module, StringComparison.InvariantCultureIgnoreCase))
                {
                    return(false);
                }
            }

            // Functions
            if (IncludeFunctions.Count > 0)
            {
                bool test = false;
                foreach (string function in IncludeFunctions)
                {
                    if (UtilityHost.IsLike(Record.FunctionName, function))
                    {
                        test = true;
                    }
                }

                if (!test)
                {
                    return(false);
                }
            }

            foreach (string function in ExcludeFunctions)
            {
                if (UtilityHost.IsLike(Record.FunctionName, function))
                {
                    return(false);
                }
            }

            // Tags
            if (IncludeTags.Count > 0)
            {
                if (IncludeTags.Except(Record.Tags).ToList().Count == IncludeTags.Count)
                {
                    return(false);
                }
            }

            if (ExcludeTags.Except(Record.Tags).ToList().Count < ExcludeTags.Count)
            {
                return(false);
            }

            return(true);
        }