Ejemplo n.º 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)));
        }
Ejemplo n.º 2
0
 public void InvokeOnReadProgress(int progress)
 {
     OnReadProgress?.Invoke(this, progress);
 }
Ejemplo n.º 3
0
 protected virtual void NotifyReadProgress(int bytes)
 {
     OnReadProgress?.Invoke(this, bytes);
 }