Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FileExpressionList"/> class.
        /// </summary>
        /// <param name="rawFileListString">The unprocessed list of file expressions.</param>
        /// <param name="project">The project where the expression list exists.</param>
        /// <param name="task">The task where the expression list exists.</param>
        public FileExpressionList(string rawFileListString, ProjectInstance project, ProjectTaskInstance task)
        {
            IList <string> expressions = rawFileListString.SplitStringList();
            var            seenFiles   = new HashSet <string>(PathComparer.Instance);

            foreach (string expression in expressions)
            {
                FileExpressionBase parsedExpression = FileExpressionFactory.ParseExpression(expression, project, task);
                Expressions.Add(parsedExpression);

                foreach (string file in parsedExpression.EvaluatedFiles)
                {
                    if (string.IsNullOrWhiteSpace(file))
                    {
                        continue;
                    }

                    if (seenFiles.Add(file))
                    {
                        DedupedFiles.Add(file);
                    }

                    AllFiles.Add(file);
                }
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="FileExpressionList"/> class.
        /// </summary>
        /// <param name="rawFileListString">The unprocessed list of file expressions.</param>
        /// <param name="project">The project where the expression list exists.</param>
        /// <param name="task">The task where the expression list exists.</param>
        public FileExpressionList(string rawFileListString, ProjectInstance project, ProjectTaskInstance task)
        {
            List <string> expressions = rawFileListString.SplitStringList();

            NumExpressions = expressions.Count;

            var seenFiles = new HashSet <string>(PathComparer.Instance);

            foreach (string expression in expressions)
            {
                List <string> evaluatedFiles = FileExpression.EvaluateExpression(expression, project, task, out bool isBatched);
                if (isBatched)
                {
                    NumBatchExpressions++;
                }

                foreach (string file in evaluatedFiles)
                {
                    if (string.IsNullOrWhiteSpace(file))
                    {
                        continue;
                    }

                    if (seenFiles.Add(file))
                    {
                        DedupedFiles.Add(file);
                    }

                    AllFiles.Add(file);
                }
            }
        }