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