Пример #1
0
        public bool InstrumentClass(string assemblyName, string className)
        {
            if (string.IsNullOrEmpty(assemblyName) || string.IsNullOrEmpty(className))
            {
                return(false);
            }

            if (ExclusionFilter
                .Any(keyValuePair => Regex.Match(assemblyName, keyValuePair.Key.WrapWithAnchors()).Success&& keyValuePair.Value == ".*"))
            {
                return(false);
            }

            if (ExclusionFilter
                .Where(keyValuePair => Regex.Match(assemblyName, keyValuePair.Key.WrapWithAnchors()).Success&& keyValuePair.Value != ".*")
                .Any(keyValuePair => Regex.Match(className, keyValuePair.Value.WrapWithAnchors()).Success))
            {
                return(false);
            }

            if (InclusionFilter
                .Where(keyValuePair => Regex.Match(assemblyName, keyValuePair.Key.WrapWithAnchors()).Success)
                .Any(keyValuePair => Regex.Match(className, keyValuePair.Value.WrapWithAnchors()).Success))
            {
                return(true);
            }

            return(false);
        }
Пример #2
0
 public void ValidateFilter()
 {
     if (KCDatabase.Instance.Ships.Count > 0)
     {
         var ships = KCDatabase.Instance.Ships.Keys;
         InclusionFilter = InclusionFilter.Intersect(ships).Distinct().ToList();
         ExclusionFilter = ExclusionFilter.Intersect(ships).Distinct().ToList();
     }
 }
Пример #3
0
        public bool UseAssembly(string assemblyName)
        {
            if (ExclusionFilter.Any(keyValuePair => Regex.Match(assemblyName, keyValuePair.Key.WrapWithAnchors()).Success&& keyValuePair.Value == ".*"))
            {
                return(false);
            }

            if (ExclusionFilter.Any(keyValuePair => Regex.Match(assemblyName, keyValuePair.Key.WrapWithAnchors()).Success&& keyValuePair.Value != ".*"))
            {
                return(true);
            }

            if (InclusionFilter.Any(keyValuePair => Regex.Match(assemblyName, keyValuePair.Key.WrapWithAnchors()).Success))
            {
                return(true);
            }

            return(false);
        }
Пример #4
0
        public void AddFilter(string assemblyClassName)
        {
            string     assemblyName;
            string     className;
            FilterType filterType;

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

            assemblyName = assemblyName.ValidateAndEscape();
            className    = className.ValidateAndEscape();

            if (filterType == FilterType.Inclusion)
            {
                InclusionFilter.Add(new KeyValuePair <string, string>(assemblyName, className));
            }

            if (filterType == FilterType.Exclusion)
            {
                ExclusionFilter.Add(new KeyValuePair <string, string>(assemblyName, className));
            }
        }
Пример #5
0
 public void AddExclusionFilter(IEnumerable <int> list)
 {
     InclusionFilter = InclusionFilter.Except(list).ToList();
     ExclusionFilter = ExclusionFilter.Union(list).ToList();
 }