Beispiel #1
0
        private static IParser selectParser(byte[] bytes)
        {
            //FIXME - use header sentinals to select the correct parser;
            //TODO - make a list of known parsers, have each parser
            //TODO - implement two static methods that optionally return a static sentinal or regex for
            //TODO - some text in the first 500 bytes.
            //TODO - If that fails, then instantiate a new parser for each type and return the first one that
            //TODO - says it is valid for the data.
            IParser parser = new Srx400Parser(bytes);

            if (parser.IsValidData)
            {
                return(parser);
            }
            parser = new ATSWinRec(bytes);
            return(parser.IsValidData ? parser : null);
        }
 private static IParser selectParser(byte[] bytes)
 {
     //FIXME - use header sentinals to select the correct parser;
     //TODO - make a list of known parsers, have each parser
     //TODO - implement two static methods that optionally return a static sentinal or regex for
     //TODO - some text in the first 500 bytes.
     //TODO - If that fails, then instantiate a new parser for each type and return the first one that
     //TODO - says it is valid for the data.
     IParser parser = new Srx400Parser(bytes);
     if (parser.IsValidData)
         return parser;
     parser = new ATSWinRec(bytes);
     return parser.IsValidData ? parser : null;
 }