Пример #1
0
        private bool IsExcluded(string fullPath)
        {
            var result = false;

            if (FilterProjectFile && fullPath == Location)
            {
                result = true;
            }
            else
            {
                var path = CurrentDirectory.MakeRelativePath(fullPath).ToAvalonPath();

                var filter = ExcludedFiles.FirstOrDefault(f => path.Contains(f));

                result = !string.IsNullOrEmpty(filter);
            }

            return(result);
        }
Пример #2
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);
        }
Пример #3
0
 public void AddFileExclusionFilters(string[] exclusionFilters)
 {
     ExcludedFiles.AddFilters(exclusionFilters, RegExFilters);
 }