예제 #1
0
        public FileProcessingResult Process(string path)
        {
            var isFileNameFlushed = false;
            var result            = new FileProcessingResult {
                FileName = path
            };

            foreach (var line in File.ReadLines(path))
            {
                result.TotalLineCount++;
                if (linePattern.IsMatch(line))
                {
                    if (!isFileNameFlushed)
                    {
                        LogContext.Log(path);
                        isFileNameFlushed = true;
                    }
                    LogContext.Log($" ---> {line.Trim()}");
                    foreach (Match match in argPattern.Matches(line))
                    {
                        result.ReplacedLineCount++;
                        LogContext.Log(match.Groups["arg"].Value);
                    }
                }
            }

            return(result);
        }
예제 #2
0
        public FileProcessingResult Process(string path)
        {
            var isFileNameFlushed = false;
            var result            = new FileProcessingResult {
                FileName = path
            };

            foreach (var line in File.ReadLines(path))
            {
                result.TotalLineCount++;
                if (pattern.IsMatch(line))
                {
                    result.ReplacedLineCount++;
                    if (!isFileNameFlushed)
                    {
                        LogContext.Log(path);
                        isFileNameFlushed = true;
                    }
                    LogContext.Log(line);
                }
            }

            return(result);
        }