private static string[] lerReferenciasNFe(Controller obj, HtmlAgilityPack.HtmlDocument doc) { var allInfAddSpans = doc.DocumentNode.SelectNodes("//*[@id='Inf']//span"); string[] chaves = allInfAddSpans.Select(o => ChaveAcesso.LimparChaveAcesso(o.InnerText)) .Where(t => ChaveAcesso.EhChaveValida(t)) .ToArray(); return(chaves); }
public static void run(Controller ctrl) { //5220 0907 5982 8500 0153 5500 1000 0224 2512 6059 6180 while (true) { Console.WriteLine("Digite a chave de acesso:"); string chave = ChaveAcesso.LimparChaveAcesso(Console.ReadLine()); if (!ChaveAcesso.EhChaveValida(chave)) { Console.WriteLine("A chave é inválida, verifique e digite novamente"); continue; } //var nfces = processaNFe(ctrl, chave); var nfces = new string[] { "52200907598285000153650010002265121702609901", "52200907598285000153650010002265131307114358", "52200907598285000153650010002265141718349755", "52200907598285000153650010002265161231939671", "52200907598285000153650010002265171546975698", "52200907598285000153650010002265191656861004", "52200907598285000153650010002265201598827245", "52200907598285000153650010002265211915361868", "52200907598285000153650010002265221173653321", "52200907598285000153650010002265231277514538", "52200907598285000153650010002265541319758975", "52200907598285000153650010002265551485681194", "52200907598285000153650010002266141372826785", "52200907598285000153650010002266191745822034", "52200907598285000153650010002266201162392670", "52200907598285000153650010002266221385328950", "52200907598285000153650010002266241050293564", "52200907598285000153650010002266261522521470", "52200907598285000153650010002266271099713852" }; processaNFCes(ctrl, nfces); } }