Esempio n. 1
0
        /// <summary>
        /// Add a filter
        /// </summary>
        /// <param name="processAssemblyClassFilter">Filter is of the format (+ or -)&lt;processFilter&gt;[assemblyFilter]classFilter, wildcards are allowed. <br/>
        /// i.e. -[mscorlib], -[System.*]*, +[App.*]*, +[*]*
        /// </param>
        public void AddFilter(string processAssemblyClassFilter)
        {
            string     assemblyFilter;
            string     classFilter;
            string     processFilter;
            FilterType filterType;

            GetAssemblyClassName(processAssemblyClassFilter, RegExFilters, out filterType, out assemblyFilter, out classFilter, out processFilter);

            try
            {
                if (!RegExFilters)
                {
                    processFilter  = ValidateAndEscape((string.IsNullOrEmpty(processFilter) ? "*" : processFilter), "<>|\"", "process"); // Path.GetInvalidPathChars except *?
                    assemblyFilter = ValidateAndEscape(assemblyFilter, @"\[]", "assembly");
                    classFilter    = ValidateAndEscape(classFilter, @"\[]", "class/type");
                }

                var filter = new AssemblyAndClassFilter(processFilter, assemblyFilter, classFilter);
                if (filterType == FilterType.Inclusion)
                {
                    InclusionFilters.Add(filter);
                }

                if (filterType == FilterType.Exclusion)
                {
                    ExclusionFilters.Add(filter);
                }
            }
            catch (Exception)
            {
                HandleInvalidFilterFormat(processAssemblyClassFilter);
            }
        }
Esempio n. 2
0
        public void AddFilter(string assemblyClassName)
        {
            string     assemblyName;
            string     className;
            FilterType filterType;

            GetAssemblyClassName(assemblyClassName, RegExFilters, out filterType, out assemblyName, out className);

            if (!RegExFilters)
            {
                assemblyName = assemblyName.ValidateAndEscape();
                className    = className.ValidateAndEscape();
            }

            var filter = new AssemblyAndClassFilter(assemblyName, className);

            if (filterType == FilterType.Inclusion)
            {
                InclusionFilters.Add(filter);
            }

            if (filterType == FilterType.Exclusion)
            {
                ExclusionFilters.Add(filter);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Add a filter
        /// </summary>
        /// <param name="assemblyClassName">A filter is of the format (+ or -)[assemblyName]className, wildcards are allowed. <br/>
        /// i.e. -[mscorlib], -[System.*]*, +[App.*]*, +[*]*
        /// </param>
        public void AddFilter(string assemblyClassName)
        {
            string     assemblyName;
            string     className;
            string     processName;
            FilterType filterType;

            GetAssemblyClassName(assemblyClassName, RegExFilters, out filterType, out assemblyName, out className, out processName);

            if (!RegExFilters)
            {
                processName  = (string.IsNullOrEmpty(processName) ? "*" : processName).ValidateAndEscape("/?\"<>|}{");
                assemblyName = assemblyName.ValidateAndEscape();
                className    = className.ValidateAndEscape();
            }

            var filter = new AssemblyAndClassFilter(processName, assemblyName, className);

            if (filterType == FilterType.Inclusion)
            {
                InclusionFilters.Add(filter);
            }

            if (filterType == FilterType.Exclusion)
            {
                ExclusionFilters.Add(filter);
            }
        }