コード例 #1
0
ファイル: Filter.cs プロジェクト: nrjohnstone/opencover
        public bool ExcludeByFile(string fileName)
        {
            if (ExcludedFiles.Count == 0 || string.IsNullOrWhiteSpace(fileName))
            {
                return(false);
            }

            return(ExcludedFiles.Any(excludeFile => excludeFile.Value.Match(fileName).Success));
        }
コード例 #2
0
        public bool ExcludeByFile(string fileName)
        {
            if (ExcludedFiles.Count == 0 || string.IsNullOrWhiteSpace(fileName))
            {
                return(false);
            }

            return(ExcludedFiles.Any(excludeFile => excludeFile.IsMatchingExpression(fileName)));
        }
コード例 #3
0
        protected bool ParseProjectFile()
        {
            TargetFrameworks = new List <TargetFramework>();

            XDocument projDoc = CreateProjectDocument(ProjectFilePath);

            if (projDoc == null)
            {
                return(false);
            }

            ProjectElement = projDoc.Root?.DescendantsAndSelf()
                             .FirstOrDefault(e => e.Name == "AssemblyName")
                             ?.Parent;

            if (ProjectElement == null)
            {
                Logger.Error <string>("'{0}' has no primary ProjectGroup ", ProjectFilePath);
                return(false);
            }

            Document = projDoc;

            if (!InitializeTargetFrameworks())
            {
                Logger.Error($"Failed to initialize target framework(s) from project file");

                return(false);
            }

            SourceFiles = Directory.GetFiles(ProjectDirectory, $"*.cs").ToList()
                          .Where(f => !ExcludedFiles.Any(x => f.Equals(x, StringComparison.OrdinalIgnoreCase)))
                          .ToList();

            return(true);
        }