Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
            }
        }