public bool InstrumentClass(string assemblyName, string className) { if (string.IsNullOrEmpty(assemblyName) || string.IsNullOrEmpty(className)) { return(false); } var matchingExclusionFilters = ExclusionFilters.GetMatchingFiltersForAssemblyName(assemblyName); if (matchingExclusionFilters.Any(exclusionFilter => exclusionFilter.ClassName == ".*")) { return(false); } if (matchingExclusionFilters .Where(exclusionFilter => exclusionFilter.ClassName != ".*") .Any(exclusionFilter => exclusionFilter.IsMatchingClassName(className))) { return(false); } var matchingInclusionFilters = InclusionFilters.GetMatchingFiltersForAssemblyName(assemblyName); if (matchingInclusionFilters.Any(inclusionFilter => inclusionFilter.IsMatchingClassName(className))) { return(true); } return(false); }
/// <summary> /// Determine if an [assemblyname]classname pair matches the current Exclusion or Inclusion filters /// </summary> /// <param name="processName">The name of the process</param> /// <param name="assemblyName">the name of the assembly under profile</param> /// <param name="className">the name of the class under profile</param> /// <returns>false - if pair matches the exclusion filter or matches no filters, true - if pair matches in the inclusion filter</returns> public bool InstrumentClass(string processName, string assemblyName, string className) { if (string.IsNullOrEmpty(processName) || string.IsNullOrEmpty(assemblyName) || string.IsNullOrEmpty(className)) { return(false); } IList <AssemblyAndClassFilter> matchingExclusionFilters; if (ExcludeProcessOrAssembly(processName, assemblyName, out matchingExclusionFilters)) { return(false); } if (matchingExclusionFilters .Where(exclusionFilter => exclusionFilter.ClassName != ".*") .Any(exclusionFilter => exclusionFilter.IsMatchingClassName(className))) { return(false); } var matchingInclusionFilters = InclusionFilters.GetMatchingFiltersForAssemblyName(assemblyName); return(matchingInclusionFilters.Any(inclusionFilter => inclusionFilter.IsMatchingClassName(className))); }
/// <summary> /// Decides whether an assembly should be included in the instrumentation /// </summary> /// <param name="processName">The name of the process being profiled</param> /// <param name="assemblyName">The name of the assembly under profile</param> /// <remarks>All assemblies matching either the inclusion or exclusion filter should be included /// as it is the class that is being filtered within these unless the class filter is *</remarks> public bool UseAssembly(string processName, string assemblyName) { if (ExcludeProcessOrAssembly(processName, assemblyName, out IList <AssemblyAndClassFilter> matchingExclusionFilters)) { return(false); } if (matchingExclusionFilters.Any(exclusionFilter => exclusionFilter.ClassName != ".*")) { return(true); } var matchingInclusionFilters = InclusionFilters.GetMatchingFiltersForAssemblyName(assemblyName); return(matchingInclusionFilters.Any()); }
public bool UseAssembly(string assemblyName) { var matchingExclusionFilters = ExclusionFilters.GetMatchingFiltersForAssemblyName(assemblyName); if (matchingExclusionFilters.Any(exclusionFilter => exclusionFilter.ClassName == ".*")) { return(false); } if (matchingExclusionFilters.Any(exclusionFilter => exclusionFilter.ClassName != ".*")) { return(true); } var matchingInclusionFilters = InclusionFilters.GetMatchingFiltersForAssemblyName(assemblyName); if (matchingInclusionFilters.Any()) { return(true); } return(false); }
/// <summary> /// Decides whether an assembly should be included in the instrumentation /// </summary> /// <param name="processName">The name of the process being profiled</param> /// <param name="assemblyName">the name of the assembly under profile</param> /// <remarks>All assemblies matching either the inclusion or exclusion filter should be included /// as it is the class that is being filtered within these unless the class filter is *</remarks> public bool UseAssembly(string processName, string assemblyName) { processName = Path.GetFileNameWithoutExtension(processName); var matchingExclusionFilters = ExclusionFilters.GetMatchingFiltersForAssemblyName(assemblyName); if (matchingExclusionFilters.Any(exclusionFilter => exclusionFilter.ClassName == ".*" && exclusionFilter.IsMatchingProcessName(processName))) { return(false); } if (matchingExclusionFilters.Any(exclusionFilter => exclusionFilter.ClassName != ".*")) { return(true); } var matchingInclusionFilters = InclusionFilters.GetMatchingFiltersForAssemblyName(assemblyName); if (matchingInclusionFilters.Any()) { return(true); } return(false); }