public static Stream Process(Stream codeStream) { CodePreProcessor processor = new CodePreProcessor(); var memoryStream = new MemoryStream(); var writer = new StreamWriter(memoryStream); using (var reader = new StreamReader(codeStream)) { writer.AutoFlush = true; while (true) { string str = reader.ReadLine(); if (str == null) { break; } str = processor.ProcessLine(str); if (processor.Valid(str)) { writer.WriteLine(str); } } } memoryStream.Seek(0, SeekOrigin.Begin); return(memoryStream); }
public CodeAnalyzer(Stream codeStream) { using (var reader = new StreamReader(CodePreProcessor.Process(codeStream))) { while (true) { string str = reader.ReadLine(); if (str == null) { break; } lines.Add(str); totalCh += (ulong)str.Length; } // use min size difDimension = (100, 100); AllocDif(difDimension); } }