示例#1
0
        public void ReadSource(string sourceName, Stream source)
        {
            Analyzers.ForEach(a => beginRead(a, sourceName));
            AnalyzerShortCircuitChains.ForEach(c => c.Analyzers.ForEach(a => beginRead(a, sourceName)));

            using (var lineReader = new StreamReader(source)) {
                int lineNumber = 1;
                while (lineReader.Peek() >= 0)
                {
                    OnReadProgress?.Invoke(this, new ReadProgressEventArgs(sourceName, lineNumber));
                    var line = lineReader.ReadLine();
                    Analyzers.ForEach(a => analyze(a, line, lineNumber, sourceName));

                    foreach (var analyzerChain in AnalyzerShortCircuitChains)
                    {
                        foreach (var analyzer in analyzerChain.Analyzers)
                        {
                            if (analyze(analyzer, line, lineNumber, sourceName))
                            {
                                break;
                            }
                        }
                    }

                    lineNumber++;
                }
            }

            Analyzers.ForEach(a => endRead(a, sourceName));
            AnalyzerShortCircuitChains.ForEach(c => c.Analyzers.ForEach(a => endRead(a, sourceName)));
        }
示例#2
0
 public void EndReadAll()
 {
     Analyzers.ForEach(a => endReadAll(a));
     AnalyzerShortCircuitChains.ForEach(c => c.Analyzers.ForEach(a => endReadAll(a)));
 }
示例#3
0
 private void beginReadAll()
 {
     Analyzers.ForEach(a => beginReadAll(a));
     AnalyzerShortCircuitChains.ForEach(c => c.Analyzers.ForEach(a => beginReadAll(a)));
 }