Пример #1
0
        private ParserBase GetParser()
        {
            ParserBase parser;
            var file =
                new System.IO.StreamReader(stream);
            var line = file.ReadLine();
            stream.Seek(0, SeekOrigin.Begin);

            if (line.Contains("xml"))
            {
                parser = new parser.XMLParser(stream);
            }
            //csv
            else
            {
                parser = new CSVParser(stream);
            }
            return parser;
        }
Пример #2
0
 //get concrete parser type(xml, csv,...)
 public Parser(Stream stream)
 {
     this.stream = stream;
     parser = GetParser();
 }