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