From 96d9d8fe1fce9a403a986b4e0394883cc93d10d2 Mon Sep 17 00:00:00 2001 From: MoraesCaio Date: Thu, 26 Jan 2017 20:51:04 -0300 Subject: [PATCH] Tratamento do download da lista de sinais --- .gitignore | 1 + AU.csproj | 16 +++++++++------- AU.csproj.user | 6 +++--- BundlesManager.cs | 13 +++++++++---- Program.cs | 15 ++++++++++++--- 5 files changed, 34 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index 2d8c6d5..f46bb18 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ $RECYCLE.BIN/ # pastas a serem ignoradas */ +*.zip # excecoes, adicionar: !foo/ !Properties/ diff --git a/AU.csproj b/AU.csproj index fa3479c..b0afe6c 100644 --- a/AU.csproj +++ b/AU.csproj @@ -12,7 +12,7 @@ v4.5 512 true - C:\Users\Caio Moraes\Documents\AU\release\ + C:\Users\CaioMoraes\Documents\AU\release\ true Web true @@ -22,14 +22,14 @@ false true false - http://atualizacao.vlibras.lavid.ufpb.br/windows/ - http://atualizacao.vlibras.lavid.ufpb.br/windows/ + http://150.165.205.193:8080/ + http://150.165.205.193:8080/ Atualizador VLibras LAVID-UFPB 5.0.0.0 false true - 3 + 20 5.0.0.%2a true true @@ -99,7 +99,9 @@ - + + Component + Form @@ -154,10 +156,10 @@ %(RecursiveDir)%(Filename)%(Extension) false - + diff --git a/AU.csproj.user b/AU.csproj.user index d60af8e..dda2076 100644 --- a/AU.csproj.user +++ b/AU.csproj.user @@ -1,10 +1,10 @@ - C:\Users\Caio Moraes\Documents\AU\release\|http://150.165.205.137:8000/|\\localhost\testeDeAU\|System.Deployment.Application.SystemNetDownloader.DownloadSingleFile%28DownloadQueueItem next%29\|C:\Users\Caio Moraes\Documents\AU\release\publish.htm\ - http://atualizacao.vlibras.lavid.ufpb.br/windows/|http://150.165.205.37/windows/|http://179.185.184.75:8080/|http://179.185.184.75:8080/163.172./|http://150.165.205.137:8080/ + C:\Users\CaioMoraes\Documents\AU\release\|C:\Users\Rebecca\Documents\AU\release\|C:\Users\Caio Moraes\Documents\AU\release\|http://150.165.205.137:8000/|\\localhost\testeDeAU\ + http://150.165.205.193:8080/|http://177.133.106.152:8089/|http://177.133.106.152:8080/|http://192.168.25.121:8089/|http://192.168.26.121:8089/ - http://150.165.205.37/windows/|http://179.185.184.75:8080/|http://150.165.205.137:8080/|http://150.165.205.101:8080/|http://179.185.189.177:8080/ + http://150.165.205.193:8080/|http://177.133.106.152:8089/|http://192.168.25.121:8089/|http://192.168.26.121:8089/|http://127.0.0.1:8000/ pt-BR diff --git a/BundlesManager.cs b/BundlesManager.cs index 6346a10..c592c58 100644 --- a/BundlesManager.cs +++ b/BundlesManager.cs @@ -159,11 +159,16 @@ namespace AtualizadorVLibras{ }*/ public static void DownloadFileIfNewer(string remote, string local, string fileName){ - if(RemoteFileExists(remote+fileName) && (!File.Exists(local+fileName) || RemoteIsNewerThanLocal(remote+fileName, local+fileName))){ - DownloadFileToPath(remote+fileName, local+fileName); - if(File.Exists(local+fileName.Remove(fileName.Length-4))){ - File.Delete(local+fileName.Remove(fileName.Length-4)); + try{ + if(RemoteFileExists(remote+fileName) && (!File.Exists(local+fileName) || RemoteIsNewerThanLocal(remote+fileName, local+fileName))){ + DownloadFileToPath(remote+fileName, local+fileName); + if(File.Exists(local+fileName.Remove(fileName.Length-4))){ + File.Delete(local+fileName.Remove(fileName.Length-4)); + } } + }catch(Exception e){ + Console.WriteLine("Aconteceu um erro no download: "+e); + Console.ReadKey(); } } public static void ExtractZip(string remote, string local, string extractPath, string fileName){ diff --git a/Program.cs b/Program.cs index 43aac24..0ddd0bf 100644 --- a/Program.cs +++ b/Program.cs @@ -37,8 +37,10 @@ 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/"; - string url = @"http://192.168.25.121:8089/"; + //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 dirAtual = Directory.GetCurrentDirectory(); @@ -234,6 +236,14 @@ namespace AtualizadorVLibras //DOWNLOAD DOS SINAIS + Console.WriteLine("Baixando lista de sinais"); + try{ + BundlesManager.DownloadListaSinais(url); + }catch(Exception e){ + Console.WriteLine("Erro no download da lista de sinais.\n{0}\nAperte alguma tecla para continuar.",e); + Console.ReadKey(); + } + //BAIXA OS ZIPS DOS SINAIS (1.ZIP, 2.ZIP E ETC...) extractPath = @"..\Bundles\"; int qtdDeBundles = 0; @@ -251,7 +261,6 @@ namespace AtualizadorVLibras Console.WriteLine("Extraindo pacote de sinais."); //try{ BundlesManager.ExtractBundlesPackagesOverWrite(url, rootPath, extractPath, qtdDeBundles); - BundlesManager.DownloadListaSinais(url); /*}catch(Exception e){ Console.WriteLine("Erro na extração: {0}", e); Console.ReadKey(); -- libgit2 0.21.2