Commit 6dcd8ae5c12e0ce795f88ce9f7c12bd1551d5b54

Authored by MoraesCaio
1 parent 0883d3b9
Exists in Au-ghub/master

Verificação de pastas Python e Bundles

Verifica e cria, se necessário, as pastas Python e Bundles
Showing 3 changed files with 19 additions and 11 deletions   Show diff stats
@@ -20,6 +20,7 @@ $RECYCLE.BIN/ @@ -20,6 +20,7 @@ $RECYCLE.BIN/
20 # pastas a serem ignoradas 20 # pastas a serem ignoradas
21 */ 21 */
22 *.zip 22 *.zip
  23 +*.exe
23 # excecoes, adicionar: !foo/ 24 # excecoes, adicionar: !foo/
24 !Properties/ 25 !Properties/
25 26
BundlesManager.cs
@@ -199,7 +199,6 @@ namespace AtualizadorVLibras{ @@ -199,7 +199,6 @@ namespace AtualizadorVLibras{
199 if(!exists){ 199 if(!exists){
200 System.IO.Directory.CreateDirectory(extractPath); 200 System.IO.Directory.CreateDirectory(extractPath);
201 } 201 }
202 -  
203 while(qtd > 0){ 202 while(qtd > 0){
204 try{ 203 try{
205 if(!File.Exists(extractPath+qtd.ToString())){ 204 if(!File.Exists(extractPath+qtd.ToString())){
@@ -39,10 +39,14 @@ namespace AtualizadorVLibras @@ -39,10 +39,14 @@ namespace AtualizadorVLibras
39 //ENDEREÇO DE ONDE SERÃO BAIXADOS OS PACOTES (.ZIP) DE SINAIS (1.ZIP, 2.ZIP E ETC...) 39 //ENDEREÇO DE ONDE SERÃO BAIXADOS OS PACOTES (.ZIP) DE SINAIS (1.ZIP, 2.ZIP E ETC...)
40 //string url = @"http://atualizacao.vlibras.lavid.ufpb.br/windows/"; 40 //string url = @"http://atualizacao.vlibras.lavid.ufpb.br/windows/";
41 //string url = @"http://127.0.0.1:8000/"; //localhost 41 //string url = @"http://127.0.0.1:8000/"; //localhost
42 - //string url = @"http://192.168.25.121:8089/"; //local: notebook bk  
43 string url = @"http://150.165.205.148:8080/"; 42 string url = @"http://150.165.205.148:8080/";
44 //string url = @"http://177.133.106.152:8089/"; 43 //string url = @"http://177.133.106.152:8089/";
45 //string url = @"http://179.185.184.75:8080/"; 44 //string url = @"http://179.185.184.75:8080/";
  45 + string rootPath = @"..\";
  46 + string pythonPath = @"..\Python\";
  47 + string bundlesPath = @"..\Bundles\";
  48 + string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
  49 + string lnkPath = System.IO.Path.Combine(desktopPath, "VLibras.lnk");
46 50
47 string dirAtual = Directory.GetCurrentDirectory(); 51 string dirAtual = Directory.GetCurrentDirectory();
48 string[] buscaDeArquivo; 52 string[] buscaDeArquivo;
@@ -206,8 +210,14 @@ namespace AtualizadorVLibras @@ -206,8 +210,14 @@ namespace AtualizadorVLibras
206 Console.ReadKey(); 210 Console.ReadKey();
207 }*/ 211 }*/
208 212
209 - string rootPath = @"..\";  
210 - string extractPath = @"..\Python\"; 213 + //CRIAÇÃO DOS DIRETÓRIOS NECESSÁRIOS
  214 + if(!Directory.Exists(bundlesPath)){
  215 + Directory.CreateDirectory(bundlesPath);
  216 + }
  217 + if(!Directory.Exists(pythonPath)){
  218 + Directory.CreateDirectory(pythonPath);
  219 + }
  220 +
211 //PYTHON PORTÁTIL 221 //PYTHON PORTÁTIL
212 //Download 222 //Download
213 Console.WriteLine("Baixando cópia portátil do python."); 223 Console.WriteLine("Baixando cópia portátil do python.");
@@ -220,7 +230,7 @@ namespace AtualizadorVLibras @@ -220,7 +230,7 @@ namespace AtualizadorVLibras
220 //Extração 230 //Extração
221 Console.WriteLine("Extraindo cópia portátil do python."); 231 Console.WriteLine("Extraindo cópia portátil do python.");
222 try{ 232 try{
223 - BundlesManager.ExtractZip(url, rootPath, extractPath, "python.zip"); 233 + BundlesManager.ExtractZip(url, rootPath, pythonPath, "python.zip");
224 }catch{ 234 }catch{
225 Console.WriteLine("Erro no extração do python. Aperte alguma tecla para continuar."); 235 Console.WriteLine("Erro no extração do python. Aperte alguma tecla para continuar.");
226 Console.ReadKey(); 236 Console.ReadKey();
@@ -235,7 +245,6 @@ namespace AtualizadorVLibras @@ -235,7 +245,6 @@ namespace AtualizadorVLibras
235 Console.ReadKey(); 245 Console.ReadKey();
236 } 246 }
237 247
238 -  
239 //DOWNLOAD DOS SINAIS 248 //DOWNLOAD DOS SINAIS
240 Console.WriteLine("Baixando lista de sinais"); 249 Console.WriteLine("Baixando lista de sinais");
241 try{ 250 try{
@@ -246,11 +255,10 @@ namespace AtualizadorVLibras @@ -246,11 +255,10 @@ namespace AtualizadorVLibras
246 } 255 }
247 256
248 //BAIXA OS ZIPS DOS SINAIS (1.ZIP, 2.ZIP E ETC...) 257 //BAIXA OS ZIPS DOS SINAIS (1.ZIP, 2.ZIP E ETC...)
249 - extractPath = @"..\Bundles\";  
250 int qtdDeBundles = 0; 258 int qtdDeBundles = 0;
251 Console.WriteLine("Baixando pacote de sinais."); 259 Console.WriteLine("Baixando pacote de sinais.");
252 try{ 260 try{
253 - qtdDeBundles = BundlesManager.DownloadBundlesPackages(url, rootPath, extractPath); 261 + qtdDeBundles = BundlesManager.DownloadBundlesPackages(url, rootPath, bundlesPath);
254 }catch(Exception e){ 262 }catch(Exception e){
255 Console.WriteLine("Erro no download do pacote de sinais.\n{0}\nAperte alguma tecla para continuar.",e); 263 Console.WriteLine("Erro no download do pacote de sinais.\n{0}\nAperte alguma tecla para continuar.",e);
256 Console.ReadKey(); 264 Console.ReadKey();
@@ -261,7 +269,7 @@ namespace AtualizadorVLibras @@ -261,7 +269,7 @@ namespace AtualizadorVLibras
261 //SE O CAMINHO DE EXTRAÇÃO NÃO EXISTE, ELE SERÁ CRIADO 269 //SE O CAMINHO DE EXTRAÇÃO NÃO EXISTE, ELE SERÁ CRIADO
262 Console.WriteLine("Extraindo pacote de sinais."); 270 Console.WriteLine("Extraindo pacote de sinais.");
263 //try{ 271 //try{
264 - BundlesManager.ExtractBundlesPackagesOverWrite(url, rootPath, extractPath, qtdDeBundles); 272 + BundlesManager.ExtractBundlesPackagesOverWrite(url, rootPath, bundlesPath, qtdDeBundles);
265 /*}catch(Exception e){ 273 /*}catch(Exception e){
266 Console.WriteLine("Erro na extração: {0}", e); 274 Console.WriteLine("Erro na extração: {0}", e);
267 Console.ReadKey(); 275 Console.ReadKey();
@@ -270,10 +278,10 @@ namespace AtualizadorVLibras @@ -270,10 +278,10 @@ namespace AtualizadorVLibras
270 278
271 //CONCLUSÃO 279 //CONCLUSÃO
272 Console.WriteLine("Pré-requisitos verificados."); 280 Console.WriteLine("Pré-requisitos verificados.");
  281 +
  282 + //INICIALIZAÇÃO DO PLAYER
273 DialogResult dialogResult = MessageBox.Show("Deseja iniciar o player?", @"Instalação concluída", MessageBoxButtons.YesNo); 283 DialogResult dialogResult = MessageBox.Show("Deseja iniciar o player?", @"Instalação concluída", MessageBoxButtons.YesNo);
274 if (dialogResult == DialogResult.Yes){ 284 if (dialogResult == DialogResult.Yes){
275 - string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);  
276 - string lnkPath = System.IO.Path.Combine(desktopPath, "VLibras.lnk");  
277 if(!File.Exists(lnkPath)){ 285 if(!File.Exists(lnkPath)){
278 MessageBox.Show("Por favor, execute novamente o Atualizador VLibras e repita o processo.", "Atalho do player não encontrado!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); 286 MessageBox.Show("Por favor, execute novamente o Atualizador VLibras e repita o processo.", "Atalho do player não encontrado!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
279 }else{ 287 }else{