예제 #1
0
        public static IReadOnlyList <ICommand> ParseToCommands(ProtocolVersion version, IEnumerable <byte[]> payloads)
        {
            var result = new List <ICommand>();

            foreach (byte[] payload in payloads)
            {
                foreach (ParsedCommandSpec rawCmd in ReceivedPacket.ParseCommands(payload))
                {
                    result.AddIfNotNull(CommandParser.Parse(version, rawCmd));
                }
            }
            return(result);
        }
예제 #2
0
        private static List <List <ParsedCommandSpec> > ParseCommands(string filename)
        {
            var res = new List <List <ParsedCommandSpec> >();

            using (var reader = new StreamReader(filename))
            {
                string line;
                while ((line = reader.ReadLine()) != null)
                {
                    var commands = ReceivedPacket.ParseCommands(line.HexToByteArray());
                    res.Add(commands.ToList());
                }
            }

            return(res);
        }