Exemple #1
0
        public void LerArquivoTexto(string Dados)
        {
            //Classe Responsavel por ler o Ip e a Porta dentro do Arquivo de Texto e enviar como parametro a classe ConexãoSockets
            string   Endereco_txt = "Configurações\\ConfigCliente.txt";
            string   Ip_txt       = "";
            string   Porta_txt    = "";
            FileInfo ArquivoTexto = new FileInfo(Endereco_txt);

            if (ArquivoTexto.Exists)
            {
                StreamReader sr = new StreamReader(Endereco_txt);
                {
                    bool   Contador = true;
                    String linha;
                    // Lê linha por linha
                    while ((linha = sr.ReadLine()) != null)
                    {
                        if (Contador)
                        {
                            Ip_txt   = linha;
                            Contador = false;
                        }
                        else
                        {
                            Porta_txt = linha;
                        }
                    }
                }
                //Registra tudo que que sai dessa Classe
                Relatorios.GerarRelatorio Relatorio = new Relatorios.GerarRelatorio();
                Relatorio.RegistrarRelatorio(Dados, Ip_txt, Porta_txt);

                //Passa o IP e a porta como parametro para a proxima classe
                Criar_Conexao(Dados, Ip_txt, Porta_txt);
            }
            else
            {
                //Exibe o Form para definir o Ip do Servidor
                ConfigSockets Configurar = new ConfigSockets();
                Configurar.Show();
            }
        }
Exemple #2
0
 void ConfigServidorClick(object sender, EventArgs e)
 {
     Conexao.ConfigSockets Configuracao = new Conexao.ConfigSockets();
     Configuracao.Show();
 }