From 6dcd8ae5c12e0ce795f88ce9f7c12bd1551d5b54 Mon Sep 17 00:00:00 2001 From: MoraesCaio Date: Sun, 29 Jan 2017 17:16:12 -0300 Subject: [PATCH] Verificação de pastas Python e Bundles --- .gitignore | 1 + BundlesManager.cs | 1 - Program.cs | 28 ++++++++++++++++++---------- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index f46bb18..d676fd6 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ $RECYCLE.BIN/ # pastas a serem ignoradas */ *.zip +*.exe # excecoes, adicionar: !foo/ !Properties/ diff --git a/BundlesManager.cs b/BundlesManager.cs index c592c58..980e181 100644 --- a/BundlesManager.cs +++ b/BundlesManager.cs @@ -199,7 +199,6 @@ namespace AtualizadorVLibras{ if(!exists){ System.IO.Directory.CreateDirectory(extractPath); } - while(qtd > 0){ try{ if(!File.Exists(extractPath+qtd.ToString())){ diff --git a/Program.cs b/Program.cs index 72adb1e..5d513fc 100644 --- a/Program.cs +++ b/Program.cs @@ -39,10 +39,14 @@ namespace AtualizadorVLibras //ENDEREÇO DE ONDE SERÃO BAIXADOS OS PACOTES (.ZIP) DE SINAIS (1.ZIP, 2.ZIP E ETC...) //string url = @"http://atualizacao.vlibras.lavid.ufpb.br/windows/"; //string url = @"http://127.0.0.1:8000/"; //localhost - //string url = @"http://192.168.25.121:8089/"; //local: notebook bk string url = @"http://150.165.205.148:8080/"; //string url = @"http://177.133.106.152:8089/"; //string url = @"http://179.185.184.75:8080/"; + string rootPath = @"..\"; + string pythonPath = @"..\Python\"; + string bundlesPath = @"..\Bundles\"; + string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); + string lnkPath = System.IO.Path.Combine(desktopPath, "VLibras.lnk"); string dirAtual = Directory.GetCurrentDirectory(); string[] buscaDeArquivo; @@ -206,8 +210,14 @@ namespace AtualizadorVLibras Console.ReadKey(); }*/ - string rootPath = @"..\"; - string extractPath = @"..\Python\"; + //CRIAÇÃO DOS DIRETÓRIOS NECESSÁRIOS + if(!Directory.Exists(bundlesPath)){ + Directory.CreateDirectory(bundlesPath); + } + if(!Directory.Exists(pythonPath)){ + Directory.CreateDirectory(pythonPath); + } + //PYTHON PORTÁTIL //Download Console.WriteLine("Baixando cópia portátil do python."); @@ -220,7 +230,7 @@ namespace AtualizadorVLibras //Extração Console.WriteLine("Extraindo cópia portátil do python."); try{ - BundlesManager.ExtractZip(url, rootPath, extractPath, "python.zip"); + BundlesManager.ExtractZip(url, rootPath, pythonPath, "python.zip"); }catch{ Console.WriteLine("Erro no extração do python. Aperte alguma tecla para continuar."); Console.ReadKey(); @@ -235,7 +245,6 @@ namespace AtualizadorVLibras Console.ReadKey(); } - //DOWNLOAD DOS SINAIS Console.WriteLine("Baixando lista de sinais"); try{ @@ -246,11 +255,10 @@ namespace AtualizadorVLibras } //BAIXA OS ZIPS DOS SINAIS (1.ZIP, 2.ZIP E ETC...) - extractPath = @"..\Bundles\"; int qtdDeBundles = 0; Console.WriteLine("Baixando pacote de sinais."); try{ - qtdDeBundles = BundlesManager.DownloadBundlesPackages(url, rootPath, extractPath); + qtdDeBundles = BundlesManager.DownloadBundlesPackages(url, rootPath, bundlesPath); }catch(Exception e){ Console.WriteLine("Erro no download do pacote de sinais.\n{0}\nAperte alguma tecla para continuar.",e); Console.ReadKey(); @@ -261,7 +269,7 @@ namespace AtualizadorVLibras //SE O CAMINHO DE EXTRAÇÃO NÃO EXISTE, ELE SERÁ CRIADO Console.WriteLine("Extraindo pacote de sinais."); //try{ - BundlesManager.ExtractBundlesPackagesOverWrite(url, rootPath, extractPath, qtdDeBundles); + BundlesManager.ExtractBundlesPackagesOverWrite(url, rootPath, bundlesPath, qtdDeBundles); /*}catch(Exception e){ Console.WriteLine("Erro na extração: {0}", e); Console.ReadKey(); @@ -270,10 +278,10 @@ namespace AtualizadorVLibras //CONCLUSÃO Console.WriteLine("Pré-requisitos verificados."); + + //INICIALIZAÇÃO DO PLAYER DialogResult dialogResult = MessageBox.Show("Deseja iniciar o player?", @"Instalação concluída", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes){ - string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); - string lnkPath = System.IO.Path.Combine(desktopPath, "VLibras.lnk"); if(!File.Exists(lnkPath)){ MessageBox.Show("Por favor, execute novamente o Atualizador VLibras e repita o processo.", "Atalho do player não encontrado!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); }else{ -- libgit2 0.21.2