Exemplo n.º 1
0
        private CommandsFileModel ParseToModel(Table table)
        {
            var tableFileModel = new CommandsFileModel
            {
                Players  = new List <Player>(),
                Commands = new List <ICommand>()
            };
            var players = new List <Player>();

            foreach (var row in table.Rows)
            {
                var playerInfo = row[0].Split(' ');
                players.Add(new Player {
                    Color = Color.FromName(playerInfo[1]), Name = playerInfo[0]
                });
                tableFileModel.Players.Add(players.Last());
                var commandInfo = row[1].Split(':');
                tableFileModel.Commands.Add(CommandFactory.Get(commandInfo[1], players.FirstOrDefault(p => p.Name == commandInfo[0])));
            }
            return(tableFileModel);
        }
Exemplo n.º 2
0
 public void WhenIParseTheFile()
 {
     _file = _fileParser.Parse();
 }