Exemple #1
0
        public void verificarEspecifica()
        {
            clsRegraNegocio regra = new clsRegraNegocio();

            List <Label>    lbl    = new List <Label>();
            List <TextBox>  txts   = new List <TextBox>();
            List <Button>   bnts   = new List <Button>();
            List <CheckBox> cheBox = new List <CheckBox>();

            lbl.Add(lblBibliotecaEspecifica);
            lbl.Add(lblLaboreEspecifica);
            lbl.Add(lblEspecificaPortal);

            txts.Add(txtEspecificaBiblioteca);
            txts.Add(txtEspecificaLabore);
            txts.Add(txtEspecificaPortal);
            bnts.Add(btnEspecificaBiblioteca);
            bnts.Add(btnEspecificaLabore);
            bnts.Add(btnEspecificaPortal);

            cheBox.Add(checkBiblioteca);
            cheBox.Add(checkLabore);
            cheBox.Add(checkPortal);

            regra.habilitarEspecifica(cbUtilizaEspecifica, lbl, txts, bnts, cheBox);
        }
Exemple #2
0
        private void checkLabore_CheckedChanged(object sender, EventArgs e)
        {
            clsRegraNegocio regra = new clsRegraNegocio();

            if (checkVersao12.Checked)
            {
                verificarVersao12Labore();
            }

            else
            {
                regra.verificarVisivel(txtLaboreCriar, btnLabore, checkLabore, lblLaboreCriar);
            }
        }
Exemple #3
0
        public void verificarVersao12Labore()
        {
            clsRegraNegocio regra = new clsRegraNegocio();

            if (checkVersao12.Checked)
            {
                txtLaboreCriar.Visible = false;
                txtLaboreCriar.Text    = "";
                lblLaboreCriar.Visible = false;
                btnLabore.Visible      = false;
            }

            else
            {
                regra.verificarVisivel(txtLaboreCriar, btnLabore, checkLabore, lblLaboreCriar);
            }
        }
Exemple #4
0
        private void checkBiblioteca_CheckedChanged(object sender, EventArgs e)
        {
            clsRegraNegocio regra = new clsRegraNegocio();

            regra.verificarVisivel(txtBibliotecaCriar, btnBiblioteca, checkBiblioteca, lblBibliotecaCriar);
        }
Exemple #5
0
        public void verificarEspecifica()
        {
            clsRegraNegocio regra = new clsRegraNegocio();

            List<Label> lbl = new List<Label>();
            List<TextBox> txts = new List<TextBox>();
            List<Button> bnts = new List<Button>();
            List<CheckBox> cheBox = new List<CheckBox>();
            lbl.Add(lblBibliotecaEspecifica);
            lbl.Add(lblLaboreEspecifica);
            lbl.Add(lblEspecificaPortal);

            txts.Add(txtEspecificaBiblioteca);
            txts.Add(txtEspecificaLabore);
            txts.Add(txtEspecificaPortal);
            bnts.Add(btnEspecificaBiblioteca);
            bnts.Add(btnEspecificaLabore);
            bnts.Add(btnEspecificaPortal);

            cheBox.Add(checkBiblioteca);
            cheBox.Add(checkLabore);
            cheBox.Add(checkPortal);

            regra.habilitarEspecifica(cbUtilizaEspecifica, lbl, txts, bnts, cheBox);
        }
Exemple #6
0
        private void checkAtualizaPortal_CheckedChanged(object sender, EventArgs e)
        {
            clsRegraNegocio regra = new clsRegraNegocio();

            regra.verificarVisivel(txtAtualizarPortal, btnAtualizarPortal, checkAtualizaPortal, lblAtualizarPortal);
        }
Exemple #7
0
        private void checkAtualizaBiblioteca_CheckedChanged(object sender, EventArgs e)
        {
            clsRegraNegocio regra = new clsRegraNegocio();

            regra.verificarVisivel(txtAtualizarBiblioteca, btnAtualizarBiblioteca, checkAtualizaBiblioteca, lblAtualizarBiblioteca);
        }
Exemple #8
0
        private void btnExecutar_Click(object sender, EventArgs e)
        {
            bool deuErro = false;

            Util.clsUtil util = new Util.clsUtil();

            try
            {
                clsRegraNegocio regra = new clsRegraNegocio();

                List <Control> lst = new List <Control>();
                lst.Add(txtNome);
                if (util.verificarNulo(errorProvider1, lst))
                {
                }

                else
                {
                    if (checkBiblioteca.Checked)
                    {
                        if (regra.verificarAmbienteExiste("Biblioteca", txtNome.Text))
                        {
                        }
                        else
                        {
                            if (criarAmbiente("Biblioteca"))
                            {
                                if (txtEspecificaBiblioteca.Visible == true)
                                {
                                    if (txtEspecificaBiblioteca.Text != string.Empty)
                                    {
                                        atualizar(txtNome.Text, txtEspecificaBiblioteca.Text, "Biblioteca");
                                    }
                                }
                            }
                            else
                            {
                                deuErro = true;
                                return;
                            }
                        }
                    }


                    if (checkLabore.Checked)
                    {
                        if (txtLaboreCriar.Text != string.Empty)
                        {
                            if (criarAmbiente("Aplicativo"))
                            {
                                if (txtEspecificaLabore.Visible == true)
                                {
                                    if (txtEspecificaLabore.Text != string.Empty)
                                    {
                                        atualizar(txtNome.Text, txtEspecificaLabore.Text, regra.retornarAplicativo(txtLaboreCriar.Text));
                                    }
                                }
                            }
                            else
                            {
                                deuErro = true;
                                return;
                            }
                        }
                    }
                    if (checkPortal.Checked)
                    {
                        criarAmbiente("Portal");
                        if (txtEspecificaPortal.Visible == true)
                        {
                            if (txtEspecificaPortal.Text != string.Empty)
                            {
                                atualizar(txtNome.Text, txtEspecificaPortal.Text, "Portal");
                            }
                        }
                        //  deletarDiretorio();



                        clsServico servico = new clsServico();

                        if (checkIniciarHost.Checked)
                        {
                            servico.DesinstalaServico(txtNome.Text);
                            servico.InstalaServico(txtNome.Text);
                        }

                        if (checkIniciarLabore.Checked)
                        {
                            servico.AbreAplicativo(regra.retornarAplicativo(txtLaboreCriar.Text), txtNome.Text, checkVersao12.Checked);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                util.mensagemErro(ex.Message);
            }

            finally
            {
                deletarDiretorio(@"C:\extrair");

                if (deuErro == true)
                {
                    deletarDiretorio(string.Format(@"c:\totvs\{0}", txtNome.Text));
                    progressBar1.Value = 0;
                }
            }
        }
Exemple #9
0
        private void checkLabore_CheckedChanged(object sender, EventArgs e)
        {
            clsRegraNegocio regra = new clsRegraNegocio();

            if (checkVersao12.Checked)
            {
                verificarVersao12Labore();
            }

            else
            {
                regra.verificarVisivel(txtLaboreCriar, btnLabore, checkLabore, lblLaboreCriar);
            }
        }
Exemple #10
0
 private void checkBiblioteca_CheckedChanged(object sender, EventArgs e)
 {
     clsRegraNegocio regra = new clsRegraNegocio();
     regra.verificarVisivel(txtBibliotecaCriar, btnBiblioteca, checkBiblioteca, lblBibliotecaCriar);
 }
Exemple #11
0
 private void checkAtualizaPortal_CheckedChanged(object sender, EventArgs e)
 {
     clsRegraNegocio regra = new clsRegraNegocio();
     regra.verificarVisivel(txtAtualizarPortal, btnAtualizarPortal, checkAtualizaPortal, lblAtualizarPortal);
 }
Exemple #12
0
 private void checkAtualizaLabore_CheckedChanged(object sender, EventArgs e)
 {
     clsRegraNegocio regra = new clsRegraNegocio();
     regra.verificarVisivel(txtAtualizarLabore, btnAtualizarLabore, checkAtualizaLabore, lblAtualizarLabore);
 }
Exemple #13
0
 private void checkAtualizaBiblioteca_CheckedChanged(object sender, EventArgs e)
 {
     clsRegraNegocio regra = new clsRegraNegocio();
     regra.verificarVisivel(txtAtualizarBiblioteca, btnAtualizarBiblioteca, checkAtualizaBiblioteca, lblAtualizarBiblioteca);
 }
Exemple #14
0
        private void btnExecutar_Click(object sender, EventArgs e)
        {
            bool deuErro = false;
            Util.clsUtil util = new Util.clsUtil();

            try
            {

                clsRegraNegocio regra = new clsRegraNegocio();

                List<Control> lst = new List<Control>();
                lst.Add(txtNome);
                if (util.verificarNulo(errorProvider1, lst))
                {

                }

                else
                {
                    if (checkBiblioteca.Checked)
                    {
                        if (regra.verificarAmbienteExiste("Biblioteca", txtNome.Text))
                        {

                        }
                        else
                        {
                            if (criarAmbiente("Biblioteca"))
                            {
                                if (txtEspecificaBiblioteca.Visible == true)
                                {

                                    if (txtEspecificaBiblioteca.Text != string.Empty)
                                    {
                                        atualizar(txtNome.Text, txtEspecificaBiblioteca.Text, "Biblioteca");
                                    }

                                }

                            }
                            else
                            {
                                deuErro = true;
                                return;
                            }
                        }

                    }

                    if (checkLabore.Checked)
                    {
                        if (txtLaboreCriar.Text != string.Empty)
                        {
                            if (criarAmbiente("Aplicativo"))
                            {

                                if (txtEspecificaLabore.Visible == true)
                                {

                                    if (txtEspecificaLabore.Text != string.Empty)
                                    {
                                        atualizar(txtNome.Text, txtEspecificaLabore.Text, regra.retornarAplicativo(txtLaboreCriar.Text));

                                    }
                                }
                            }
                            else
                            {
                                deuErro = true;
                                return;
                            }
                        }
                    }
                    if (checkPortal.Checked)
                    {

                        criarAmbiente("Portal");
                        if (txtEspecificaPortal.Visible == true)
                        {

                            if (txtEspecificaPortal.Text != string.Empty)
                            {
                                atualizar(txtNome.Text, txtEspecificaPortal.Text, "Portal");

                            }

                        }
                        //  deletarDiretorio();

                        clsServico servico = new clsServico();

                        if (checkIniciarHost.Checked)
                        {
                            servico.DesinstalaServico(txtNome.Text);
                            servico.InstalaServico(txtNome.Text);
                        }

                        if (checkIniciarLabore.Checked)
                        {
                            servico.AbreAplicativo(regra.retornarAplicativo(txtLaboreCriar.Text), txtNome.Text, checkVersao12.Checked);
                        }
                    }
                }

            }
            catch (Exception ex)
            {

                util.mensagemErro(ex.Message);
            }

            finally
            {
                deletarDiretorio(@"C:\extrair");

                if (deuErro == true)
                {
                    deletarDiretorio(string.Format(@"c:\totvs\{0}", txtNome.Text));
                    progressBar1.Value = 0;
                }

            }
        }
Exemple #15
0
        public void verificarVersao12Labore()
        {
            clsRegraNegocio regra = new clsRegraNegocio();
            if (checkVersao12.Checked)
            {
                txtLaboreCriar.Visible = false;
                txtLaboreCriar.Text = "";
                lblLaboreCriar.Visible = false;
                btnLabore.Visible = false;
            }

            else
            {

                regra.verificarVisivel(txtLaboreCriar, btnLabore, checkLabore, lblLaboreCriar);
            }
        }
Exemple #16
0
        private void txtAmbienteAtualizar_Click(object sender, EventArgs e)
        {
            clsRegraNegocio regra = new clsRegraNegocio();

            regra.listarAmbiente(txtAmbienteAtualizar);
        }
Exemple #17
0
        private void checkPortal_CheckedChanged(object sender, EventArgs e)
        {
            clsRegraNegocio regra = new clsRegraNegocio();

            regra.verificarVisivel(txtPortalCriar, btnPortal, checkPortal, lblPortalCriar);
        }
Exemple #18
0
 private void checkPortal_CheckedChanged(object sender, EventArgs e)
 {
     clsRegraNegocio regra = new clsRegraNegocio();
     regra.verificarVisivel(txtPortalCriar, btnPortal, checkPortal, lblPortalCriar);
 }
Exemple #19
0
 private void txtAmbienteAtualizar_Click(object sender, EventArgs e)
 {
     clsRegraNegocio regra = new clsRegraNegocio();
     regra.listarAmbiente(txtAmbienteAtualizar);
 }
        public void criarArquivoConfig(string nomeAmbiente, bool aplicativo, bool versao12, TextBox txtArquivo)
        {
            clsRegraNegocio regra = new clsRegraNegocio();
            clsOperacoes op = new clsOperacoes();
            try
            {

                if (aplicativo == true)
                {

                    string nomeArquivo = op.retornarNomeApp() + ".exe"; //string.Format("{0}.exe", regra.retornarAplicativo(txtArquivo.Text));
                    string nomePasta = op.retornarNomeApp(); //string.Format("{0}", regra.retornarAplicativo(txtArquivo.Text));
                    string caminhoApp = string.Format(@"C:\totvs\{0}\{1}\{2}.config ", nomeAmbiente, nomePasta, nomeArquivo);
                    System.IO.FileStream fs = System.IO.File.OpenWrite(caminhoApp);
                    fs.Close();
                    File.WriteAllText(caminhoApp, retornarArquivoConfig(nomeAmbiente));

                }

                else
                {
                    List<string> nomesArquivo = new List<string>();
                    if (versao12 == true)
                    {

                        nomesArquivo.Add("RM.AliasManager.exe");
                        nomesArquivo.Add("RM.exe");
                        nomesArquivo.Add("RM.Atualizador.exe.dll");
                        nomesArquivo.Add("RM.Atualizador.exe");
                        nomesArquivo.Add("RM.Host.exe");
                        nomesArquivo.Add("RM.Host.Service.exe");
                        nomesArquivo.Add("RM.Lib.Gerador.Execute.exe");
                        nomesArquivo.Add("RM.Script.Executor.exe");
                        nomesArquivo.Add("RM.TotvsSQLTools.exe");
                        nomesArquivo.Add("RM.Atualizador.LogViewer.exe");
                        nomesArquivo.Add("RMAgilis.exe");
                        nomesArquivo.Add("RMBiblios.exe");
                        nomesArquivo.Add("RMBis.exe");
                        nomesArquivo.Add("RMBonum.exe");
                        nomesArquivo.Add("RMChronus.exe");
                        nomesArquivo.Add("RMClass.exe");
                        nomesArquivo.Add("RMClassisF.exe");
                        nomesArquivo.Add("RMClassisNet.exe");
                        nomesArquivo.Add("RMFactor.exe");
                        nomesArquivo.Add("RMFluxus.exe");
                        nomesArquivo.Add("RMLabore.exe");
                        nomesArquivo.Add("RMLiber.exe");
                        nomesArquivo.Add("RMNucleus.exe");
                        nomesArquivo.Add("RMOfficina.exe");
                        nomesArquivo.Add("RMPortal.exe");
                        nomesArquivo.Add("RMSaldus.exe");
                        nomesArquivo.Add("RMSaude.exe");
                        nomesArquivo.Add("RMSGI.exe");
                        nomesArquivo.Add("RMSGI.exe");
                        nomesArquivo.Add("RMTestis.exe");
                        nomesArquivo.Add("RMVitae.exe");
                        nomesArquivo.Add("RMVitaeSMT.exe");

                        copiarArquivosV12(nomeAmbiente, "RM.Glb.PlanilhaNet.API.dll");
                        copiarArquivosV12(nomeAmbiente, "RM.TstExec.Executor.exe");
                    }

                    else
                    {
                        nomesArquivo.Add("RM.AliasManager.exe");
                        nomesArquivo.Add("RM.exe");
                        nomesArquivo.Add("RM.Glb.PlanilhaNet.API.dll");
                        nomesArquivo.Add("RM.Host.exe");
                        nomesArquivo.Add("RM.Host.Service.exe");
                        nomesArquivo.Add("RM.Lib.Gerador.Execute.exe");
                        nomesArquivo.Add("RM.Script.Executor.exe");
                        nomesArquivo.Add("RM.TotvsSQLTools.exe");
                        nomesArquivo.Add("RM.TstExec.Executor.exe");

                    }

                    for (int i = 0; i < nomesArquivo.Count; i++)
                    {

                        string caminhoTotal = string.Format(@"C:\totvs\{0}\RM.Net\{1}.config ", nomeAmbiente, nomesArquivo[i]);
                        if (File.Exists(caminhoTotal))
                        {
                            File.Delete(caminhoTotal);
                            File.Copy(@"C:\Gerencia  Ambiente\Ambiente\RM.exe.config", caminhoTotal);
                            // File.Copy(@"\\BHD000000407\ambiente\RM.exe.config", caminhoTotal);

                            // File.Create(@"C:\Users\Gustavo Giori\Desktop\PA\teste.config");
                            // File.CreateText(@"C:\Users\Gustavo Giori\Desktop\PA\teste.config");
                            // System.IO.FileStream fs = System.IO.File.OpenWrite(caminhoTotal);
                            //fs.Close();
                            File.WriteAllText(caminhoTotal, retornarArquivoConfig(nomeAmbiente));
                        }

                        else
                        {

                            File.Copy(@"C:\Gerencia  Ambiente\Ambiente\RM.exe.config", caminhoTotal);
                            // File.Copy(@"\\BHD000000407\ambiente\RM.exe.config", caminhoTotal);

                            // File.Create(@"C:\Users\Gustavo Giori\Desktop\PA\teste.config");
                            // File.CreateText(@"C:\Users\Gustavo Giori\Desktop\PA\teste.config");
                            // System.IO.FileStream fs = System.IO.File.OpenWrite(caminhoTotal);
                            //fs.Close();
                            File.WriteAllText(caminhoTotal, retornarArquivoConfig(nomeAmbiente));

                        }
                    }
                }

            }
            catch (Exception ex)
            {
                throw new System.ArgumentException(ex.Message + "\n" + ex.InnerException);
            }
        }
Exemple #21
0
        private void checkAtualizaLabore_CheckedChanged(object sender, EventArgs e)
        {
            clsRegraNegocio regra = new clsRegraNegocio();

            regra.verificarVisivel(txtAtualizarLabore, btnAtualizarLabore, checkAtualizaLabore, lblAtualizarLabore);
        }
Exemple #22
0
        public bool criarAmbiente(string produto)
        {
            bool            criou     = false;
            clsOperacoes    operacoes = new clsOperacoes(progressBar1, lblTeste, checkVersao12.Checked);
            clsConfiguracao config    = new clsConfiguracao();
            bool            versao12  = false;

            try
            {
                if (produto == "Biblioteca")
                {
                    operacoes.setTxtDiretorio(txtBibliotecaCriar);
                    operacoes.extrairInstalador(txtBibliotecaCriar.Text, @"c:\extrair");

                    versao12 = operacoes.verificarVersao12(string.Format(@"C:\extrair\WinRoot\totvs\CorporeRM\RM.Net\RM.Version.dll", txtNome.Text));
                    operacoes.DirectoryCopy(@"C:\extrair\WinRoot\totvs\CorporeRM", txtNome
                                            .Text, true, false);


                    config.criarArquivoConfig(txtNome.Text, false, versao12, txtBibliotecaCriar);
                    ambienteCriadoSucesso();
                    config.deletarBroker(txtNome.Text);
                }

                if (produto == "Aplicativo")
                {
                    operacoes.setTxtDiretorio(txtBibliotecaCriar);
                    if (Directory.Exists(@"C:\extrair"))
                    {
                        operacoes.deletarDiretorio(@"c:\extrair", true);
                    }
                    operacoes.extrairInstalador(txtLaboreCriar.Text, @"c:\extrair");

                    operacoes.DirectoryCopy(@"C:\extrair\WinRoot\totvs\CorporeRM", txtNome
                                            .Text, true, false);



                    config.criarArquivoConfig(txtNome.Text, true, versao12, txtLaboreCriar);


                    clsRegraNegocio regra      = new clsRegraNegocio();
                    string          aplicativo = regra.retornarAplicativo(txtLaboreCriar.Text);
                    File.Copy(@"C:\Gerencia  Ambiente\Ambiente\RM.Lib.Interop.dll", string.Format(@"C:\totvs\{0}\RM{1}\RM.Lib.Interop.dll ", txtNome.Text, aplicativo), true);

                    ambienteCriadoSucesso();
                }

                if (produto == "Portal")
                {
                    operacoes.setTxtDiretorio(txtPortalCriar);
                    if (Directory.Exists(@"C:\extrair"))
                    {
                        operacoes.deletarDiretorio(@"c:\extrair", true);
                    }
                    operacoes.extrairInstalador(txtPortalCriar.Text, @"c:\extrair");

                    operacoes.DirectoryCopy(@"C:\extrair\WinRoot\totvs\CorporeRM", txtNome
                                            .Text, true, false);


                    config.criarArquivoConfig(txtNome.Text, false, checkVersao12.Checked, txtPortalCriar);
                    config.deletarBroker(txtNome.Text);
                    ambienteCriadoSucesso();
                }
                criou = true;
            }
            catch (Exception ex)
            {
                criou = false;
                MessageBox.Show(ex.Message);
            }

            return(criou);
        }
Exemple #23
0
        public void criarArquivoConfig(string nomeAmbiente, bool aplicativo, bool versao12, TextBox txtArquivo)
        {
            clsRegraNegocio regra = new clsRegraNegocio();
            clsOperacoes    op    = new clsOperacoes();

            try
            {
                if (aplicativo == true)
                {
                    string nomeArquivo      = op.retornarNomeApp() + ".exe"; //string.Format("{0}.exe", regra.retornarAplicativo(txtArquivo.Text));
                    string nomePasta        = op.retornarNomeApp();          //string.Format("{0}", regra.retornarAplicativo(txtArquivo.Text));
                    string caminhoApp       = string.Format(@"C:\totvs\{0}\{1}\{2}.config ", nomeAmbiente, nomePasta, nomeArquivo);
                    System.IO.FileStream fs = System.IO.File.OpenWrite(caminhoApp);
                    fs.Close();
                    File.WriteAllText(caminhoApp, retornarArquivoConfig(nomeAmbiente));
                }

                else
                {
                    List <string> nomesArquivo = new List <string>();
                    if (versao12 == true)
                    {
                        nomesArquivo.Add("RM.AliasManager.exe");
                        nomesArquivo.Add("RM.exe");
                        nomesArquivo.Add("RM.Atualizador.exe.dll");
                        nomesArquivo.Add("RM.Atualizador.exe");
                        nomesArquivo.Add("RM.Host.exe");
                        nomesArquivo.Add("RM.Host.Service.exe");
                        nomesArquivo.Add("RM.Lib.Gerador.Execute.exe");
                        nomesArquivo.Add("RM.Script.Executor.exe");
                        nomesArquivo.Add("RM.TotvsSQLTools.exe");
                        nomesArquivo.Add("RM.Atualizador.LogViewer.exe");
                        nomesArquivo.Add("RMAgilis.exe");
                        nomesArquivo.Add("RMBiblios.exe");
                        nomesArquivo.Add("RMBis.exe");
                        nomesArquivo.Add("RMBonum.exe");
                        nomesArquivo.Add("RMChronus.exe");
                        nomesArquivo.Add("RMClass.exe");
                        nomesArquivo.Add("RMClassisF.exe");
                        nomesArquivo.Add("RMClassisNet.exe");
                        nomesArquivo.Add("RMFactor.exe");
                        nomesArquivo.Add("RMFluxus.exe");
                        nomesArquivo.Add("RMLabore.exe");
                        nomesArquivo.Add("RMLiber.exe");
                        nomesArquivo.Add("RMNucleus.exe");
                        nomesArquivo.Add("RMOfficina.exe");
                        nomesArquivo.Add("RMPortal.exe");
                        nomesArquivo.Add("RMSaldus.exe");
                        nomesArquivo.Add("RMSaude.exe");
                        nomesArquivo.Add("RMSGI.exe");
                        nomesArquivo.Add("RMSGI.exe");
                        nomesArquivo.Add("RMTestis.exe");
                        nomesArquivo.Add("RMVitae.exe");
                        nomesArquivo.Add("RMVitaeSMT.exe");


                        copiarArquivosV12(nomeAmbiente, "RM.Glb.PlanilhaNet.API.dll");
                        copiarArquivosV12(nomeAmbiente, "RM.TstExec.Executor.exe");
                    }

                    else
                    {
                        nomesArquivo.Add("RM.AliasManager.exe");
                        nomesArquivo.Add("RM.exe");
                        nomesArquivo.Add("RM.Glb.PlanilhaNet.API.dll");
                        nomesArquivo.Add("RM.Host.exe");
                        nomesArquivo.Add("RM.Host.Service.exe");
                        nomesArquivo.Add("RM.Lib.Gerador.Execute.exe");
                        nomesArquivo.Add("RM.Script.Executor.exe");
                        nomesArquivo.Add("RM.TotvsSQLTools.exe");
                        nomesArquivo.Add("RM.TstExec.Executor.exe");
                    }

                    for (int i = 0; i < nomesArquivo.Count; i++)
                    {
                        string caminhoTotal = string.Format(@"C:\totvs\{0}\RM.Net\{1}.config ", nomeAmbiente, nomesArquivo[i]);
                        if (File.Exists(caminhoTotal))
                        {
                            File.Delete(caminhoTotal);
                            File.Copy(@"C:\Gerencia  Ambiente\Ambiente\RM.exe.config", caminhoTotal);
                            // File.Copy(@"\\BHD000000407\ambiente\RM.exe.config", caminhoTotal);

                            // File.Create(@"C:\Users\Gustavo Giori\Desktop\PA\teste.config");
                            // File.CreateText(@"C:\Users\Gustavo Giori\Desktop\PA\teste.config");
                            // System.IO.FileStream fs = System.IO.File.OpenWrite(caminhoTotal);
                            //fs.Close();
                            File.WriteAllText(caminhoTotal, retornarArquivoConfig(nomeAmbiente));
                        }

                        else
                        {
                            File.Copy(@"C:\Gerencia  Ambiente\Ambiente\RM.exe.config", caminhoTotal);
                            // File.Copy(@"\\BHD000000407\ambiente\RM.exe.config", caminhoTotal);

                            // File.Create(@"C:\Users\Gustavo Giori\Desktop\PA\teste.config");
                            // File.CreateText(@"C:\Users\Gustavo Giori\Desktop\PA\teste.config");
                            // System.IO.FileStream fs = System.IO.File.OpenWrite(caminhoTotal);
                            //fs.Close();
                            File.WriteAllText(caminhoTotal, retornarArquivoConfig(nomeAmbiente));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new System.ArgumentException(ex.Message + "\n" + ex.InnerException);
            }
        }
Exemple #24
0
        public bool criarAmbiente(string produto)
        {
            bool criou = false;
            clsOperacoes operacoes = new clsOperacoes(progressBar1, lblTeste, checkVersao12.Checked);
            clsConfiguracao config = new clsConfiguracao();
            bool versao12 = false;
            try
            {
                if (produto == "Biblioteca")
                {
                    operacoes.setTxtDiretorio(txtBibliotecaCriar);
                    operacoes.extrairInstalador(txtBibliotecaCriar.Text, @"c:\extrair");

                    versao12 = operacoes.verificarVersao12(string.Format(@"C:\extrair\WinRoot\totvs\CorporeRM\RM.Net\RM.Version.dll", txtNome.Text));
                    operacoes.DirectoryCopy(@"C:\extrair\WinRoot\totvs\CorporeRM", txtNome
                          .Text, true, false);

                    config.criarArquivoConfig(txtNome.Text, false, versao12, txtBibliotecaCriar);
                    ambienteCriadoSucesso();
                    config.deletarBroker(txtNome.Text);
                }

                if (produto == "Aplicativo")
                {
                    operacoes.setTxtDiretorio(txtBibliotecaCriar);
                    if (Directory.Exists(@"C:\extrair"))
                    {
                        operacoes.deletarDiretorio(@"c:\extrair", true);
                    }
                    operacoes.extrairInstalador(txtLaboreCriar.Text, @"c:\extrair");

                    operacoes.DirectoryCopy(@"C:\extrair\WinRoot\totvs\CorporeRM", txtNome
                         .Text, true, false);

                    config.criarArquivoConfig(txtNome.Text, true, versao12, txtLaboreCriar);

                    clsRegraNegocio regra = new clsRegraNegocio();
                    string aplicativo = regra.retornarAplicativo(txtLaboreCriar.Text);
                        File.Copy(@"C:\Gerencia  Ambiente\Ambiente\RM.Lib.Interop.dll", string.Format(@"C:\totvs\{0}\RM{1}\RM.Lib.Interop.dll ", txtNome.Text,aplicativo), true);

                    ambienteCriadoSucesso();
                }

                if (produto == "Portal")
                {
                    operacoes.setTxtDiretorio(txtPortalCriar);
                    if (Directory.Exists(@"C:\extrair"))
                    {
                        operacoes.deletarDiretorio(@"c:\extrair", true);
                    }
                    operacoes.extrairInstalador(txtPortalCriar.Text, @"c:\extrair");

                    operacoes.DirectoryCopy(@"C:\extrair\WinRoot\totvs\CorporeRM", txtNome
                      .Text, true, false);

                    config.criarArquivoConfig(txtNome.Text, false, checkVersao12.Checked, txtPortalCriar);
                    config.deletarBroker(txtNome.Text);
                    ambienteCriadoSucesso();
                }
                criou = true;
            }
            catch (Exception ex)
            {
                criou = false;
                MessageBox.Show(ex.Message);
            }

            return criou;
        }