示例#1
0
        private IntegradorEnvio NovoEnvio()
        {
            var envio = new IntegradorEnvio
            {
                Identificador = { Valor = NumeroSessao.ToString() },
                Componente    =
                {
                    Nome   = NomeComponente,
                    Metodo = { Nome = NomeMetodo }
                }
            };

            return(envio);
        }
        private void EnviarComando(IntegradorEnvio envio)
        {
            if (!Directory.Exists(Path.Combine(Configuracoes.PastaInput, "Enviados")))
            {
                Directory.CreateDirectory(Path.Combine(Configuracoes.PastaInput, "Enviados"));
            }

            envio.Save(Path.Combine(Configuracoes.PastaInput, "Enviados", $"{envio.Componente.Metodo.Nome}_{envio.Identificador.Valor}.xml"));

            var file = Path.Combine(Configuracoes.PastaInput, $"{envio.Componente.Metodo.Nome}_{envio.Identificador.Valor}.tmp");

            envio.Save(file);

            ComandoEnviado = File.ReadAllText(file);

            File.Move(file, $"{file.Substring(0, file.Length - 4)}.xml");
        }