public RetornoGenerico LerArquivoRetorno(List<string> linhasArquivo) { if (linhasArquivo == null || linhasArquivo.Any() == false) throw new ApplicationException("Arquivo informado é inválido."); /* Identifica o layout: 240 */ if (linhasArquivo.First().Length == 240) { var leitor = new LeitorRetornoCnab240BancoDoBrasil(linhasArquivo); var retornoProcessado = leitor.ProcessarRetorno(); var objRetornar = new RetornoGenerico(retornoProcessado); return objRetornar; } /* Identifica o layout: 400 */ if (linhasArquivo.First().Length == 400) { var leitor = new LeitorRetornoCnab400BancoDoBrasil(linhasArquivo); var retornoProcessado = leitor.ProcessarRetorno(); var objRetornar = new RetornoGenerico(retornoProcessado); return objRetornar; } throw new Exception("Arquivo de RETORNO com " + linhasArquivo.First().Length + " posições, não é suportado."); }