Commit 306dd6757b1bc79db15d211e065cbc3bc5623d1a
1 parent
bd1ba4d6
Exists in
master
Modificado o codigo do modulo update para codigo nativo do proprio inno setup, d…
…escartando todo código python.
Showing
35 changed files
with
1284 additions
and
1124 deletions
Show diff stats
Makefile
| ... | ... | @@ -23,10 +23,10 @@ OUT = testLibras |
| 23 | 23 | |
| 24 | 24 | |
| 25 | 25 | # Arquivos de implementação |
| 26 | -FILES = src\pyTradutor.cpp src\pyClip.cpp update\src\pyVlibrasUpdate.cpp | |
| 26 | +FILES = src\pyTradutor.cpp src\pyClip.cpp update\src\vlibrasUpdate.cpp | |
| 27 | 27 | |
| 28 | 28 | #Headers |
| 29 | -INCLUDES = include\pyTradutor.h include\pyClip.h update\include\pyVlibrasUpdate.h | |
| 29 | +INCLUDES = include\pyTradutor.h include\pyClip.h update\include\vlibrasUpdate.h | |
| 30 | 30 | |
| 31 | 31 | CLEAN_OBJ = del -q *.obj |
| 32 | 32 | |
| ... | ... | @@ -51,7 +51,7 @@ plugin-x64: $(FILES) $(INCLUDES) |
| 51 | 51 | |
| 52 | 52 | #Gera .obj da classe de teste |
| 53 | 53 | testLibras: $(FILES) $(INCLUDES) src\testLibras.cpp |
| 54 | - $(CC) -c -FotestLibras -EHsc Main.cpp $(FILES) $(CFLAGS) $(LFLAGS) | |
| 54 | + $(CC) -c -o testLibras -EHsc $(FILES) $(CFLAGS) $(LFLAGS) | |
| 55 | 55 | |
| 56 | 56 | #Gera.obj do pyTradutor |
| 57 | 57 | pyTradutor: src\pyTradutor.cpp src\pyTradutor.h | ... | ... |
install/devel_install.bat
| ... | ... | @@ -1,89 +0,0 @@ |
| 1 | -::############################## Instalador VLibras ############################ | |
| 2 | -::# # | |
| 3 | -::# Bruno Santos # | |
| 4 | -::# brunosantos@lavid.ufpb.br # | |
| 5 | -::# # | |
| 6 | -::############################################################################## | |
| 7 | - | |
| 8 | -::Define Título da janela do prompt | |
| 9 | -TITLE Instalador VLibras-Core Windows | |
| 10 | - | |
| 11 | -::Limpa a tela | |
| 12 | -CLS | |
| 13 | - | |
| 14 | -::Desabilita mensagens | |
| 15 | -@ECHO off | |
| 16 | - | |
| 17 | -ECHO ############### Instalando VLibras ############### | |
| 18 | - | |
| 19 | -::################# Variáveis de Ambiente ################# | |
| 20 | -:VAR | |
| 21 | -ECHO Deseja Exportar as variaveis de ambiente: (S - N) | |
| 22 | - | |
| 23 | -::Solicita valor do usuário | |
| 24 | -SET /p valor=--^> | |
| 25 | - | |
| 26 | -IF /I %valor% == n GOTO NO_VAR | |
| 27 | -IF /I %valor% == s (ECHO OK!) ELSE (GOTO VAR) | |
| 28 | - | |
| 29 | -ECHO. | |
| 30 | -ECHO Exportando Variaveis de Ambiente: | |
| 31 | -ECHO. | |
| 32 | - | |
| 33 | -::Váriaveis Permanentes (Sistema) | |
| 34 | -ECHO AELIUS_DATA | |
| 35 | -SETX AELIUS_DATA %HOMEPATH%\vlibras-libs\aelius_data /M | |
| 36 | - | |
| 37 | -ECHO NLTK_DATA | |
| 38 | -SETX NLTK_DATA %HOMEPATH%\vlibras-libs\nltk_data /M | |
| 39 | - | |
| 40 | -ECHO HUNPOS_TAGGER | |
| 41 | -SETX HUNPOS_TAGGER %HOMEPATH%\vlibras-libs\bin\hunpos-tag.exe /M | |
| 42 | - | |
| 43 | -ECHO PYTHONPATH | |
| 44 | -SETX PYTHONPATH %HOMEDRIVE%\Python27;%HOMEDRIVE%\Python27\Scripts;%HOMEDRIVE%\Python27\Lib\site-packages;%HOMEPATH%\vlibras-libs;%HOMEPATH%\vlibras-translate\src;%HOMEPATH%\vlibras-core-win\Clipboard /M | |
| 45 | - | |
| 46 | -SETX "PATH" "%PATH%";%HOMEPATH%\vlibras-libs\bin;%HOMEDRIVE%\Python27;%HOMEDRIVE%\Python27\Scripts;%HOMEDRIVE%\Python27\Lib\site-packages /M | |
| 47 | - | |
| 48 | -::Código executa a partir desse ponto caso o usuário não precise configurar as variáveis de ambiente | |
| 49 | -:NO_VAR | |
| 50 | - | |
| 51 | -::################# Instalação do Python ################# | |
| 52 | -:PYTHON | |
| 53 | -ECHO Deseja Instalar o Python-2.7.9: (S - N) | |
| 54 | - | |
| 55 | -SET /p valor=--^> | |
| 56 | -IF /I %valor% == n GOTO NO_PYTHON | |
| 57 | -IF /I %valor% == s (ECHO OK!) ELSE (GOTO PYTHON) | |
| 58 | - | |
| 59 | -msiexec /i python-2.7.9.msi /passive | |
| 60 | - | |
| 61 | -::Código executa a partir desse ponto caso o usuário não precise Instalar o Python | |
| 62 | -:NO_PYTHON | |
| 63 | - | |
| 64 | -::################# Instalação do Aelius ################# | |
| 65 | -:TRADUTOR | |
| 66 | -ECHO Deseja Instalar o VLibras Tradutor (S - N) | |
| 67 | - | |
| 68 | -SET /p valor=--^> | |
| 69 | -IF /I %valor% == n GOTO END | |
| 70 | -IF /I %valor% == s (ECHO OK!) ELSE (GOTO TRADUTOR) | |
| 71 | - | |
| 72 | -pyyaml.exe | |
| 73 | -numpy.exe | |
| 74 | -matplotlib.exe | |
| 75 | -nltk.exe | |
| 76 | - | |
| 77 | -IF NOT EXIST C:"\Program Files (x86)\7-Zip" (msiexec /i 7zip.msi /passive) | |
| 78 | - | |
| 79 | -ECHO 7-Zip instalado com sucesso! | |
| 80 | - | |
| 81 | -COPY C:"\Program Files (x86)\7-Zip\7z.exe" %SYSTEMROOT%\System32 | |
| 82 | - | |
| 83 | -::################# Instalação do VLibras ################# | |
| 84 | - | |
| 85 | -ECHO Extraindo Arquivos... | |
| 86 | -7z x -o%HOMEPATH% vlibras-libs.zip vlibras-libs | |
| 87 | - | |
| 88 | -:END | |
| 89 | -ECHO VLibras Tradutor instalado com sucesso! |
install/inno setup/user_instalBK.bat
| ... | ... | @@ -1,83 +0,0 @@ |
| 1 | -::############################## Instalador VLibras ############################ | |
| 2 | -::# # | |
| 3 | -::# Bruno Santos # | |
| 4 | -::# brunosantos@lavid.ufpb.br # | |
| 5 | -::# # | |
| 6 | -::############################################################################## | |
| 7 | - | |
| 8 | -::Define Título da janela do prompt | |
| 9 | -TITLE Instalador VLibras-Core Windows | |
| 10 | - | |
| 11 | -::Limpa a tela | |
| 12 | -CLS | |
| 13 | - | |
| 14 | -::Desabilita mensagens | |
| 15 | -@ECHO off | |
| 16 | - | |
| 17 | -ECHO ############### Instalando VLibras ############### | |
| 18 | - | |
| 19 | -::################# Variáveis de Ambiente ################# | |
| 20 | -ECHO Exportando Variaveis de Ambiente: | |
| 21 | - | |
| 22 | -ECHO AELIUS_DATA | |
| 23 | -SETX AELIUS_DATA %HOMEDRIVE%\vlibras-libs\aelius_data /M | |
| 24 | - | |
| 25 | -ECHO NLTK_DATA | |
| 26 | -SETX NLTK_DATA %HOMEDRIVE%\vlibras-libs\nltk_data /M | |
| 27 | - | |
| 28 | -ECHO HUNPOS_TAGGER | |
| 29 | -SETX HUNPOS_TAGGER %HOMEDRIVE%\vlibras-libs\bin\hunpos-tag.exe /M | |
| 30 | - | |
| 31 | -ECHO PYTHONPATH | |
| 32 | -SETX PYTHONPATH %HOMEDRIVE%\Python27;%HOMEDRIVE%\Python27\Scripts;%HOMEDRIVE%\Python27\Lib\site-packages;%HOMEDRIVE%\vlibras-libs;%HOMEDRIVE%\vlibras-libs\vlibras-translate\src;%HOMEDRIVE%\vlibras-libs\Clipboard /M | |
| 33 | - | |
| 34 | -@echo off | |
| 35 | -set path_value=%PATH% | |
| 36 | - | |
| 37 | -If NOT "%path_value%"=="%path_value:vlibras=%" ( | |
| 38 | - echo ok | |
| 39 | -) else ( | |
| 40 | - SETX "PATH" "%PATH%";%HOMEDRIVE%\vlibras-libs\bin;%HOMEDRIVE%\Python27;%HOMEDRIVE%\Python27\Scripts;%HOMEDRIVE%\Python27\Lib\site-packages /M | |
| 41 | -) | |
| 42 | - | |
| 43 | -::################# Instalação do Python ################# | |
| 44 | -msiexec /i python-2.7.9.msi /passive | |
| 45 | -ECHO OK | |
| 46 | - | |
| 47 | -::################# Dependências ################# | |
| 48 | -c:\Python27\python.exe pip-6.0.8-py2.py3-none-any.whl/pip install pip-6.0.8-py2.py3-none-any.whl | |
| 49 | -ECHO OK | |
| 50 | - | |
| 51 | -c:\Python27\Scripts\pip install PyYAML-3.11-cp27-none-win32.whl | |
| 52 | -ECHO OK | |
| 53 | - | |
| 54 | -c:\Python27\Scripts\pip install numpy-1.9.2+mkl-cp27-none-win32.whl | |
| 55 | -ECHO OK | |
| 56 | - | |
| 57 | -c:\Python27\Scripts\pip install six-1.9.0-py2.py3-none-any.whl | |
| 58 | -ECHO OK | |
| 59 | - | |
| 60 | -c:\Python27\Scripts\pip install pyparsing-2.0.3-py2-none-any.whl | |
| 61 | -ECHO OK | |
| 62 | - | |
| 63 | -c:\Python27\Scripts\pip install pytz-2014.10-py2.py3-none-any.whl | |
| 64 | -ECHO OK | |
| 65 | - | |
| 66 | -c:\Python27\Scripts\pip install python_dateutil-2.4.0-py2.py3-none-any.whl | |
| 67 | -ECHO OK | |
| 68 | - | |
| 69 | -c:\Python27\Scripts\pip install matplotlib-1.4.3-cp27-none-win32.whl | |
| 70 | -ECHO OK | |
| 71 | - | |
| 72 | -c:\Python27\Scripts\pip install nltk-3.0.2-py2.py3-none-any.whl | |
| 73 | -ECHO OK | |
| 74 | - | |
| 75 | -c:\Python27\Scripts\pip install future-0.14.3-py2-none-any.whl | |
| 76 | -ECHO OK | |
| 77 | - | |
| 78 | -::################# HUNPOS.PY & DATA.PY ############################# | |
| 79 | -COPY %HOMEDRIVE%\vlibras-libs\nltk_data\hunpos.py %homedrive%\Python27\Lib\site-packages\nltk\tag\ /y | |
| 80 | -COPY %HOMEDRIVE%\vlibras-libs\nltk_data\data.py %homedrive%\Python27\Lib\site-packages\nltk /y | |
| 81 | -COPY %HOMEDRIVE%\vlibras-libs\nltk_data\nltk_tgrep.py %homedrive%\Python27\Lib\site-packages /y | |
| 82 | - | |
| 83 | -ECHO VLibras Tradutor instalado com sucesso! |
| ... | ... | @@ -0,0 +1,132 @@ |
| 1 | +::############################## Instalador VLibras ############################ | |
| 2 | +::# # | |
| 3 | +::# Bruno Santos # | |
| 4 | +::# brunosantos@lavid.ufpb.br | |
| 5 | +::# Ezequiel Silva # | |
| 6 | +::# ezequielsilva@lavid.ufpb.br # | |
| 7 | +::# # | |
| 8 | +::############################################################################## | |
| 9 | + | |
| 10 | +::Define Título da janela do prompt | |
| 11 | +TITLE Instalador VLibras Windows | |
| 12 | + | |
| 13 | +::Limpa a tela | |
| 14 | +CLS | |
| 15 | + | |
| 16 | +::Desabilita mensagens | |
| 17 | +@ECHO off | |
| 18 | + | |
| 19 | +ECHO ############### Instalando VLibras ############### | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | +set PATH_VLIBRAS="%HOMEDRIVE%\VLibras" | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | +::################# Variáveis de Ambiente ################# | |
| 29 | +ECHO Exportando Variaveis de Ambiente: | |
| 30 | + | |
| 31 | +ECHO AELIUS_DATA | |
| 32 | +SETX AELIUS_DATA %PATH_VLIBRAS%\aelius_data /M | |
| 33 | + | |
| 34 | +ECHO NLTK_DATA | |
| 35 | +SETX NLTK_DATA %PATH_VLIBRAS%\nltk_data /M | |
| 36 | + | |
| 37 | +ECHO HUNPOS_TAGGER | |
| 38 | +SETX HUNPOS_TAGGER %PATH_VLIBRAS%\bin\hunpos-tag.exe /M | |
| 39 | + | |
| 40 | +ECHO TRANSLATE_DATA | |
| 41 | +SETX TRANSLATE_DATA %PATH_VLIBRAS%\translate\data /M | |
| 42 | + | |
| 43 | +ECHO PYTHONPATH | |
| 44 | +SETX PYTHONPATH %HOMEDRIVE%\Python27;%HOMEDRIVE%\Python27\Scripts;%HOMEDRIVE%\Python27\Lib\site-packages;%PATH_VLIBRAS%;%PATH_VLIBRAS%\bin;%PATH_VLIBRAS%\translate\src;%PATH_VLIBRAS%\Clipboard;%PATH_VLIBRAS%\update;%PATH_VLIBRAS%\nltk_data;%PATH_VLIBRAS%\Aelius /M | |
| 45 | + | |
| 46 | +@echo off | |
| 47 | +set path_value=%PATH% | |
| 48 | + | |
| 49 | +::ECHO PATH | |
| 50 | +::SETX PATH %PATH_VLIBRAS%\bin;%HOMEDRIVE%\Python27;%HOMEDRIVE%\Python27\Scripts;%HOMEDRIVE%\Python27\Lib\site-packages /M | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | +SET MYPATHCOPY=%PATH% | |
| 57 | +SET PATH_COPY= | |
| 58 | +SET ENCONTRADO="NO" | |
| 59 | + | |
| 60 | + | |
| 61 | +:search | |
| 62 | +for /f "delims=; tokens=1,2*" %%p in ("%MYPATHCOPY%") do ( | |
| 63 | + | |
| 64 | + ECHO.%%~p | FIND /I "ibras" >Nul && ( | |
| 65 | + Echo %%~p | |
| 66 | + ) || ( | |
| 67 | + | |
| 68 | + ECHO.%%~p | FIND /I "Python27" >Nul && ( | |
| 69 | + Echo %%~p | |
| 70 | + ) || ( | |
| 71 | + SET "PATH_COPY=%%~p;%PATH_COPY%" | |
| 72 | + ) | |
| 73 | + ) | |
| 74 | + | |
| 75 | + SET MYPATHCOPY=%%~q;%%~r | |
| 76 | +) | |
| 77 | + | |
| 78 | +if "%MYPATHCOPY%"==";" goto done; | |
| 79 | +goto search; | |
| 80 | + | |
| 81 | +:done | |
| 82 | + | |
| 83 | + | |
| 84 | +SETX "PATH" "%PATH_COPY%;%%PYTHONPATH%%" /M | |
| 85 | +SETX "PATH" "%PATH_COPY%;%%PYTHONPATH%%" | |
| 86 | + | |
| 87 | +echo %PATH% | |
| 88 | + | |
| 89 | +::################# Instalação do Python ################# | |
| 90 | +::msiexec /i python-2.7.9.msi /passive | |
| 91 | +::ECHO OK | |
| 92 | + | |
| 93 | +::################# Dependências ################# | |
| 94 | + | |
| 95 | + | |
| 96 | +c:\Python27\python.exe pip-6.0.8-py2.py3-none-any.whl/pip install pip-6.0.8-py2.py3-none-any.whl | |
| 97 | +ECHO OK | |
| 98 | + | |
| 99 | + | |
| 100 | +c:\Python27\Scripts\pip install PyYAML-3.11-cp27-none-win32.whl | |
| 101 | +ECHO OK | |
| 102 | + | |
| 103 | +c:\Python27\Scripts\pip install numpy-1.9.2+mkl-cp27-none-win32.whl | |
| 104 | +ECHO OK | |
| 105 | + | |
| 106 | +c:\Python27\Scripts\pip install six-1.9.0-py2.py3-none-any.whl | |
| 107 | +ECHO OK | |
| 108 | + | |
| 109 | +c:\Python27\Scripts\pip install pyparsing-2.0.3-py2-none-any.whl | |
| 110 | +ECHO OK | |
| 111 | + | |
| 112 | +c:\Python27\Scripts\pip install pytz-2014.10-py2.py3-none-any.whl | |
| 113 | +ECHO OK | |
| 114 | + | |
| 115 | +c:\Python27\Scripts\pip install python_dateutil-2.4.0-py2.py3-none-any.whl | |
| 116 | +ECHO OK | |
| 117 | + | |
| 118 | +c:\Python27\Scripts\pip install matplotlib-1.4.3-cp27-none-win32.whl | |
| 119 | +ECHO OK | |
| 120 | + | |
| 121 | +c:\Python27\Scripts\pip install nltk-3.0.2-py2.py3-none-any.whl | |
| 122 | +ECHO OK | |
| 123 | + | |
| 124 | +c:\Python27\Scripts\pip install future-0.14.3-py2-none-any.whl | |
| 125 | +ECHO OK | |
| 126 | + | |
| 127 | +::################# HUNPOS.PY & DATA.PY ############################# | |
| 128 | +COPY %PATH_VLIBRAS%\nltk_data\hunpos.py %homedrive%\Python27\Lib\site-packages\nltk\tag\ /y | |
| 129 | +COPY %PATH_VLIBRAS%\nltk_data\data.py %homedrive%\Python27\Lib\site-packages\nltk /y | |
| 130 | +COPY %PATH_VLIBRAS%\nltk_data\nltk_tgrep.py %homedrive%\Python27\Lib\site-packages /y | |
| 131 | + | |
| 132 | +ECHO VLibras Tradutor instalado com sucesso! | ... | ... |
install/inno setup/user_install.iss
| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | ;##################################################################### |
| 7 | 7 | |
| 8 | 8 | #define MyAppName "VLibras" |
| 9 | -#define MyAppVersion "3.0.0" | |
| 9 | +#define MyAppVersion "4.0.0" | |
| 10 | 10 | #define MyAppPublisher "LAViD" |
| 11 | 11 | #define MyAppURL "http://vlibrasplayer.lavid.ufpb.br" |
| 12 | 12 | #define MyAppExeName "VlibrasPlayer.exe" |
| ... | ... | @@ -14,24 +14,25 @@ |
| 14 | 14 | |
| 15 | 15 | |
| 16 | 16 | [Setup] |
| 17 | -AppId={{9AA2CD86-F136-47FA-9EFE-474057F0C45F} | |
| 17 | +AppId= {{84B73167-EF7F-42BB-9CCD-E1A8E2C53659-vlibras} | |
| 18 | +;AppId={{B3EAE3FB-FD9B-4877-8430-B7F5C2940EC2} | |
| 18 | 19 | AppName={#MyAppName} |
| 19 | 20 | AppVersion={#MyAppVersion} |
| 20 | 21 | AppPublisher={#MyAppPublisher} |
| 21 | 22 | AppPublisherURL={#MyAppURL} |
| 22 | 23 | AppSupportURL={#MyAppURL} |
| 23 | 24 | AppUpdatesURL={#MyAppURL} |
| 24 | -DefaultDirName={pf}\VLibras | |
| 25 | +DefaultDirName={sd}\VLibras | |
| 25 | 26 | DisableDirPage=yes |
| 26 | 27 | DefaultGroupName={#MyAppName} |
| 27 | -OutputBaseFilename=vlibras_instalador_3.0.0 | |
| 28 | +OutputBaseFilename=vlibras_instalador_4.0.0 | |
| 28 | 29 | DisableProgramGroupPage=yes |
| 29 | -OutputDir="C:\Users\ezequiel\Desktop\vlibras_installer_3.0.0" | |
| 30 | -SetupIconFile="C:\Users\ezequiel\Desktop\user_install\icons\icon_vlibras.ico" | |
| 30 | +OutputDir="vlibras_installer_4.0.0" | |
| 31 | +SetupIconFile="icon\icon_vlibras.ico" | |
| 31 | 32 | Compression=lzma |
| 32 | 33 | SolidCompression=yes |
| 33 | -WizardImageFile = "C:\Users\ezequiel\Desktop\user_install\icons\avatar.bmp" | |
| 34 | -WizardSmallImageFile = "C:\Users\ezequiel\Desktop\user_install\icons\player.bmp" | |
| 34 | +WizardImageFile = "user_install\icons\avatar.bmp" | |
| 35 | +WizardSmallImageFile = "user_install\icons\player.bmp" | |
| 35 | 36 | |
| 36 | 37 | |
| 37 | 38 | |
| ... | ... | @@ -43,27 +44,52 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{ |
| 43 | 44 | Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; OnlyBelowVersion: 0,6.1 |
| 44 | 45 | |
| 45 | 46 | [Files] |
| 46 | - | |
| 47 | -;Source: "C:\Users\ezequiel\Desktop\dotnetfx45_full_x86_x64.exe"; DestDir: "{tmp}"; Flags: ignoreversion deleteafterinstall; | |
| 48 | -Source: "C:\Users\ezequiel\Desktop\user_install\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs | |
| 49 | - | |
| 50 | - | |
| 47 | + ;Source: itdownload.dll; Flags: dontcopy; DestDir: {tmp} | |
| 48 | + ;Source: "Player\*"; DestDir: "{app}\Player"; Flags: ignoreversion recursesubdirs createallsubdirs; | |
| 49 | + ;Source: "wx_3.0.exe"; DestDir: "{tmp}"; Flags: ignoreversion deleteafterinstall; | |
| 50 | + Source: "python-2.7.9.msi"; DestDir: "{tmp}"; Flags: ignoreversion deleteafterinstall; | |
| 51 | + Source: "user_install\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; | |
| 52 | + Source: "required\*"; DestDir: "{tmp}\required"; Flags: ignoreversion recursesubdirs createallsubdirs deleteafterinstall | |
| 51 | 53 | |
| 52 | 54 | |
| 53 | 55 | [Icons] |
| 54 | 56 | Name: "{group}\{#MyAppName}"; Filename: "{app}\Player\{#MyAppExeName}"; IconFilename: "{app}\icons\icon_vlibras.ico" |
| 55 | 57 | Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}" |
| 56 | 58 | Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}" |
| 57 | -Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\Player\{#MyAppExeName}"; Tasks: desktopicon; IconFilename: "{app}\icons\icon_vlibras.ico" | |
| 58 | -Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\Player\{#MyAppExeName}"; Tasks: quicklaunchicon; IconFilename: "{app}\icons\icon_vlibras.ico" | |
| 59 | +Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\Player\{#MyAppExeName}"; Parameters: -single-instance; Tasks: desktopicon; IconFilename: "{app}\icons\icon_vlibras.ico" | |
| 60 | +Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\Player\{#MyAppExeName}"; Tasks: quicklaunchicon; IconFilename: "{app}\icons\icon_vlibras.ico" | |
| 59 | 61 | |
| 60 | 62 | [Run] |
| 61 | -Filename: {app}\required\user_install.bat; Flags: runhidden; StatusMsg: Finalizando Instalação... | |
| 62 | -Filename: {app}\update\vlibrasDictUp.exe; StatusMsg: Instalando atualização... | |
| 63 | 63 | |
| 64 | +Filename: msiexec ; Flags: runhidden; Parameters: /i {tmp}\python-2.7.9.msi /passive; StatusMsg: Instalando python-2.7.9... | |
| 65 | +Filename: {tmp}\required\user_install.bat; Flags: runhidden; StatusMsg: Instalando dependências... | |
| 66 | +;Filename: {tmp}\wx_3.0.exe; Flags: runhidden; Parameters: /VERYSILENT /SUPPRESSMSGBOXES /NORESTART; StatusMsg: Instalando wx | |
| 67 | +;Filename: {app}\update\bin\writeSucess.exe; Flags: runhidden; StatusMsg: Finalizando | |
| 68 | +;Filename: {app}\update\bin\vlibrasDictUp.exe; Flags: runhidden; StatusMsg: Instalando atualização | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | +[Code] | |
| 73 | + | |
| 74 | +procedure CurStepChanged(CurStep: TSetupStep); | |
| 75 | + | |
| 76 | +var | |
| 77 | + ErrorCode: Integer; | |
| 78 | +begin | |
| 64 | 79 | |
| 65 | - | |
| 80 | + if CurStep = ssDone then | |
| 81 | + begin | |
| 82 | + //chama o instalador baixado | |
| 83 | + if not ShellExec('', ExpandConstant('{app}\update\bin\DicionarioUpdate.exe'), '', '', SW_SHOW, ewNoWait, ErrorCode) then | |
| 84 | + begin | |
| 85 | + MsgBox('Houve um erro ao Instalar Dicionário ', mbError, MB_OK); | |
| 86 | + end; | |
| 87 | + end; | |
| 66 | 88 | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 67 | 92 | |
| 93 | +end; | |
| 68 | 94 | |
| 69 | 95 | ... | ... |
install/inno setup/user_install2.iss
| ... | ... | @@ -1,51 +0,0 @@ |
| 1 | -;################### INSTALADOR VLIBRAS WINDOWS ###################### | |
| 2 | -;# Bruno Santos # | |
| 3 | -;# brunosantos@lavid.ufpb.br # | |
| 4 | -;##################################################################### | |
| 5 | - | |
| 6 | -#define MyAppName "VLibras" | |
| 7 | -#define MyAppVersion "beta" | |
| 8 | -#define MyAppPublisher "LAViD" | |
| 9 | -#define MyAppURL "http://vlibrasplayer.lavid.ufpb.br" | |
| 10 | -#define MyAppExeName "Playerx86.exe" | |
| 11 | - | |
| 12 | -[Setup] | |
| 13 | -AppId={{84B73167-EF7F-42BB-9CCD-E1A8E2C53659} | |
| 14 | -AppName={#MyAppName} | |
| 15 | -AppVersion={#MyAppVersion} | |
| 16 | -AppPublisher={#MyAppPublisher} | |
| 17 | -AppPublisherURL={#MyAppURL} | |
| 18 | -AppSupportURL={#MyAppURL} | |
| 19 | -AppUpdatesURL={#MyAppURL} | |
| 20 | -DefaultDirName={pf}\vlibras-libs | |
| 21 | -DisableDirPage=yes | |
| 22 | -DefaultGroupName={#MyAppName} | |
| 23 | -DisableProgramGroupPage=yes | |
| 24 | -OutputDir="C:\Users\ezequiel\Desktop\output" | |
| 25 | -OutputBaseFilename=VLibras Installer | |
| 26 | -SetupIconFile="C:\Users\ezequiel\vlibras-libs\icons\icon_vlibras.ico" | |
| 27 | -Compression=lzma | |
| 28 | -SolidCompression=yes | |
| 29 | -WizardImageFile = "C:\Users\ezequiel\vlibras-libs\icons\avatar.bmp" | |
| 30 | -WizardSmallImageFile = "C:\Users\ezequiel\vlibras-libs\icons\small2.bmp" | |
| 31 | - | |
| 32 | -[Languages] | |
| 33 | -Name: "brazilianportuguese"; MessagesFile: "compiler:Languages\BrazilianPortuguese.isl" | |
| 34 | - | |
| 35 | -[Tasks] | |
| 36 | -Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}" | |
| 37 | -Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; OnlyBelowVersion: 0,6.1 | |
| 38 | - | |
| 39 | -[Files] | |
| 40 | -Source: "C:\vlibras-libs\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs | |
| 41 | - | |
| 42 | -[Icons] | |
| 43 | -Name: "{group}\{#MyAppName}"; Filename: "{app}\Player\{#MyAppExeName}"; IconFilename: "{app}\icons\icon_vlibras.ico" | |
| 44 | -Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}" | |
| 45 | -Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}" | |
| 46 | -Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\Player\{#MyAppExeName}"; Tasks: desktopicon; IconFilename: "{app}\icons\icon_vlibras.ico" | |
| 47 | -Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\Player\{#MyAppExeName}"; Tasks: quicklaunchicon; IconFilename: "{app}\icons\icon_vlibras.ico" | |
| 48 | - | |
| 49 | -[Run] | |
| 50 | -Filename: {app}\vlibras-libs\required\user_install.bat; Flags: runhidden | |
| 51 | - |
plugin/corePlugin.cpp
| ... | ... | @@ -8,21 +8,79 @@ |
| 8 | 8 | #include "corePlugin.h" |
| 9 | 9 | #include <time.h> |
| 10 | 10 | |
| 11 | + | |
| 11 | 12 | using namespace std; |
| 12 | 13 | |
| 14 | + ofstream logfile; | |
| 15 | + | |
| 13 | 16 | |
| 14 | - extern "C" | |
| 17 | +//Assinatura do método itd_downloadfile utilizado na dll | |
| 18 | +typedef int (WINAPI*download)(char * arg1, char * arg2); | |
| 19 | +download itd_downloadfile; | |
| 20 | + | |
| 21 | +//usado para representar as versoes tanto da api quanto local | |
| 22 | +typedef struct Versions | |
| 15 | 23 | { |
| 24 | + char versionDicionario[7]={'0','0','0','0','0','0','\0'}; | |
| 25 | + char versionPlayer[4]={'0','0','0','\0'}; | |
| 26 | +} Version; | |
| 27 | + | |
| 28 | +// usado para carregar os jsons de versoes | |
| 29 | +Version loadVersion(char* pPathTempJson) | |
| 30 | +{ | |
| 31 | + Version version; | |
| 32 | + string line_in_str; | |
| 33 | + ifstream file_versionApi; | |
| 34 | + int i; | |
| 35 | + try | |
| 36 | + { | |
| 37 | + file_versionApi.open(pPathTempJson); | |
| 38 | + while ( getline (file_versionApi, line_in_str) ) | |
| 39 | + { | |
| 40 | + if(strstr(line_in_str.c_str(), "playerVersion")){ | |
| 41 | + i = 0; | |
| 42 | + for (char & c : line_in_str) | |
| 43 | + if(isdigit(c)) | |
| 44 | + version.versionPlayer[i++]=c; | |
| 45 | + version.versionPlayer[i]='\0'; | |
| 46 | + } | |
| 47 | + else if(strstr(line_in_str.c_str(), "dictionaryVersion")){ | |
| 48 | + | |
| 49 | + i = 0; | |
| 50 | + for (char & c : line_in_str) | |
| 51 | + if(isdigit(c)) | |
| 52 | + version.versionDicionario[i++]=c; | |
| 53 | + version.versionDicionario[i]='\0'; | |
| 54 | + } | |
| 55 | + } | |
| 56 | + file_versionApi.close(); | |
| 57 | + } | |
| 58 | + catch (exception e) | |
| 59 | + { | |
| 60 | + | |
| 61 | + } | |
| 62 | + return version; | |
| 63 | +} | |
| 64 | + | |
| 16 | 65 | |
| 17 | - | |
| 66 | + extern "C" | |
| 67 | +{ | |
| 68 | + | |
| 18 | 69 | EXPORT_API int coreInitialize() |
| 19 | 70 | { |
| 20 | 71 | //Objeto usado para traduzir |
| 21 | 72 | tradutor = new PyTradutor(); |
| 22 | - update = new PyVlibrasUpdate(); | |
| 73 | + update = new VlibrasUpdate(); | |
| 23 | 74 | //Objeto usado para copiar texto da área de transferência |
| 24 | 75 | clipboard.bdragOn(); |
| 25 | - | |
| 76 | + logfile.open ("C:\\VLibras\\update\\log.txt"); | |
| 77 | + pPathTempJson ="c:\\VLibras\\update\\VLibrasVersionApi.json"; | |
| 78 | + pPathVlibrasJson = "c:\\VLibras\\version.json"; | |
| 79 | + //Carrega a dll | |
| 80 | + hDLL1 = LoadLibrary("c:\\VLibras\\update\\plugins\\itdownload.dll"); | |
| 81 | + //Relaciona método local com o método implementado na dll | |
| 82 | + itd_downloadfile=(download)GetProcAddress((HMODULE)hDLL1, "itd_downloadfile"); | |
| 83 | + | |
| 26 | 84 | return 1; |
| 27 | 85 | } |
| 28 | 86 | |
| ... | ... | @@ -38,7 +96,7 @@ using namespace std; |
| 38 | 96 | |
| 39 | 97 | EXPORT_API int coreUpdateInstall_player() |
| 40 | 98 | { |
| 41 | - update->install("c:\\vlibras-libs\\update\\vlibrasPlayerUp.exe","NULL"); | |
| 99 | + update->install("C:\\VLibras\\update\\bin\\PlayerUpdate.exe","NULL"); | |
| 42 | 100 | |
| 43 | 101 | return 1; |
| 44 | 102 | } |
| ... | ... | @@ -46,7 +104,7 @@ using namespace std; |
| 46 | 104 | |
| 47 | 105 | EXPORT_API int coreUpdateInstall_dict() |
| 48 | 106 | { |
| 49 | - update->install("c:\\vlibras-libs\\update\\bin\\vlibrasDictUp.exe","NULL"); | |
| 107 | + update->install("C:\\VLibras\\update\\bin\\DicionarioUpdate.exe","NULL"); | |
| 50 | 108 | |
| 51 | 109 | return 1; |
| 52 | 110 | } |
| ... | ... | @@ -54,37 +112,50 @@ using namespace std; |
| 54 | 112 | |
| 55 | 113 | EXPORT_API int coreUpdateCheck() |
| 56 | 114 | { |
| 57 | - | |
| 58 | - string line_in_str; | |
| 59 | - ifstream file_version; | |
| 60 | - int return_int = -1; | |
| 61 | - try | |
| 62 | - { | |
| 63 | - update->checkExe("C:\\Python27\\python.exe c:\\vlibras-libs\\update\\py\\VlibrasCheckVersion.pyc","check"); | |
| 64 | - | |
| 65 | - clock_t time_end; | |
| 115 | + | |
| 116 | + if (!hDLL1){ | |
| 117 | + logfile <<__TIMESTAMP__<< " --> Não carregou dll itdownload.dll.\n"; | |
| 118 | + return -1; | |
| 119 | + } | |
| 120 | + | |
| 121 | + //faz download do json de versao | |
| 122 | + int codDownload = itd_downloadfile("http://vlibras.lavid.ufpb.br/api/dicionario/0.0.0_0.0.0?type=json",pPathTempJson); | |
| 123 | + | |
| 124 | + clock_t time_end; | |
| 66 | 125 | time_end = clock() + 3000 * CLOCKS_PER_SEC/1000; |
| 67 | 126 | while (clock() < time_end); |
| 68 | - | |
| 69 | - | |
| 70 | - file_version.open("c:\\vlibras-libs\\update\\version\\version.txt"); | |
| 127 | + | |
| 128 | + //verifica se existe os dois arquivos de versao | |
| 129 | + if(!ifstream(pPathTempJson) || !ifstream(pPathVlibrasJson) || (codDownload > 0 )){ | |
| 130 | + | |
| 131 | + logfile <<__TIMESTAMP__ <<" --> codDownload: "<<codDownload<<".\n"; | |
| 132 | + //return -1; | |
| 133 | + } | |
| 134 | + | |
| 135 | + Version versionApi = loadVersion(pPathTempJson); | |
| 136 | + Version versionLocal = loadVersion(pPathVlibrasJson); | |
| 137 | + | |
| 138 | + // compara as versoes (return '0' para nao tem attualizacao, '1' para player e '2' para dicionario) | |
| 139 | + if(atoi(versionApi.versionPlayer)> atoi(versionLocal.versionPlayer)) | |
| 140 | + return 1; | |
| 141 | + else if(atoi(versionApi.versionDicionario)> atoi(versionLocal.versionDicionario)) | |
| 142 | + return 2; | |
| 143 | + else | |
| 144 | + return 0; | |
| 145 | + logfile <<__TIMESTAMP__ <<" --> codDownload2: "<<codDownload<<".\n"; | |
| 146 | + | |
| 71 | 147 | |
| 72 | - getline(file_version, line_in_str); | |
| 73 | - file_version.close(); | |
| 74 | - return_int = atoi(line_in_str.c_str()); | |
| 75 | - | |
| 76 | - return return_int; | |
| 77 | - } | |
| 78 | - catch (exception e) | |
| 79 | - { | |
| 80 | - return -1; | |
| 81 | - } | |
| 82 | - return return_int; | |
| 148 | + | |
| 149 | + return 0; | |
| 83 | 150 | } |
| 84 | 151 | |
| 85 | 152 | EXPORT_API int coreFinalize() |
| 86 | 153 | { |
| 87 | - clipboard.bdragOff(); | |
| 154 | + | |
| 155 | + logfile.close(); | |
| 156 | + clipboard.bdragOff(); | |
| 157 | + //Libera dll | |
| 158 | + FreeLibrary((HMODULE)hDLL1); | |
| 88 | 159 | delete tradutor; |
| 89 | 160 | delete update; |
| 90 | 161 | return 1; | ... | ... |
plugin/corePlugin.h
| ... | ... | @@ -21,9 +21,11 @@ VLibras-Core |
| 21 | 21 | |
| 22 | 22 | #include "pyClip.h" |
| 23 | 23 | #include "pyTradutor.h" |
| 24 | -#include "pyVlibrasUpdate.h" | |
| 24 | +#include "vlibrasUpdate.h" | |
| 25 | 25 | #include <fstream> |
| 26 | 26 | #include <string> |
| 27 | +#include <cstdlib> | |
| 28 | + | |
| 27 | 29 | |
| 28 | 30 | |
| 29 | 31 | using namespace std; |
| ... | ... | @@ -38,7 +40,14 @@ extern "C" |
| 38 | 40 | PyClip clipboard; |
| 39 | 41 | |
| 40 | 42 | //Usado para verificar se existe atualização |
| 41 | - PyVlibrasUpdate *update; | |
| 43 | + VlibrasUpdate *update; | |
| 44 | + | |
| 45 | + HINSTANCE hDLL1; | |
| 46 | + | |
| 47 | + char* pPathTempJson; | |
| 48 | + | |
| 49 | + char* pPathVlibrasJson; | |
| 50 | + | |
| 42 | 51 | |
| 43 | 52 | //Inicializa Objetos |
| 44 | 53 | EXPORT_API int coreInitize(void); | ... | ... |
| ... | ... | @@ -0,0 +1,173 @@ |
| 1 | + | |
| 2 | +#define MyAppName "Atualização - VLibras Dicionário" | |
| 3 | +#define MyAppVersion "3.0.0" | |
| 4 | +#define MyAppPublisher "LAViD" | |
| 5 | +#define MyAppURL "http://vlibrasplayer.lavid.ufpb.br" | |
| 6 | +#define MyAppExeName "VlibrasDicionario.exe" | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | +[Setup] | |
| 11 | + | |
| 12 | +Uninstallable = no | |
| 13 | +AppName={#MyAppName} | |
| 14 | +AppVersion={#MyAppVersion} | |
| 15 | +AppPublisher={#MyAppPublisher} | |
| 16 | +AppPublisherURL={#MyAppURL} | |
| 17 | +AppSupportURL={#MyAppURL} | |
| 18 | +AppUpdatesURL={#MyAppURL} | |
| 19 | +DefaultDirName={sd}\VLibras\update | |
| 20 | +DisableDirPage=yes | |
| 21 | +DisableWelcomePage=yes | |
| 22 | +DefaultGroupName={#MyAppName} | |
| 23 | +OutputBaseFilename=DicionarioUpdate | |
| 24 | +DisableProgramGroupPage=yes | |
| 25 | +DisableFinishedPage=no | |
| 26 | +OutputDir="DicionaryUpdate" | |
| 27 | +SetupIconFile="icon\icon_vlibras.ico" | |
| 28 | +Compression=lzma | |
| 29 | +SolidCompression=yes | |
| 30 | +WizardImageFile = "icon\avatar.bmp" | |
| 31 | +WizardSmallImageFile = "icon\player.bmp" | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | +[Languages] | |
| 36 | +Name: "brazilianportuguese"; MessagesFile: "compiler:Languages\BrazilianPortuguese.isl" | |
| 37 | + | |
| 38 | + | |
| 39 | +[Files] | |
| 40 | +Source: it_download\languages\itd_ptbr.ini; Flags: dontcopy | |
| 41 | + | |
| 42 | +#include "it_download\it_download.iss"; | |
| 43 | +#include "vlibrasJsonParse.iss"; | |
| 44 | +#include "unzip.iss"; | |
| 45 | + | |
| 46 | +[CustomMessages] | |
| 47 | + ErrorJson=A {#MyAppName} não conseguiu conexão com a internet.%nFavor verifique sua conexão e tente novamente.%n%n | |
| 48 | + DownloadFinalizado=A nova versão do VLibras foi baixado com sucesso .%nSiga os proximos passos para instalar essa nova versão em seu computador.%n%n | |
| 49 | + FinalizarApp=O instalador de atualização será encerrado. | |
| 50 | + VersaoJaAtualizada=Não existe {#MyAppName} disponível%n Sua versão Já está atualizada!%n%n | |
| 51 | + | |
| 52 | + | |
| 53 | +[Code] | |
| 54 | + | |
| 55 | +var | |
| 56 | +//url do dicionario a ser baixado | |
| 57 | +Url: string; | |
| 58 | +// a versão do dicionario a ser baixado | |
| 59 | +VersionDicionaryApi: string; | |
| 60 | +// a versão do dicionario instalado | |
| 61 | +VersionDicionaryLocal: string; | |
| 62 | + | |
| 63 | + | |
| 64 | +//chamado ao inicializar o instalador | |
| 65 | +procedure InitializeWizard(); | |
| 66 | + | |
| 67 | +begin | |
| 68 | + //adciona o titulo na janela | |
| 69 | + WizardForm.Caption := '{#MyAppName}'; | |
| 70 | + //extrai o arquivo de tradução do ITD_download | |
| 71 | + ExtractTemporaryFile('itd_ptbr.ini'); | |
| 72 | + | |
| 73 | + //carrega o arquivo de traduçao PT-BR | |
| 74 | + ITD_LoadStrings(expandconstant('{tmp}\itd_ptbr.ini')); | |
| 75 | + | |
| 76 | + | |
| 77 | + //busca no json baixado, a url do dicionario a ser baixado | |
| 78 | + Url := jsonVersionGetValue(ExpandConstant('{tmp}\file.json'),'dictionaryUrl'); | |
| 79 | + | |
| 80 | + //verifica se existe uma url válida | |
| 81 | + if not (Url = 'null') | |
| 82 | + then | |
| 83 | + //função da dll ITD_download adciona arquivo para ser baixado | |
| 84 | + itd_addfile(Url,ExpandConstant('{sd}\VLibras\update\download\VlibrasDicionario.zip')); | |
| 85 | + | |
| 86 | + //inicia o download e mostra as informações na tela | |
| 87 | + itd_downloadafter(wpReady); | |
| 88 | + | |
| 89 | + | |
| 90 | +end; | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | +function InitializeSetup: Boolean; | |
| 95 | + | |
| 96 | +var | |
| 97 | +codDownloadJson: Integer; | |
| 98 | +versaoDictApiInteger: Integer; | |
| 99 | +versaoDictLocalInteger: Integer; | |
| 100 | +tempVersion: string; | |
| 101 | + | |
| 102 | +begin | |
| 103 | + | |
| 104 | + //busca a versão atual do dicionario local | |
| 105 | + VersionDicionaryLocal:= jsonVersionGetValue(ExpandConstant('{sd}\VLibras\version.json'),'dictionaryVersion'); | |
| 106 | + tempVersion:= VersionDicionaryLocal; | |
| 107 | + StringChangeEx(tempVersion, '.', '', True); | |
| 108 | + StringChangeEx(tempVersion, '_', '', True); | |
| 109 | + | |
| 110 | + | |
| 111 | + versaoDictLocalInteger:= StrToInt(tempVersion); | |
| 112 | + | |
| 113 | + //faz o download do json contendo as versoes disponiveis | |
| 114 | + codDownloadJson:= ITD_DownloadFile('http://vlibras.lavid.ufpb.br/api/dicionario/'+VersionDicionaryLocal+'?type=json',expandconstant('{tmp}\file.json')); | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + //busca no json baixado, a versão do dicionario a ser baixado | |
| 119 | + VersionDicionaryApi:= jsonVersionGetValue(ExpandConstant('{tmp}\file.json'),'dictionaryVersion'); | |
| 120 | + | |
| 121 | + tempVersion:= VersionDicionaryApi; | |
| 122 | + StringChangeEx(tempVersion, '.', '', True); | |
| 123 | + StringChangeEx(tempVersion, '_', '', True); | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + //verifica se o download do json de versoes foi bem sucedido. | |
| 128 | + if (codDownloadJson = 0) then | |
| 129 | + begin | |
| 130 | + versaoDictApiInteger:= StrToInt(tempVersion); | |
| 131 | + //verifica se é nescessario atualizar | |
| 132 | + if (versaoDictLocalInteger < versaoDictApiInteger) then | |
| 133 | + begin | |
| 134 | + Result := True; | |
| 135 | + end | |
| 136 | + else begin | |
| 137 | + MsgBox(ExpandConstant('{cm:VersaoJaAtualizada}'+'{cm:FinalizarApp}'), mbInformation, MB_OK); | |
| 138 | + Result := False; | |
| 139 | + end; | |
| 140 | + end | |
| 141 | + else begin | |
| 142 | + MsgBox(ExpandConstant('{cm:ErrorJson}'+'{cm:FinalizarApp}'), mbInformation, MB_OK); | |
| 143 | + //a instalação finaliza | |
| 144 | + Result := False; | |
| 145 | + end; | |
| 146 | +end; | |
| 147 | + | |
| 148 | + | |
| 149 | +procedure CurStepChanged(CurStep: TSetupStep); | |
| 150 | + | |
| 151 | +var | |
| 152 | + ErrorCode: Integer; | |
| 153 | +begin | |
| 154 | + | |
| 155 | + //após terminar o download da atualização. | |
| 156 | + if CurStep=ssInstall then begin | |
| 157 | + | |
| 158 | + WizardForm.CancelButton.Enabled := False; | |
| 159 | + WizardForm.Update; | |
| 160 | + // extrai o dicionario na pasta Bundles do player | |
| 161 | + Unzip(expandconstant('{sd}\VLibras\update\download\VlibrasDicionario.zip'),expandconstant('{sd}\VLibras\Player\VLibrasPlayer_Data\Bundles')); | |
| 162 | + DeleteFile(expandconstant('{sd}\VLibras\update\download\VlibrasDicionario.zip')); | |
| 163 | + end; | |
| 164 | + | |
| 165 | + if CurStep = ssDone then | |
| 166 | + begin | |
| 167 | + //atualiza a versao do dicionario no json local | |
| 168 | + jsonVersionReplaceValue('dictionaryVersion',VersionDicionaryApi); | |
| 169 | + | |
| 170 | + end; | |
| 171 | + | |
| 172 | +end; | |
| 173 | + | ... | ... |
| ... | ... | @@ -0,0 +1,169 @@ |
| 1 | + | |
| 2 | +#define MyAppName "Atualização - VLibras" | |
| 3 | +#define MyAppVersion "3.0.0" | |
| 4 | +#define MyAppPublisher "LAViD" | |
| 5 | +#define MyAppURL "http://vlibrasplayer.lavid.ufpb.br" | |
| 6 | +#define MyAppExeName "VlibrasPlayer.exe" | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | +[Setup] | |
| 11 | + | |
| 12 | +Uninstallable = no | |
| 13 | +AppName={#MyAppName} | |
| 14 | +AppVersion={#MyAppVersion} | |
| 15 | +AppPublisher={#MyAppPublisher} | |
| 16 | +AppPublisherURL={#MyAppURL} | |
| 17 | +AppSupportURL={#MyAppURL} | |
| 18 | +AppUpdatesURL={#MyAppURL} | |
| 19 | +DefaultDirName={sd}\VLibras\update | |
| 20 | +DisableDirPage=yes | |
| 21 | +DisableWelcomePage=yes | |
| 22 | +DefaultGroupName={#MyAppName} | |
| 23 | +OutputBaseFilename=PlayerUpdate | |
| 24 | +DisableProgramGroupPage=yes | |
| 25 | +DisableFinishedPage=yes | |
| 26 | +OutputDir="PlayerUpdate" | |
| 27 | +SetupIconFile="icon\icon_vlibras.ico" | |
| 28 | +Compression=lzma | |
| 29 | +SolidCompression=yes | |
| 30 | +WizardImageFile = "icon\avatar.bmp" | |
| 31 | +WizardSmallImageFile = "icon\player.bmp" | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | +[Languages] | |
| 36 | +Name: "brazilianportuguese"; MessagesFile: "compiler:Languages\BrazilianPortuguese.isl" | |
| 37 | + | |
| 38 | + | |
| 39 | +[Files] | |
| 40 | +Source: it_download\languages\itd_ptbr.ini; Flags: dontcopy | |
| 41 | + | |
| 42 | +#include "it_download\it_download.iss"; | |
| 43 | +#include "vlibrasJsonParse.iss"; | |
| 44 | + | |
| 45 | +[CustomMessages] | |
| 46 | + ErrorJson=A {#MyAppName} não conseguiu conexão com a internet.%nFavor verifique sua conexão e tente novamente.%n%n | |
| 47 | + DownloadFinalizado=A nova versão do VLibras foi baixado com sucesso .%nSiga os proximos passos para instalar essa nova versão em seu computador.%n%n | |
| 48 | + FinalizarApp=O instalador de atualização será encerrado. | |
| 49 | + VersaoJaAtualizada=Não existe {#MyAppName} disponível%n Sua versão Já está atualizada!%n%n | |
| 50 | + | |
| 51 | + | |
| 52 | +[Code] | |
| 53 | + | |
| 54 | +var | |
| 55 | + | |
| 56 | +Url: string; | |
| 57 | + | |
| 58 | +// a versão do player a ser baixado | |
| 59 | +VersionplayerApi: string; | |
| 60 | +// a versão do player instalado | |
| 61 | +VersionplayerLocal: string; | |
| 62 | + | |
| 63 | + | |
| 64 | +//chamado ao inicializar o instalador | |
| 65 | +procedure InitializeWizard(); | |
| 66 | + | |
| 67 | +begin | |
| 68 | + | |
| 69 | + WizardForm.Caption := '{#MyAppName}'; | |
| 70 | + ExtractTemporaryFile('itd_ptbr.ini'); | |
| 71 | + | |
| 72 | + //carrega o arquivo de traduçao portugues-br | |
| 73 | + ITD_LoadStrings(expandconstant('{tmp}\itd_ptbr.ini')); | |
| 74 | + | |
| 75 | + //busca no json baixado, a url do player a ser baixado | |
| 76 | + Url := jsonVersionGetValue(ExpandConstant('{tmp}\file.json'),'playerUrl'); | |
| 77 | + | |
| 78 | + //verifica se existe uma url válida | |
| 79 | + if not (Url = 'null') | |
| 80 | + then | |
| 81 | + //função da dll adciona arquivo para ser baixado | |
| 82 | + itd_addfile(Url,ExpandConstant('{sd}\VLibras\update\download\vlibrasUpdate.exe')); | |
| 83 | + | |
| 84 | + //inicia o download e mostra as informações na tela | |
| 85 | + itd_downloadafter(wpReady); | |
| 86 | + | |
| 87 | +end; | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | +function InitializeSetup: Boolean; | |
| 92 | + | |
| 93 | +var | |
| 94 | +codDownloadJson: Integer; | |
| 95 | +versaoPlayerApiInteger: Integer; | |
| 96 | +versaoPlayerLocalInteger: Integer; | |
| 97 | +tempVersion: string; | |
| 98 | + | |
| 99 | +begin | |
| 100 | + | |
| 101 | + //busca a versão atual do player local | |
| 102 | + VersionplayerLocal:= jsonVersionGetValue(ExpandConstant('{sd}\VLibras\version.json'),'playerVersion'); | |
| 103 | + tempVersion:= VersionplayerLocal; | |
| 104 | + StringChangeEx(tempVersion, '.', '', True); | |
| 105 | + | |
| 106 | + | |
| 107 | + versaoPlayerLocalInteger:= StrToInt(tempVersion); | |
| 108 | + | |
| 109 | + //faz o download do json contendo as versoes disponiveis | |
| 110 | + codDownloadJson:= ITD_DownloadFile('http://vlibras.lavid.ufpb.br/api/dicionario/0.0.0_0.0.0?type=json',expandconstant('{tmp}\file.json')); | |
| 111 | + | |
| 112 | + //busca no json baixado, a versão do player a ser baixado | |
| 113 | + VersionplayerApi:= jsonVersionGetValue(ExpandConstant('{tmp}\file.json'),'playerVersion'); | |
| 114 | + | |
| 115 | + tempVersion:= VersionplayerApi; | |
| 116 | + StringChangeEx(tempVersion, '.', '', True); | |
| 117 | + StringChangeEx(tempVersion, '_', '', True); | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + //verifica se o download do json de versoes foi bem sucedido. | |
| 122 | + if (codDownloadJson = 0) then | |
| 123 | + begin | |
| 124 | + versaoPlayerApiInteger:= StrToInt(tempVersion); | |
| 125 | + //verifica se é nescessario atualizar | |
| 126 | + if (versaoPlayerLocalInteger < versaoPlayerApiInteger) then | |
| 127 | + begin | |
| 128 | + Result := True; | |
| 129 | + end | |
| 130 | + else begin | |
| 131 | + MsgBox(ExpandConstant('{cm:VersaoJaAtualizada}'+'{cm:FinalizarApp}'), mbInformation, MB_OK); | |
| 132 | + Result := False; | |
| 133 | + end; | |
| 134 | + end | |
| 135 | + else begin | |
| 136 | + MsgBox(ExpandConstant('{cm:ErrorJson}'+'{cm:FinalizarApp}'), mbInformation, MB_OK); | |
| 137 | + //a instalação finaliza | |
| 138 | + Result := False; | |
| 139 | + end; | |
| 140 | +end; | |
| 141 | + | |
| 142 | + | |
| 143 | +procedure CurStepChanged(CurStep: TSetupStep); | |
| 144 | + | |
| 145 | +var | |
| 146 | + ErrorCode: Integer; | |
| 147 | +begin | |
| 148 | + | |
| 149 | + | |
| 150 | + if CurStep=ssInstall then begin //após terminar o download da atualização. | |
| 151 | + | |
| 152 | + MsgBox(ExpandConstant('{cm:DownloadFinalizado}'), mbInformation, MB_OK); | |
| 153 | + end; | |
| 154 | + | |
| 155 | + if CurStep = ssDone then | |
| 156 | + begin | |
| 157 | + //chama o instalador baixado | |
| 158 | + if not ShellExec('', ExpandConstant('{sd}\VLibras\update\download\vlibrasUpdate.exe'), '', '', SW_SHOW, ewNoWait, ErrorCode) then | |
| 159 | + begin | |
| 160 | + MsgBox('Houve um erro ao Instalar atualização, favor entrar em contato com os desenvolvedores. ', mbError, MB_OK); | |
| 161 | + end; | |
| 162 | + end; | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | +end; | |
| 169 | + | ... | ... |
update/Makefile
| ... | ... | @@ -1,35 +0,0 @@ |
| 1 | -############################## MAKEFILE VLIBRAS ############################ | |
| 2 | -# # | |
| 3 | -# Ezequiel Silva # | |
| 4 | -# ezequielsilva@lavid.ufpb.br # # | |
| 5 | -# # | |
| 6 | -############################################################################ | |
| 7 | - | |
| 8 | - | |
| 9 | -# Compilador Nativo | |
| 10 | -CC = cl | |
| 11 | - | |
| 12 | -OUTPLAYER = vlibrasUp | |
| 13 | -OUTDICT = vlibrasDictUp | |
| 14 | -OUTWRITE = writeSucess | |
| 15 | - | |
| 16 | - | |
| 17 | - | |
| 18 | -CLEAN_OBJ = del -q *.obj | |
| 19 | - | |
| 20 | - | |
| 21 | -#Gera executável | |
| 22 | -all: | |
| 23 | - | |
| 24 | - $(CC) -Fe$(OUTPLAYER) -EHsc vlibrasPlayerInstall.cpp | |
| 25 | - $(CC) -Fe$(OUTDICT) -EHsc vlibrasDictInstall.cpp | |
| 26 | - $(CC) -Fe$(OUTWRITE) -EHsc writeSucessInstall.cpp | |
| 27 | - $(CLEAN_OBJ) | |
| 28 | - | |
| 29 | - | |
| 30 | -#Limpa arquivos objetos e executáveis criados | |
| 31 | -clean: | |
| 32 | - del -q *.exe *.obj | |
| 33 | - rm -rf doc | |
| 34 | - | |
| 35 | - |
2.23 KB
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
update/include/pyVlibrasUpdate.h
| ... | ... | @@ -1,31 +0,0 @@ |
| 1 | -//***************************************************************** | |
| 2 | -/* | |
| 3 | - | |
| 4 | -Copyright (c) 2015 Ezequiel Silva | |
| 5 | -VLibras-Core group at LAViD, Federal University of Paraiba | |
| 6 | -*/ | |
| 7 | -//***************************************************************** | |
| 8 | - | |
| 9 | -/** | |
| 10 | -* \file pyVlibrasUpdate.h | |
| 11 | -* \authors Ezequiel Silva | |
| 12 | -* \date Setembro 2015 | |
| 13 | -*/ | |
| 14 | -#ifndef _PHVLIBRASUPDATE_H | |
| 15 | -#define _PHVLIBRASUPDATE_H | |
| 16 | - | |
| 17 | -#include <windows.h> | |
| 18 | - | |
| 19 | -/** \brief Classe para execução do Vlibras Update. | |
| 20 | -* | |
| 21 | -*/ | |
| 22 | -class PyVlibrasUpdate | |
| 23 | -{ | |
| 24 | - | |
| 25 | - public: | |
| 26 | - int install(char* strFunct, char* strstrParams); | |
| 27 | - void checkExe(char* strFunct, char* strstrParams); | |
| 28 | - | |
| 29 | -}; | |
| 30 | - | |
| 31 | -#endif | |
| 32 | 0 | \ No newline at end of file |
| ... | ... | @@ -0,0 +1,30 @@ |
| 1 | +//***************************************************************** | |
| 2 | +/* | |
| 3 | + | |
| 4 | +Copyright (c) 2015 Ezequiel Silva | |
| 5 | +VLibras-Core group at LAViD, Federal University of Paraiba | |
| 6 | +*/ | |
| 7 | +//***************************************************************** | |
| 8 | + | |
| 9 | +/** | |
| 10 | +* \file pyVlibrasUpdate.h | |
| 11 | +* \authors Ezequiel Silva | |
| 12 | +* \date Setembro 2015 | |
| 13 | +*/ | |
| 14 | +#ifndef _PHVLIBRASUPDATE_H | |
| 15 | +#define _PHVLIBRASUPDATE_H | |
| 16 | + | |
| 17 | +#include <windows.h> | |
| 18 | + | |
| 19 | +/** \brief Classe para execução do Vlibras Update. | |
| 20 | +* | |
| 21 | +*/ | |
| 22 | +class VlibrasUpdate | |
| 23 | +{ | |
| 24 | + | |
| 25 | + public: | |
| 26 | + int install(char* strFunct, char* strstrParams); | |
| 27 | + | |
| 28 | +}; | |
| 29 | + | |
| 30 | +#endif | |
| 0 | 31 | \ No newline at end of file | ... | ... |
| ... | ... | @@ -0,0 +1,318 @@ |
| 1 | +[Files] | |
| 2 | +Source: it_download\itdownload.dll; Flags: dontcopy; DestDir: {tmp} | |
| 3 | + | |
| 4 | +[Code] | |
| 5 | +(* | |
| 6 | + Inno Tools Downloader DLL | |
| 7 | + Copyright (C) Sherlock Software 2008 | |
| 8 | + Version 0.3.5 | |
| 9 | + | |
| 10 | + Contact: | |
| 11 | + The author, Nicholas Sherlock, at nick@sherlocksoftware.org. | |
| 12 | + Comments, questions and suggestions welcome. | |
| 13 | + | |
| 14 | + Website: | |
| 15 | + http://www.sherlocksoftware.org/ | |
| 16 | + | |
| 17 | + History: | |
| 18 | + 0.3.5 - Moved strings used in the updater example to the language file, so that they | |
| 19 | + may be more easily translated. | |
| 20 | + Added event functions to support the example of integration with InnoTools tray. | |
| 21 | + Fixes bugs that could cause the download to hang until | |
| 22 | + some mouse movements were received. | |
| 23 | + Allows "detailed mode" to be turned on with ITD_SetOption | |
| 24 | + Allows the HTTP agent to be set with ITD_SetOption | |
| 25 | + 0.3.4 - Added Brazilian Portuguese translation by Ronaldo Souza | |
| 26 | + 0.3.3 - The "Hilbrand Edskes" release :), lots of suggestions and corrections from him, thank you! | |
| 27 | + The "Retry" button is now translated. | |
| 28 | + The "Current file" progress bar is hidden if only one file is being downloaded. | |
| 29 | + The page's title and description are updated in the case of failed downloads. | |
| 30 | + Several updates to the translations. | |
| 31 | + Several small GUI fixes. | |
| 32 | + 0.3.2 - Minor tweaks to the English language file and the translation example script (example4.iss) | |
| 33 | + Added Dutch translation by Hilbrand Edskes | |
| 34 | + Added French translation by Néo | |
| 35 | + 0.3.1 - Added language file examples, fixed several missing language strings | |
| 36 | + Preliminary support for proxy server autodetection | |
| 37 | + Allows the size of a file to be queried with ITD_GetFileSize | |
| 38 | + Several small bugfixes | |
| 39 | + 0.3.0 - Properly supports timeouts. | |
| 40 | + Fixes bug with time remaining. | |
| 41 | + DLL is required again. | |
| 42 | + Supports localization through ITD_LoadStrings, ITD_SetString | |
| 43 | + Add mirrors for files | |
| 44 | + Post HTTP documents | |
| 45 | + Quick view and detailed view | |
| 46 | + 0.2.2 - Fixed empty strings '' in calls and added timeouts | |
| 47 | + 0.2.1 - Renamed identifiers to avoid name clashes | |
| 48 | + 0.2.0 - Converted from DLL to pure native code | |
| 49 | +*) | |
| 50 | + | |
| 51 | +procedure ITD_Cancel; | |
| 52 | + external 'itd_cancel@files:itdownload.dll stdcall'; | |
| 53 | + | |
| 54 | +procedure ITD_ClearFiles; | |
| 55 | + external 'itd_clearfiles@files:itdownload.dll stdcall'; | |
| 56 | + | |
| 57 | +function ITD_DownloadFile(url: PChar; destfilename: PChar): integer; | |
| 58 | + external 'itd_downloadfile@files:itdownload.dll stdcall'; | |
| 59 | + | |
| 60 | +function ITD_GetResultLen: integer; | |
| 61 | + external 'itd_getresultlen@files:itdownload.dll stdcall'; | |
| 62 | + | |
| 63 | +procedure ITD_GetResultString(buffer: pchar; maxlen: integer); | |
| 64 | + external 'itd_getresultstring@files:itdownload.dll stdcall'; | |
| 65 | + | |
| 66 | +procedure ITD_Internal_InitUI(HostHwnd: dword); | |
| 67 | + external 'itd_initui@files:itdownload.dll stdcall'; | |
| 68 | + | |
| 69 | +function ITD_Internal_LoadStrings(filename: PChar): boolean; | |
| 70 | + external 'itd_loadstrings@files:itdownload.dll stdcall'; | |
| 71 | + | |
| 72 | +procedure ITD_Internal_SetOption(option, value: PChar); | |
| 73 | + external 'itd_setoption@files:itdownload.dll stdcall'; | |
| 74 | + | |
| 75 | +function ITD_Internal_GetFileSize(url: pchar; var size: Cardinal): boolean; | |
| 76 | + external 'itd_getfilesize@files:itdownload.dll stdcall'; | |
| 77 | + | |
| 78 | +function ITD_Internal_GetString(index: integer): boolean; | |
| 79 | + external 'itd_getstring@files:itdownload.dll stdcall'; | |
| 80 | + | |
| 81 | +function ITD_Internal_GetOption(option: PChar; buffer: PChar; length: integer): integer; | |
| 82 | + external 'itd_getoption@files:itdownload.dll stdcall'; | |
| 83 | + | |
| 84 | +procedure ITD_Internal_SetString(index: integer; value: PChar); | |
| 85 | + external 'itd_setstring@files:itdownload.dll stdcall'; | |
| 86 | + | |
| 87 | +procedure ITD_Internal_AddFile(url: PChar; destfilename: PChar); | |
| 88 | + external 'itd_addfile@files:itdownload.dll stdcall'; | |
| 89 | + | |
| 90 | +procedure ITD_Internal_AddMirror(url: PChar; destfilename: PChar); | |
| 91 | + external 'itd_addmirror@files:itdownload.dll stdcall'; | |
| 92 | + | |
| 93 | +procedure ITD_Internal_AddFileSize(url: PChar; destfilename: PChar; size: integer); | |
| 94 | + external 'itd_addfilesize@files:itdownload.dll stdcall'; | |
| 95 | + | |
| 96 | +function ITD_Internal_DownloadFiles(surface: hwnd): integer; | |
| 97 | + external 'itd_downloadfiles@files:itdownload.dll stdcall'; | |
| 98 | + | |
| 99 | +function ITD_FileCount: integer; | |
| 100 | + external 'itd_filecount@files:itdownload.dll stdcall'; | |
| 101 | + | |
| 102 | +function ITD_Internal_PostPage(url, buffer: PChar; length: integer): boolean; | |
| 103 | + external 'itd_postpage@files:itdownload.dll stdcall'; | |
| 104 | + | |
| 105 | + | |
| 106 | +const | |
| 107 | + ITDERR_SUCCESS = 0; | |
| 108 | + ITDERR_USERCANCEL = 1; | |
| 109 | + ITDERR_ERROR = 3; | |
| 110 | + | |
| 111 | + {Constants for Language String indexes:} | |
| 112 | + ITDS_DownloadFailed = 104; | |
| 113 | + | |
| 114 | + ITDS_TitleCaption = 200; | |
| 115 | + ITDS_TitleDescription = 201; | |
| 116 | + | |
| 117 | + ITDS_MessageFailRetryContinue = 250; | |
| 118 | + ITDS_MessageFailRetry = 251; | |
| 119 | + | |
| 120 | + ITDS_Retry = 502; | |
| 121 | + | |
| 122 | + {Constants for language strings of updater example} | |
| 123 | + ITDS_Update_Caption = 600; | |
| 124 | + ITDS_Update_Description = 601; | |
| 125 | + ITDS_Update_Checking = 602; | |
| 126 | + ITDS_Update_NewAvailable = 603; | |
| 127 | + ITDS_Update_NoNewAvailable = 604; | |
| 128 | + ITDS_Update_WantToCheck = 605; | |
| 129 | + ITDS_Update_Failed = 606; | |
| 130 | + ITDS_Update_WillLaunch = 607; | |
| 131 | + ITDS_Update_WillLaunchWithPath = 608; | |
| 132 | + | |
| 133 | + ITD_Event_DownloadPageEntered = 1; | |
| 134 | + ITD_Event_DownloadPageLeft = 2; | |
| 135 | + ITD_Event_DownloadFailed = 3; | |
| 136 | + | |
| 137 | +var | |
| 138 | + itd_allowcontinue: boolean; | |
| 139 | + itd_retryonback: boolean; | |
| 140 | + | |
| 141 | + ITD_AfterSuccess: procedure(downloadPage: TWizardPage); | |
| 142 | + ITD_EventHandler: procedure(event: integer); | |
| 143 | + | |
| 144 | +procedure ITD_DownloadFiles(); | |
| 145 | +begin | |
| 146 | + ITD_Internal_DownloadFiles(0); | |
| 147 | +end; | |
| 148 | + | |
| 149 | +procedure ITD_AddFile(const URL, filename: string); | |
| 150 | +begin | |
| 151 | + ITD_Internal_AddFile(URL, filename); | |
| 152 | +end; | |
| 153 | + | |
| 154 | +procedure ITD_AddMirror(const URL, filename: string); | |
| 155 | +begin | |
| 156 | + ITD_Internal_AddMirror(URL, filename); | |
| 157 | +end; | |
| 158 | + | |
| 159 | +procedure ITD_AddFileSize(const URL, filename: string; size: integer); | |
| 160 | +begin | |
| 161 | + ITD_Internal_AddFileSize(URL, filename, size); | |
| 162 | +end; | |
| 163 | + | |
| 164 | +function ITD_HandleSkipPage(sender: TWizardPage): boolean; | |
| 165 | +begin | |
| 166 | + result := (itd_filecount = 0); | |
| 167 | +end; | |
| 168 | + | |
| 169 | +procedure ITD_SetString(index: integer; value: string); | |
| 170 | +begin | |
| 171 | + itd_internal_setstring(index, value); | |
| 172 | +end; | |
| 173 | + | |
| 174 | +function ITD_GetFileSize(const url: string; var size: cardinal): boolean; | |
| 175 | +begin | |
| 176 | + result := itd_internal_getfilesize(PChar(url), size); | |
| 177 | +end; | |
| 178 | + | |
| 179 | +function ITD_LoadStrings(const filename: string): boolean; | |
| 180 | +begin | |
| 181 | + result := itd_internal_loadstrings(filename); | |
| 182 | +end; | |
| 183 | + | |
| 184 | +function ITD_GetString(index: integer): string; | |
| 185 | +begin | |
| 186 | + itd_internal_getstring(index); | |
| 187 | + setlength(result, ITD_GetResultLen); | |
| 188 | + ITD_GetResultString(PChar(result), length(result)); | |
| 189 | +end; | |
| 190 | + | |
| 191 | +procedure ITD_NowDoDownload(sender: TWizardPage); | |
| 192 | +var err: integer; | |
| 193 | +begin | |
| 194 | + wizardform.backbutton.enabled := false; | |
| 195 | + wizardform.nextbutton.enabled := false; | |
| 196 | + | |
| 197 | + sender.caption := ITD_GetString(ITDS_TitleCaption); | |
| 198 | + sender.description := ITD_GetString(ITDS_TitleDescription); | |
| 199 | + | |
| 200 | + err := ITD_Internal_DownloadFiles(sender.surface.handle); | |
| 201 | + | |
| 202 | + case err of | |
| 203 | + ITDERR_SUCCESS: begin | |
| 204 | + wizardform.nextbutton.enabled := true; | |
| 205 | + wizardform.nextbutton.onclick(nil); | |
| 206 | + | |
| 207 | + if itd_aftersuccess <> nil then | |
| 208 | + itd_aftersuccess(sender); | |
| 209 | + end; | |
| 210 | + ITDERR_USERCANCEL: ; //Don't show a message, this happens on setup close and cancel click | |
| 211 | + else begin | |
| 212 | + //Some unexpected error, like connection interrupted | |
| 213 | + wizardform.backbutton.caption := ITD_GetString(ITDS_Retry); | |
| 214 | + wizardform.backbutton.enabled := true; | |
| 215 | + wizardform.backbutton.show(); | |
| 216 | + itd_retryonback := true; | |
| 217 | + | |
| 218 | + wizardform.nextbutton.enabled := itd_allowcontinue; | |
| 219 | + | |
| 220 | + if ITD_EventHandler <> nil then | |
| 221 | + ITD_EventHandler(ITD_Event_DownloadFailed); | |
| 222 | + | |
| 223 | + if itd_allowcontinue then begin //Download failed, we can retry, continue, or exit | |
| 224 | + sender.caption := ITD_GetString(ITDS_DownloadFailed); | |
| 225 | + sender.description := ITD_GetString(ITDS_MessageFailRetryContinue); | |
| 226 | + | |
| 227 | + MsgBox(ITD_GetString(ITDS_MessageFailRetryContinue), mbError, MB_OK) | |
| 228 | + end else begin //Download failed, we must retry or exit setup | |
| 229 | + sender.caption := ITD_GetString(ITDS_DownloadFailed); | |
| 230 | + sender.description := ITD_GetString(ITDS_MessageFailRetry); | |
| 231 | + | |
| 232 | + MsgBox(ITD_GetString(ITDS_MessageFailRetry), mbError, MB_OK) | |
| 233 | + end; | |
| 234 | + end; | |
| 235 | + end; | |
| 236 | +end; | |
| 237 | + | |
| 238 | +procedure ITD_HandleShowPage(sender: TWizardPage); | |
| 239 | +begin | |
| 240 | + wizardform.nextbutton.enabled := false; | |
| 241 | + wizardform.backbutton.hide(); | |
| 242 | + | |
| 243 | + if ITD_EventHandler <> nil then | |
| 244 | + ITD_EventHandler(ITD_Event_DownloadPageEntered); | |
| 245 | + | |
| 246 | + itd_nowdodownload(sender); | |
| 247 | +end; | |
| 248 | + | |
| 249 | +function ITD_HandleBackClick(sender: TWizardpage): boolean; | |
| 250 | +begin | |
| 251 | + result := false; | |
| 252 | + if itd_retryonback then begin | |
| 253 | + itd_retryonback := false; | |
| 254 | + wizardform.backbutton.hide(); | |
| 255 | + itd_nowdodownload(sender); | |
| 256 | + end; | |
| 257 | +end; | |
| 258 | + | |
| 259 | +function ITD_HandleNextClick(sender: TWizardpage): boolean; | |
| 260 | +begin | |
| 261 | + if ITD_EventHandler <> nil then | |
| 262 | + ITD_EventHandler(ITD_Event_DownloadPageLeft); | |
| 263 | + | |
| 264 | + result := true; | |
| 265 | +end; | |
| 266 | + | |
| 267 | +procedure ITD_Init; | |
| 268 | +begin | |
| 269 | + //Currently a NOP. Don't count on it in future. | |
| 270 | +end; | |
| 271 | + | |
| 272 | +function ITD_PostPage(const url, data: string; out response: string): boolean; | |
| 273 | +begin | |
| 274 | + result := ITD_Internal_PostPage(PChar(url), PChar(data), length(data)); | |
| 275 | + | |
| 276 | + if result then begin | |
| 277 | + setlength(response, ITD_GetResultLen); | |
| 278 | + ITD_GetResultString(PChar(response), length(response)); | |
| 279 | + end; | |
| 280 | +end; | |
| 281 | + | |
| 282 | +function ITD_DownloadAfter(afterID: integer): TWizardPage; | |
| 283 | +var itd_downloadPage: TWizardPage; | |
| 284 | +begin | |
| 285 | + itd_downloadpage := CreateCustomPage(afterID, ITD_GetString(ITDS_TitleCaption), ITD_GetString(ITDS_TitleDescription)); | |
| 286 | + | |
| 287 | + itd_downloadpage.onactivate := @itd_handleshowpage; | |
| 288 | + itd_downloadpage.onshouldskippage := @itd_handleskippage; | |
| 289 | + itd_downloadpage.onbackbuttonclick := @itd_handlebackclick; | |
| 290 | + itd_downloadpage.onnextbuttonclick := @itd_handlenextclick; | |
| 291 | + | |
| 292 | + itd_internal_initui(itd_downloadpage.surface.handle); | |
| 293 | + | |
| 294 | + result := itd_downloadpage; | |
| 295 | +end; | |
| 296 | + | |
| 297 | +procedure ITD_SetOption(const option, value: string); | |
| 298 | +begin | |
| 299 | + //The options which call ITD_SetString are depreciated, use ITD_SetString directly | |
| 300 | + if comparetext(option, 'UI_Caption') = 0 then | |
| 301 | + ITD_SetString(ITDS_TitleCaption, value) | |
| 302 | + else if comparetext(option, 'UI_Description') = 0 then | |
| 303 | + ITD_SetString(ITDS_TitleDescription, value) | |
| 304 | + else if comparetext(option, 'UI_FailMessage') = 0 then | |
| 305 | + ITD_SetString(ITDS_MessageFailRetry, value) | |
| 306 | + else if comparetext(option, 'UI_FailOrContinueMessage') = 0 then | |
| 307 | + ITD_SetString(ITDS_MessageFailRetryContinue, value) | |
| 308 | + else if comparetext(option, 'UI_AllowContinue') = 0 then | |
| 309 | + ITD_AllowContinue := (value = '1') | |
| 310 | + else | |
| 311 | + ITD_Internal_SetOption(option, value); | |
| 312 | +end; | |
| 313 | + | |
| 314 | +function ITD_GetOption(const option: string): string; | |
| 315 | +begin | |
| 316 | + setlength(result, 500); | |
| 317 | + setlength(result, itd_internal_getoption(pchar(option), pchar(result), length(result))); | |
| 318 | +end; | ... | ... |
| ... | ... | @@ -0,0 +1,49 @@ |
| 1 | +[Author] | |
| 2 | +Contributors=Ronaldo Souza | |
| 3 | +Contributors=Ezequiel Silva | |
| 4 | + | |
| 5 | +[Strings] | |
| 6 | +100=Obtendo informações da atualização... | |
| 7 | +101=Iniciando o download... | |
| 8 | +102=Baixando... | |
| 9 | +103=Download completo! | |
| 10 | +104=Erro no download. | |
| 11 | +105=Baixando (%s)... | |
| 12 | + | |
| 13 | +200=Baixando Atualização do VLibras | |
| 14 | +201=Favor aguardar enquanto o VLibras baixa os arquivos... | |
| 15 | + | |
| 16 | +250=Desculpe, os arquivos não puderam ser baixados. Clique em 'Repetir' para tentar baixar os arquivos novamente, ou clique em 'Prosseguir' para continuar a instalação assim mesmo. | |
| 17 | +251=Desculpe, os arquivos não puderam ser baixados. Clique em 'Repetir' para tentar baixar os arquivos novamente, ou clique em 'Cancelar' para abortar a instalação. | |
| 18 | + | |
| 19 | +300=Arquivo: | |
| 20 | +301=Velocidade: | |
| 21 | +302=Status: | |
| 22 | +303=Tempo decorrido: | |
| 23 | +304=Tempo restante: | |
| 24 | +305=Arquivo corrente: | |
| 25 | +306=Progresso total: | |
| 26 | + | |
| 27 | +400=Desconhecido | |
| 28 | + | |
| 29 | +450=segundo | |
| 30 | +451=segundos | |
| 31 | +452=minuto | |
| 32 | +453=minutos | |
| 33 | +454=hora | |
| 34 | +455=horas | |
| 35 | +456=dia | |
| 36 | +457=dias | |
| 37 | +458=%1 %2/s | |
| 38 | +459=%1 %2 de %3 %4 | |
| 39 | +460=%1 %2 de desconhecido | |
| 40 | +461=Não | |
| 41 | + | |
| 42 | +470=B | |
| 43 | +471=KB | |
| 44 | +472=MB | |
| 45 | +473=GB | |
| 46 | + | |
| 47 | +500=Detalhes | |
| 48 | +501=Esconder | |
| 49 | +502=Repetir | |
| 0 | 50 | \ No newline at end of file | ... | ... |
update/src/pyVlibrasUpdate.cpp
| ... | ... | @@ -1,103 +0,0 @@ |
| 1 | - | |
| 2 | -/** | |
| 3 | -* \file pyVlibrasUpdate.cpp | |
| 4 | -* \authors Ezequiel Silva | |
| 5 | -* \date outubro 2015 | |
| 6 | -*/ | |
| 7 | - | |
| 8 | -#include "pyVlibrasUpdate.h" | |
| 9 | - | |
| 10 | - | |
| 11 | -void PyVlibrasUpdate::checkExe(char* strFunct, char* strstrParams) | |
| 12 | -{ | |
| 13 | - | |
| 14 | - STARTUPINFO StartupInfo; | |
| 15 | - PROCESS_INFORMATION ProcessInfo; | |
| 16 | - char Args[4096]; | |
| 17 | - char *pEnvCMD = NULL; | |
| 18 | - char *pDefaultCMD = "CMD.EXE"; | |
| 19 | - ULONG rc; | |
| 20 | - | |
| 21 | - memset(&StartupInfo, 0, sizeof(StartupInfo)); | |
| 22 | - StartupInfo.cb = sizeof(STARTUPINFO); | |
| 23 | - StartupInfo.dwFlags = STARTF_USESHOWWINDOW; | |
| 24 | - StartupInfo.wShowWindow = SW_HIDE; | |
| 25 | - | |
| 26 | - Args[0] = 0; | |
| 27 | - | |
| 28 | - pEnvCMD = getenv("COMSPEC"); | |
| 29 | - | |
| 30 | - if(pEnvCMD){ | |
| 31 | - | |
| 32 | - strcpy(Args, pEnvCMD); | |
| 33 | - } | |
| 34 | - else{ | |
| 35 | - strcpy(Args, pDefaultCMD); | |
| 36 | - } | |
| 37 | - | |
| 38 | - // "/c" option - Do the command then terminate the command window | |
| 39 | - strcat(Args, " /c "); | |
| 40 | - //the application you would like to run from the command window | |
| 41 | - strcat(Args, strFunct); | |
| 42 | - strcat(Args, " "); | |
| 43 | - //the parameters passed to the application being run from the command window. | |
| 44 | - strcat(Args, strstrParams); | |
| 45 | - | |
| 46 | - if (!CreateProcess( NULL, Args, NULL, NULL, FALSE, CREATE_NEW_CONSOLE, NULL, NULL, &StartupInfo, &ProcessInfo)) | |
| 47 | - { | |
| 48 | - return; | |
| 49 | - } | |
| 50 | - | |
| 51 | - WaitForSingleObject(ProcessInfo.hProcess, INFINITE); | |
| 52 | - if(!GetExitCodeProcess(ProcessInfo.hProcess, &rc)) | |
| 53 | - rc = 0; | |
| 54 | - | |
| 55 | - CloseHandle(ProcessInfo.hThread); | |
| 56 | - CloseHandle(ProcessInfo.hProcess); | |
| 57 | - | |
| 58 | - | |
| 59 | -} | |
| 60 | - | |
| 61 | -int PyVlibrasUpdate::install(char* strFunct, char* strstrParams) | |
| 62 | -{ | |
| 63 | - | |
| 64 | - STARTUPINFO StartupInfo; | |
| 65 | - PROCESS_INFORMATION ProcessInfo; | |
| 66 | - char Args[4096]; | |
| 67 | - char *pEnvCMD = NULL; | |
| 68 | - char *pDefaultCMD = "CMD.EXE"; | |
| 69 | - | |
| 70 | - memset(&StartupInfo, 0, sizeof(StartupInfo)); | |
| 71 | - StartupInfo.cb = sizeof(STARTUPINFO); | |
| 72 | - StartupInfo.dwFlags = STARTF_USESHOWWINDOW; | |
| 73 | - StartupInfo.wShowWindow = SW_HIDE; | |
| 74 | - | |
| 75 | - Args[0] = 0; | |
| 76 | - | |
| 77 | - pEnvCMD = getenv("COMSPEC"); | |
| 78 | - | |
| 79 | - if(pEnvCMD){ | |
| 80 | - | |
| 81 | - strcpy(Args, pEnvCMD); | |
| 82 | - } | |
| 83 | - else{ | |
| 84 | - strcpy(Args, pDefaultCMD); | |
| 85 | - } | |
| 86 | - | |
| 87 | - // "/c" option - Do the command then terminate the command window | |
| 88 | - strcat(Args, " /c "); | |
| 89 | - //the application you would like to run from the command window | |
| 90 | - strcat(Args, strFunct); | |
| 91 | - strcat(Args, " "); | |
| 92 | - //the parameters passed to the application being run from the command window. | |
| 93 | - strcat(Args, strstrParams); | |
| 94 | - | |
| 95 | - if (!CreateProcess( NULL, Args, NULL, NULL, FALSE,CREATE_NEW_CONSOLE, NULL, NULL, &StartupInfo, &ProcessInfo)) | |
| 96 | - { | |
| 97 | - return -1; | |
| 98 | - } | |
| 99 | - | |
| 100 | - return -1; | |
| 101 | - | |
| 102 | -} | |
| 103 | - |
| ... | ... | @@ -0,0 +1,53 @@ |
| 1 | + | |
| 2 | +/** | |
| 3 | +* \file vlibrasUpdate.cpp | |
| 4 | +* \authors Ezequiel Silva | |
| 5 | +* \date outubro 2015 | |
| 6 | +*/ | |
| 7 | + | |
| 8 | +#include "vlibrasUpdate.h" | |
| 9 | + | |
| 10 | + | |
| 11 | +int VlibrasUpdate::install(char* strFunct, char* strstrParams) | |
| 12 | +{ | |
| 13 | + | |
| 14 | + STARTUPINFO StartupInfo; | |
| 15 | + PROCESS_INFORMATION ProcessInfo; | |
| 16 | + char Args[4096]; | |
| 17 | + char *pEnvCMD = NULL; | |
| 18 | + char *pDefaultCMD = "CMD.EXE"; | |
| 19 | + | |
| 20 | + memset(&StartupInfo, 0, sizeof(StartupInfo)); | |
| 21 | + StartupInfo.cb = sizeof(STARTUPINFO); | |
| 22 | + StartupInfo.dwFlags = STARTF_USESHOWWINDOW; | |
| 23 | + StartupInfo.wShowWindow = SW_HIDE; | |
| 24 | + | |
| 25 | + Args[0] = 0; | |
| 26 | + | |
| 27 | + pEnvCMD = getenv("COMSPEC"); | |
| 28 | + | |
| 29 | + if(pEnvCMD){ | |
| 30 | + | |
| 31 | + strcpy(Args, pEnvCMD); | |
| 32 | + } | |
| 33 | + else{ | |
| 34 | + strcpy(Args, pDefaultCMD); | |
| 35 | + } | |
| 36 | + | |
| 37 | + // "/c" option - Do the command then terminate the command window | |
| 38 | + strcat(Args, " /c "); | |
| 39 | + //the application you would like to run from the command window | |
| 40 | + strcat(Args, strFunct); | |
| 41 | + strcat(Args, " "); | |
| 42 | + //the parameters passed to the application being run from the command window. | |
| 43 | + strcat(Args, strstrParams); | |
| 44 | + | |
| 45 | + if (!CreateProcess( NULL, Args, NULL, NULL, FALSE,CREATE_NEW_CONSOLE, NULL, NULL, &StartupInfo, &ProcessInfo)) | |
| 46 | + { | |
| 47 | + return -1; | |
| 48 | + } | |
| 49 | + | |
| 50 | + return 0; | |
| 51 | + | |
| 52 | +} | |
| 53 | + | ... | ... |
| ... | ... | @@ -0,0 +1,99 @@ |
| 1 | +#IFDEF UNICODE | |
| 2 | + #DEFINE AW "W" | |
| 3 | +#ELSE | |
| 4 | + #DEFINE AW "A" | |
| 5 | +#ENDIF | |
| 6 | + | |
| 7 | +// --- Start "ShellExecuteEx" Helper | |
| 8 | + | |
| 9 | +const | |
| 10 | + WAIT_TIMEOUT = $00000102; | |
| 11 | + SEE_MASK_NOCLOSEPROCESS = $00000040; | |
| 12 | + INFINITE = $FFFFFFFF; { Infinite timeout } | |
| 13 | + | |
| 14 | +type | |
| 15 | + TShellExecuteInfo = record | |
| 16 | + cbSize: DWORD; | |
| 17 | + fMask: Cardinal; | |
| 18 | + Wnd: HWND; | |
| 19 | + lpVerb: string; | |
| 20 | + lpFile: string; | |
| 21 | + lpParameters: string; | |
| 22 | + lpDirectory: string; | |
| 23 | + nShow: Integer; | |
| 24 | + hInstApp: THandle; | |
| 25 | + lpIDList: DWORD; | |
| 26 | + lpClass: string; | |
| 27 | + hkeyClass: THandle; | |
| 28 | + dwHotKey: DWORD; | |
| 29 | + hMonitor: THandle; | |
| 30 | + hProcess: THandle; | |
| 31 | + end; | |
| 32 | + | |
| 33 | +function ShellExecuteEx(var lpExecInfo: TShellExecuteInfo): BOOL; | |
| 34 | + external 'ShellExecuteEx{#AW}@shell32.dll stdcall'; | |
| 35 | +function WaitForSingleObject(hHandle: THandle; dwMilliseconds: DWORD): DWORD; | |
| 36 | + external 'WaitForSingleObject@kernel32.dll stdcall'; | |
| 37 | +function CloseHandle(hObject: THandle): BOOL; external 'CloseHandle@kernel32.dll stdcall'; | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | +procedure Unzip(source: String; targetdir: String); | |
| 43 | +var | |
| 44 | + I: Integer; | |
| 45 | + unzipTool, unzipParams : String; // path and param for the unzip tool | |
| 46 | + ExecInfo: TShellExecuteInfo; // info object for ShellExecuteEx() | |
| 47 | +begin | |
| 48 | + // source and targetdir might contain {tmp} or {app} constant, so expand/resolve it to path names | |
| 49 | + source := ExpandConstant(source); | |
| 50 | + targetdir := ExpandConstant(targetdir); | |
| 51 | + | |
| 52 | + // prepare 7zip execution | |
| 53 | + unzipTool := ExpandConstant('{sd}\VLibras\bin\7z.exe'); | |
| 54 | + unzipParams := ' x "' + source + '" -o"' + targetdir + '" -y'; | |
| 55 | + | |
| 56 | + // prepare information about the application being executed by ShellExecuteEx() | |
| 57 | + ExecInfo.cbSize := SizeOf(ExecInfo); | |
| 58 | + ExecInfo.fMask := SEE_MASK_NOCLOSEPROCESS; | |
| 59 | + ExecInfo.Wnd := 0; | |
| 60 | + ExecInfo.lpFile := unzipTool; | |
| 61 | + ExecInfo.lpParameters := unzipParams; | |
| 62 | + ExecInfo.nShow := SW_HIDE; | |
| 63 | + | |
| 64 | + WizardForm.StatusLabel.Caption := 'Aguarde enquanto o dicionário é instalado...'; | |
| 65 | + WizardForm.ProgressGauge.Min := 0; | |
| 66 | + WizardForm.ProgressGauge.Max := 100; | |
| 67 | + | |
| 68 | + if not FileExists(unzipTool) | |
| 69 | + then MsgBox('Erro ao tentar instalar Dicionario: ' + unzipTool, mbError, MB_OK) | |
| 70 | + else if not FileExists(source) | |
| 71 | + then MsgBox('Arquivo de Dicionario não encontrado: ' + source, mbError, MB_OK) | |
| 72 | + else begin | |
| 73 | + | |
| 74 | + | |
| 75 | + if ShellExecuteEx(ExecInfo) then | |
| 76 | + I := 0; | |
| 77 | + begin | |
| 78 | + while WaitForSingleObject(ExecInfo.hProcess, 100) = WAIT_TIMEOUT | |
| 79 | + do begin | |
| 80 | + | |
| 81 | + I := I+1; | |
| 82 | + if I > 100 then | |
| 83 | + begin | |
| 84 | + WizardForm.FilenameLabel.Caption := 'Finalizando...'; | |
| 85 | + WizardForm.ProgressGauge.Position := 100; | |
| 86 | + end | |
| 87 | + else | |
| 88 | + begin | |
| 89 | + WizardForm.FilenameLabel.Caption := 'Feito ' + IntToStr(I) + '%'; | |
| 90 | + WizardForm.ProgressGauge.Position := I; | |
| 91 | + end; | |
| 92 | + | |
| 93 | + WizardForm.Refresh(); | |
| 94 | + end; | |
| 95 | + CloseHandle(ExecInfo.hProcess); | |
| 96 | + end; | |
| 97 | + | |
| 98 | + end; | |
| 99 | +end; | ... | ... |
update/updatePython/DownloadFile.py
| ... | ... | @@ -1,58 +0,0 @@ |
| 1 | -#!/usr/bin/env python | |
| 2 | -# -*- coding: utf-8 -*- | |
| 3 | -import wx | |
| 4 | -from urllib2 import URLError | |
| 5 | -from urllib2 import HTTPError | |
| 6 | -import urllib2,os | |
| 7 | -import random | |
| 8 | -import time | |
| 9 | -from wx.lib.pubsub import pub | |
| 10 | -from threading import Thread | |
| 11 | - | |
| 12 | - | |
| 13 | -class DownloadFile2(Thread): | |
| 14 | - | |
| 15 | - def __init__(self,url,nameFile): | |
| 16 | - self.url = url | |
| 17 | - self.nameFile = nameFile | |
| 18 | - self.downloading = True | |
| 19 | - Thread.__init__(self) | |
| 20 | - | |
| 21 | - | |
| 22 | - def stop(self): | |
| 23 | - self.downloading = False | |
| 24 | - | |
| 25 | - | |
| 26 | - def run(self): | |
| 27 | - | |
| 28 | - file_name = self.nameFile | |
| 29 | - try: | |
| 30 | - u = urllib2.urlopen(self.url) | |
| 31 | - f = open(file_name, 'wb') | |
| 32 | - meta = u.info() | |
| 33 | - file_size = int(meta.getheaders("Content-Length")[0]) | |
| 34 | - | |
| 35 | - except : | |
| 36 | - self.downloading = False; | |
| 37 | - wx.CallAfter(pub.sendMessage, "erroDeConexao", msg="Falha na conexao") | |
| 38 | - | |
| 39 | - return False | |
| 40 | - | |
| 41 | - | |
| 42 | - file_size_dl = 0 | |
| 43 | - block_sz = 8192 | |
| 44 | - while self.downloading: | |
| 45 | - buffer = u.read(block_sz) | |
| 46 | - if not buffer: | |
| 47 | - break | |
| 48 | - | |
| 49 | - file_size_dl += len(buffer) | |
| 50 | - f.write(buffer) | |
| 51 | - status = r"%10d [%3.2f%%]" % (file_size_dl, file_size_dl * 100. / file_size) | |
| 52 | - status = status + chr(8)*(len(status)+1) | |
| 53 | - | |
| 54 | - wx.CallAfter(pub.sendMessage, "updateProgress", msg=(file_size_dl * 100. / file_size)) | |
| 55 | - if (file_size_dl * 100. / file_size) >=100: | |
| 56 | - wx.CallAfter(pub.sendMessage, "updateProgress", msg=(100)) | |
| 57 | - self.downloading = False; | |
| 58 | - wx.CallAfter(pub.sendMessage, "downloadSucess", msg="Download realizado") |
update/updatePython/Util.py
| ... | ... | @@ -1,75 +0,0 @@ |
| 1 | -# -*- coding: utf-8 -*- | |
| 2 | -import os.path | |
| 3 | -import json, zipfile, subprocess,urllib | |
| 4 | -from os import popen | |
| 5 | -import sys , shutil | |
| 6 | - | |
| 7 | -import wx | |
| 8 | - | |
| 9 | -PATH_RESOURCE = os.getenv("ProgramFiles")+'/VLibras/' | |
| 10 | -DICTIONARY_EXTRACT_PATH = PATH_RESOURCE+'/Player/VLibrasPlayer_Data/Bundles' | |
| 11 | -DICTIONARY_ZIP_PATH = PATH_RESOURCE+'update/download/vlibras_dicionario.zip' | |
| 12 | -TXT_DICT_VERSION = PATH_RESOURCE+'update/version/dictVersion.txt' | |
| 13 | -TXT_PLAYER_VERSION = PATH_RESOURCE+'update/version/playerVersion.txt' | |
| 14 | -TXT_PLAYER_VERSION_DOWNLOAD = PATH_RESOURCE+'update/version/DownloadPlayerVersion.txt' | |
| 15 | -JSON_API_VERSION = PATH_RESOURCE+'update/download/versionApi.json' | |
| 16 | -URL_REQUEST_API = 'http://vlibras.lavid.ufpb.br/api/dicionario/' | |
| 17 | -TEXT_CHECK_INSTALL = PATH_RESOURCE+'installSucess.txt' | |
| 18 | -INSTALL_PLAYER_PATH = PATH_RESOURCE+'update/download/Vlibras_Up.exe' | |
| 19 | -PATH_PLAYER = PATH_RESOURCE+'Player/VlibrasPlayer.exe' | |
| 20 | -ICON = PATH_RESOURCE+'icons/icon_vlibras.ico' | |
| 21 | - | |
| 22 | - | |
| 23 | -## atualiza a versão do arquivo de dicionario | |
| 24 | -def updateFileDictVersion(version): | |
| 25 | - try: | |
| 26 | - txt_local_version = open(TXT_DICT_VERSION, 'w') | |
| 27 | - txt_local_version.write(version) | |
| 28 | - txt_local_version.close() | |
| 29 | - return True | |
| 30 | - except: | |
| 31 | - return False | |
| 32 | - | |
| 33 | - | |
| 34 | -## artualiza a versão do arquivo de player | |
| 35 | -def updateFilePlayerVersion(version): | |
| 36 | - try: | |
| 37 | - if os.path.isfile(TXT_PLAYER_VERSION): | |
| 38 | - txt_local_version = open(TXT_PLAYER_VERSION, 'w') | |
| 39 | - txt_local_version.write(version) | |
| 40 | - txt_local_version.close() | |
| 41 | - return True | |
| 42 | - else: | |
| 43 | - return False | |
| 44 | - except: | |
| 45 | - return False | |
| 46 | - | |
| 47 | - | |
| 48 | -## apos atualizar, criar arquivo de sucesso | |
| 49 | -##e move o atualizador do player para fora da pasta original para que o desinstalador não cause problema | |
| 50 | -def updateSuccess(): | |
| 51 | - txt_local_version = open(TEXT_CHECK_INSTALL, 'w') | |
| 52 | - txt_local_version.write('sucess') | |
| 53 | - txt_local_version.close() | |
| 54 | - shutil.move(PATH_RESOURCE+'update/bin/vlibrasPlayerUp.exe', PATH_RESOURCE+'update/') | |
| 55 | - | |
| 56 | -## faz dawnload do json das versões | |
| 57 | -def downladFileApi(_url): | |
| 58 | - try: | |
| 59 | - urllib.urlretrieve (_url, JSON_API_VERSION) | |
| 60 | - return True | |
| 61 | - except Exception, e: | |
| 62 | - print e | |
| 63 | - return False | |
| 64 | - | |
| 65 | - | |
| 66 | -def extractDictZip(): | |
| 67 | - dlg = wx.ProgressDialog("Atualização VLibras", "Finalizando Atualização...", style = wx.PD_APP_MODAL) | |
| 68 | - dlg.Pulse() | |
| 69 | - | |
| 70 | - | |
| 71 | - with zipfile.ZipFile(DICTIONARY_ZIP_PATH, "r") as z: | |
| 72 | - | |
| 73 | - z.extractall(DICTIONARY_EXTRACT_PATH) | |
| 74 | - dlg.Destroy() | |
| 75 | - |
update/updatePython/VlibrasCheckVersion.py
| ... | ... | @@ -1,28 +0,0 @@ |
| 1 | -# -*- coding: utf-8 -*- | |
| 2 | -from os import popen | |
| 3 | -from version import TVersion | |
| 4 | - | |
| 5 | -PATH_RESOURCE = 'c:/vlibras-libs/update/' | |
| 6 | -TXT_LOCAL_VERSION = PATH_RESOURCE+'version/version.txt' | |
| 7 | - | |
| 8 | -"""Usado pelo player para verificar se existe versão disponivel""" | |
| 9 | -"""O resultVersion (1 = player para átualizar, 2 = dicionartio para atualizar, 0 = não existe atualização disponível) | |
| 10 | -eh escrito no arquivo update/version.txt e eh lido pelo corePlugin""" | |
| 11 | - | |
| 12 | -if __name__ == '__main__': | |
| 13 | - | |
| 14 | - tversion = TVersion() | |
| 15 | - tversion.start() | |
| 16 | - | |
| 17 | - txt_local_version = open(TXT_LOCAL_VERSION, 'w') | |
| 18 | - | |
| 19 | - """Verifica se exite uma nova versao disponivel""" | |
| 20 | - resultVersion = tversion.checkVersion() | |
| 21 | - | |
| 22 | - """escreve o resultado no arquivo""" | |
| 23 | - txt_local_version.write(resultVersion) | |
| 24 | - | |
| 25 | - txt_local_version.close() | |
| 26 | - | |
| 27 | - print resultVersion | |
| 28 | - # print 'Finished' |
update/updatePython/frameUpdate.py
| ... | ... | @@ -1,94 +0,0 @@ |
| 1 | - | |
| 2 | -# -*- coding: utf-8 -*- | |
| 3 | - | |
| 4 | -import wx | |
| 5 | -import subprocess | |
| 6 | -import time | |
| 7 | -import os.path | |
| 8 | -from wx.lib.pubsub import pub | |
| 9 | -from DownloadFile import * | |
| 10 | -from VlibrasCheckVersion import * | |
| 11 | -import Util | |
| 12 | -from threading import Thread | |
| 13 | - | |
| 14 | -class UpdateView(wx.Frame,Thread): | |
| 15 | - | |
| 16 | - def __init__(self): | |
| 17 | - | |
| 18 | - Thread.__init__(self) | |
| 19 | - style = wx.SYSTEM_MENU | wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX | wx.MINIMIZE_BOX | |
| 20 | - wx.Frame.__init__(self, None, title='Atualização do VLibras', style=style,size=(380,150)) | |
| 21 | - self.SetIcon(wx.Icon(Util.ICON, wx.BITMAP_TYPE_ICO)) | |
| 22 | - self.myPanel = wx.Panel(self, -1) | |
| 23 | - self.myPanel.SetBackgroundColour('#F5F5F5') | |
| 24 | - btnCancel = wx.Button(self.myPanel, label="Cancelar",pos=(270, 85), size=(80, 25)) | |
| 25 | - self.txtInfo = wx.StaticText(self.myPanel, -1, pos=(5,105)) | |
| 26 | - self.txtInfo.SetForegroundColour('#000000') | |
| 27 | - self.progress = wx.Gauge(self.myPanel, range=100,pos=(5,40),size=(365,23)) | |
| 28 | - self.Center() | |
| 29 | - | |
| 30 | - # Anexa um evento ao botão | |
| 31 | - self.Bind(wx.EVT_BUTTON, self.onBtnCancelClick, btnCancel) | |
| 32 | - self.__close_callback = None | |
| 33 | - self.Bind(wx.EVT_CLOSE, self._when_closed) | |
| 34 | - | |
| 35 | - pub.subscribe(self.erroDeConexao, "erroDeConexao") | |
| 36 | - pub.subscribe(self.updateProgress, "updateProgress") | |
| 37 | - self.percentDownload = 0; | |
| 38 | - self.register_close_callback(lambda: True) | |
| 39 | - self.dlg = wx.ProgressDialog("Atualização", "Verificando Atualização...", style = wx.PD_CAN_ABORT | wx.PD_APP_MODAL) | |
| 40 | - self.pulse = True | |
| 41 | - | |
| 42 | - def run(self): | |
| 43 | - pulse =True | |
| 44 | - while self.pulse and pulse: | |
| 45 | - if(not pulse): | |
| 46 | - self.dlg.Destroy() | |
| 47 | - break | |
| 48 | - (pulse, skip) = self.dlg.Pulse() | |
| 49 | - | |
| 50 | - self.dlg.Destroy() | |
| 51 | - | |
| 52 | - """ chamado quando termina de verificacao de atualização """ | |
| 53 | - def closePulseDialog(self): | |
| 54 | - self.pulse = False | |
| 55 | - | |
| 56 | - | |
| 57 | - def erroDeConexao(self, msg): | |
| 58 | - wx.MessageBox('Ocorreu um erro ao tentar fazer atualização. \n Por favor tente mais tarde.', 'Informação',wx.OK | wx.ICON_INFORMATION) | |
| 59 | - self.Destroy() | |
| 60 | - | |
| 61 | - def register_close_callback(self, callback): | |
| 62 | - self.__close_callback = callback | |
| 63 | - | |
| 64 | - def _when_closed(self, event): | |
| 65 | - wx.CallAfter(pub.sendMessage, "cancelDownload",event = event) | |
| 66 | - # self.OnCloseFrame(event); | |
| 67 | - | |
| 68 | - | |
| 69 | - def onBtnCancelClick(self, event): | |
| 70 | - print 'cancel' | |
| 71 | - wx.CallAfter(pub.sendMessage, "cancelDownload",event = event) | |
| 72 | - | |
| 73 | - | |
| 74 | - def updateProgress(self, msg): | |
| 75 | - value = msg | |
| 76 | - self.percentDownload = value | |
| 77 | - self.progress.SetValue(value) | |
| 78 | - | |
| 79 | - def ShowMessage(self, mesagem): | |
| 80 | - dialog = wx.MessageDialog(self, message = mesagem, caption = "Atualização", | |
| 81 | - style = wx.OK | wx.ICON_INFORMATION) | |
| 82 | - dialog.ShowModal() | |
| 83 | - | |
| 84 | - def ShowMessageError(self, mesagem): | |
| 85 | - wx.MessageBox(mesagem, 'Informação', | |
| 86 | - wx.OK | wx.ICON_ERROR) | |
| 87 | - # self.downloadFile.stop() | |
| 88 | - self.Destroy() | |
| 89 | - | |
| 90 | - def showMessageDialog(self): | |
| 91 | - dialog = wx.MessageDialog(self, message = "Tem certeza que deseja cancelar a atualização?", caption = "Cancelar Atualização", | |
| 92 | - style = wx.YES_NO | wx.ICON_QUESTION) | |
| 93 | - return dialog.ShowModal() | |
| 94 | - |
update/updatePython/update.py
| ... | ... | @@ -1,113 +0,0 @@ |
| 1 | -# -*- coding: utf-8 -*- | |
| 2 | - | |
| 3 | -from version import TVersion | |
| 4 | -from frameUpdate import UpdateView | |
| 5 | -import wx | |
| 6 | -from DownloadFile import * | |
| 7 | -import Util | |
| 8 | -from wx.lib.pubsub import pub | |
| 9 | -import subprocess | |
| 10 | -import time | |
| 11 | -import os | |
| 12 | - | |
| 13 | - | |
| 14 | - | |
| 15 | -class Update(object): | |
| 16 | - """docstring for Update""" | |
| 17 | - | |
| 18 | - def __init__(self, version,frame): | |
| 19 | - super(Update, self).__init__() | |
| 20 | - self.version = version | |
| 21 | - self.frame = frame | |
| 22 | - self.downloadFile = None | |
| 23 | - pub.subscribe(self.downloadSucess, "downloadSucess") | |
| 24 | - pub.subscribe(self.cancelDownload, "cancelDownload") | |
| 25 | - | |
| 26 | - def cancelDownload(self,event): | |
| 27 | - | |
| 28 | - if(self.frame.percentDownload>= 100): | |
| 29 | - if not (self.downloadFile == None): | |
| 30 | - self.downloadFile.stop() | |
| 31 | - self.frame.Destroy() | |
| 32 | - | |
| 33 | - response = self.frame.showMessageDialog() | |
| 34 | - | |
| 35 | - if (response == wx.ID_YES): | |
| 36 | - if not (self.downloadFile == None): | |
| 37 | - self.downloadFile.stop() | |
| 38 | - self.frame.Destroy() | |
| 39 | - self.frame.ShowMessage('Atualização Cancelada!') | |
| 40 | - else: | |
| 41 | - event.StopPropagation() | |
| 42 | - | |
| 43 | - | |
| 44 | - def stopDownload(self): | |
| 45 | - if not (self.downloadFile == None): | |
| 46 | - self.downloadFile.stop() | |
| 47 | - | |
| 48 | - def startDownloadPlayer(self): | |
| 49 | - # #inicia o download do arquivo | |
| 50 | - self.downloadFile = DownloadFile2(version.url_download_player, Util.INSTALL_PLAYER_PATH) | |
| 51 | - self.downloadFile.start() | |
| 52 | - self.frame.txtInfo.SetLabel('Baixando a atualização...') | |
| 53 | - | |
| 54 | - def startDownloadDict(self): | |
| 55 | - # #inicia o download do arquivo | |
| 56 | - self.downloadFile = DownloadFile2(version.url_download_dict, Util.DICTIONARY_ZIP_PATH) | |
| 57 | - self.downloadFile.start() | |
| 58 | - self.frame.txtInfo.SetLabel('Baixando a atualização...') | |
| 59 | - | |
| 60 | - """funcao chamada pelo DownloadFile quando terminado o download tanto do dicionario quanto do player""" | |
| 61 | - def downloadSucess(self, msg): | |
| 62 | - self.frame.Hide() | |
| 63 | - self.frame.txtInfo.SetLabel('Instalando Atualização...') | |
| 64 | - if(self.version.isUpdateDict()): | |
| 65 | - try: | |
| 66 | - Util.extractDictZip() | |
| 67 | - self.frame.ShowMessage('O Dicionário VLibras foi atualizado com sucesso!') | |
| 68 | - Util.updateFileDictVersion(self.version.api_dict_version_full) | |
| 69 | - except: | |
| 70 | - self.frame.ShowMessageError('Houve um erro ao atualizar o VLibras!') | |
| 71 | - | |
| 72 | - elif (self.version.isUpdatePlayer()): | |
| 73 | - | |
| 74 | - process = subprocess.call(Util.INSTALL_PLAYER_PATH) | |
| 75 | - time.sleep( 3 ) | |
| 76 | - if os.path.isfile(Util.TEXT_CHECK_INSTALL): | |
| 77 | - self.frame.ShowMessage('O VLibras foi atualizado com sucesso!') | |
| 78 | - Util.updateFilePlayerVersion(self.version.api_player_version_full) | |
| 79 | - | |
| 80 | - else: | |
| 81 | - self.frame.ShowMessageError('O VLibras não foi atualizado!') | |
| 82 | - subprocess.Popen(Util.PATH_PLAYER) | |
| 83 | - | |
| 84 | - self.frame.Destroy() | |
| 85 | - | |
| 86 | - | |
| 87 | -if __name__ == '__main__': | |
| 88 | - | |
| 89 | - app = wx.App(False) | |
| 90 | - frame = UpdateView() | |
| 91 | - version = TVersion() | |
| 92 | - #version.start() | |
| 93 | - frame.start() | |
| 94 | - update = Update(version,frame) | |
| 95 | - print version.checkVersion(); | |
| 96 | - frame.closePulseDialog() | |
| 97 | - | |
| 98 | - if(version.isUpdatePlayer()): | |
| 99 | - frame.Show() | |
| 100 | - update.startDownloadPlayer() | |
| 101 | - app.MainLoop() | |
| 102 | - | |
| 103 | - elif(version.isUpdateDict()): | |
| 104 | - frame.Show() | |
| 105 | - update.startDownloadDict() | |
| 106 | - app.MainLoop() | |
| 107 | - | |
| 108 | - else: | |
| 109 | - | |
| 110 | - frame.ShowMessage('O VLibras está atualizado!') | |
| 111 | - | |
| 112 | - | |
| 113 | - |
update/updatePython/version.py
| ... | ... | @@ -1,102 +0,0 @@ |
| 1 | -# -*- coding: utf-8 -*- | |
| 2 | -import os.path | |
| 3 | -import json, zipfile, subprocess,urllib | |
| 4 | -from os import popen | |
| 5 | -import Util | |
| 6 | -import sys , shutil | |
| 7 | -from threading import Thread | |
| 8 | - | |
| 9 | - | |
| 10 | -class TVersion(Thread): | |
| 11 | - """classe responsável por fornecer as versões do player e do dicionário""" | |
| 12 | - def __init__(self): | |
| 13 | - | |
| 14 | - self.api_dict_version_full = '0.0.0_0.0.0' | |
| 15 | - self.api_dict_version = 000000 | |
| 16 | - self.api_player_version = 000 | |
| 17 | - self.api_player_version_full = '0.0.0' | |
| 18 | - self.url_download_player = '' | |
| 19 | - self.url_download_dict = '' | |
| 20 | - self.local_dict_version_full = '0.0.0_0.0.0' | |
| 21 | - self.local_dict_version = 000000 | |
| 22 | - self.local_player_version = 000 | |
| 23 | - Thread.__init__(self) | |
| 24 | - | |
| 25 | - | |
| 26 | - def run(self): | |
| 27 | - self.loadLocalVersion() | |
| 28 | - self.loadApiVersion() | |
| 29 | - | |
| 30 | - ## Carrega a versão online do dicionario e do play | |
| 31 | - def loadApiVersion(self): | |
| 32 | - try: | |
| 33 | - if(Util.downladFileApi(Util.URL_REQUEST_API+self.local_dict_version_full+'?type=json')): | |
| 34 | - with open(Util.JSON_API_VERSION) as data: | |
| 35 | - json_data = json.load(data) | |
| 36 | - | |
| 37 | - self.api_dict_version_full = json_data['dictionaryVersion'].encode('utf-8') | |
| 38 | - self.api_dict_version = int(json_data['dictionaryVersion'].encode('utf-8').replace(".", "").replace("_", "")) | |
| 39 | - self.api_player_version = int(json_data['playerVersion'].encode('utf-8').replace(".", "")) | |
| 40 | - self.api_player_version_full = json_data['playerVersion'].encode('utf-8') | |
| 41 | - self.url_download_player = json_data['playerUrl'].encode('utf-8') | |
| 42 | - self.url_download_dict = json_data['dictionaryUrl'].encode('utf-8') | |
| 43 | - else: | |
| 44 | - print 'Erro ao fazer download do json de versoes' | |
| 45 | - except: | |
| 46 | - print 'Erro ao carregar JSON_API_VERSION' | |
| 47 | - | |
| 48 | - | |
| 49 | - ## Carrega a versão local do dicionario e do play | |
| 50 | - def loadLocalVersion(self): | |
| 51 | - | |
| 52 | - if os.path.isfile(Util.TXT_DICT_VERSION): | |
| 53 | - fileDictVersion = open(Util.TXT_DICT_VERSION,'r') | |
| 54 | - versionLocalDict = fileDictVersion.readline() | |
| 55 | - fileDictVersion.close() | |
| 56 | - self.local_dict_version_full = versionLocalDict | |
| 57 | - self.local_dict_version = int(versionLocalDict.encode('utf-8').replace(".", "").replace("_", "")) | |
| 58 | - | |
| 59 | - if os.path.isfile(Util.TXT_PLAYER_VERSION): | |
| 60 | - filePlayerVersion = open(Util.TXT_PLAYER_VERSION,'r') | |
| 61 | - versionLocalPlayer = filePlayerVersion.readline() | |
| 62 | - filePlayerVersion.close() | |
| 63 | - self.local_player_version = int(versionLocalPlayer.encode('utf-8').replace(".", "")) | |
| 64 | - | |
| 65 | - | |
| 66 | - ## Verifica se a vesao local do player é menor que a disponível pra download | |
| 67 | - def isUpdatePlayer(self): | |
| 68 | - return self.api_player_version > self.local_player_version | |
| 69 | - | |
| 70 | - ## Verifica se a vesao local do dicionário é menor que a disponível pra download | |
| 71 | - def isUpdateDict(self): | |
| 72 | - return self.api_dict_version > self.local_dict_version | |
| 73 | - | |
| 74 | - ## recarrega as versões | |
| 75 | - def reload(self): | |
| 76 | - self.loadLocalVersion() | |
| 77 | - self.loadApiVersion() | |
| 78 | - | |
| 79 | - """return (1 = player para átualizar, 2 = dicionario para atualizar, 0 = não existe atualização disponível) """ | |
| 80 | - def checkVersion(self): | |
| 81 | - self.reload() | |
| 82 | - if(self.isUpdatePlayer()): | |
| 83 | - return '1'; | |
| 84 | - elif (self.isUpdateDict()): | |
| 85 | - return '2' | |
| 86 | - else: | |
| 87 | - return '0' | |
| 88 | - | |
| 89 | - | |
| 90 | - | |
| 91 | - | |
| 92 | - | |
| 93 | -if __name__ == '__main__': | |
| 94 | - | |
| 95 | - version = TVersion() | |
| 96 | - version.start() | |
| 97 | - version.checkVersion(); | |
| 98 | - | |
| 99 | - print'existe novo player: ',version.isUpdatePlayer() | |
| 100 | - print 'existe novo dicionario: ',version.isUpdateDict() | |
| 101 | - print 'versao local do dicionario: ',version.local_dict_version | |
| 102 | - print 'versao api do dicionario: ',version.api_dict_version |
update/updatePython/writeSucessInstall.py
| ... | ... | @@ -1,26 +0,0 @@ |
| 1 | -# -*- coding: utf-8 -*- | |
| 2 | -import Util, os | |
| 3 | - | |
| 4 | - | |
| 5 | -if __name__ == '__main__': | |
| 6 | - | |
| 7 | - Util.updateSuccess() | |
| 8 | - | |
| 9 | - for raiz, diretorios, arquivos in os.walk('C:/vlibras-libs/vlibras-translate/src'): | |
| 10 | - for arquivo in arquivos: | |
| 11 | - if arquivo.endswith('.py'): | |
| 12 | - os.remove(os.path.join(raiz,arquivo)) | |
| 13 | - | |
| 14 | - | |
| 15 | - | |
| 16 | - | |
| 17 | - | |
| 18 | - | |
| 19 | - | |
| 20 | - | |
| 21 | - | |
| 22 | - | |
| 23 | - | |
| 24 | - | |
| 25 | - | |
| 26 | - |
update/vlibrasDictInstall.cpp
| ... | ... | @@ -1,61 +0,0 @@ |
| 1 | - | |
| 2 | - | |
| 3 | -#include <windows.h> //include all the basics | |
| 4 | - //string and other mapping macros | |
| 5 | - | |
| 6 | - | |
| 7 | -int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, | |
| 8 | - LPSTR lpCmdLine, int nShowCmd) | |
| 9 | -{ | |
| 10 | - | |
| 11 | - STARTUPINFO StartupInfo; | |
| 12 | - PROCESS_INFORMATION ProcessInfo; | |
| 13 | - char Args[4096]; | |
| 14 | - char *pEnvCMD = NULL; | |
| 15 | - char *pDefaultCMD = "CMD.EXE"; | |
| 16 | - ULONG rc; | |
| 17 | - | |
| 18 | - memset(&StartupInfo, 0, sizeof(StartupInfo)); | |
| 19 | - StartupInfo.cb = sizeof(STARTUPINFO); | |
| 20 | - StartupInfo.dwFlags = STARTF_USESHOWWINDOW; | |
| 21 | - StartupInfo.wShowWindow = SW_HIDE; | |
| 22 | - | |
| 23 | - Args[0] = 0; | |
| 24 | - | |
| 25 | - pEnvCMD = getenv("COMSPEC"); | |
| 26 | - | |
| 27 | - if(pEnvCMD){ | |
| 28 | - | |
| 29 | - strcpy(Args, pEnvCMD); | |
| 30 | - } | |
| 31 | - else{ | |
| 32 | - strcpy(Args, pDefaultCMD); | |
| 33 | - } | |
| 34 | - | |
| 35 | - // "/c" option - Do the command then terminate the command window | |
| 36 | - strcat(Args, " /c "); | |
| 37 | - //the application you would like to run from the command window | |
| 38 | - strcat(Args, "c:\\Python27\\python.exe"); | |
| 39 | - strcat(Args, " "); | |
| 40 | - //the parameters passed to the application being run from the command window. | |
| 41 | - strcat(Args, "..\\py\\update.pyc"); | |
| 42 | - | |
| 43 | - if (!CreateProcess( NULL, Args, NULL, NULL, FALSE, | |
| 44 | - CREATE_NEW_CONSOLE, | |
| 45 | - NULL, | |
| 46 | - NULL, | |
| 47 | - &StartupInfo, | |
| 48 | - &ProcessInfo)) | |
| 49 | - { | |
| 50 | - return GetLastError(); | |
| 51 | - } | |
| 52 | - | |
| 53 | - WaitForSingleObject(ProcessInfo.hProcess, INFINITE); | |
| 54 | - if(!GetExitCodeProcess(ProcessInfo.hProcess, &rc)) | |
| 55 | - rc = 0; | |
| 56 | - | |
| 57 | - CloseHandle(ProcessInfo.hThread); | |
| 58 | - CloseHandle(ProcessInfo.hProcess); | |
| 59 | - | |
| 60 | - return 0; | |
| 61 | -} | |
| 62 | 0 | \ No newline at end of file |
| ... | ... | @@ -0,0 +1,102 @@ |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | +[code] | |
| 7 | + | |
| 8 | + | |
| 9 | +function jsonVersionGetValue(const FileName, TagName: string): string; | |
| 10 | +var | |
| 11 | + TmpStringLines: string; | |
| 12 | + FileLines: TStringList; | |
| 13 | + I: Integer; | |
| 14 | + Tag: string; | |
| 15 | + Line: string; | |
| 16 | + TagPos: Integer; | |
| 17 | + Valor: string; | |
| 18 | + | |
| 19 | + | |
| 20 | +begin | |
| 21 | + Result := 'null'; | |
| 22 | + FileLines := TStringList.Create; | |
| 23 | + | |
| 24 | + Tag := '"' + TagName + '"'; | |
| 25 | + | |
| 26 | + try | |
| 27 | + LoadStringFromfile(FileName, TmpStringLines); | |
| 28 | + FileLines.Text:= TmpStringLines; | |
| 29 | + except | |
| 30 | + ShowExceptionMessage; | |
| 31 | + end; | |
| 32 | + | |
| 33 | + for I := 0 to FileLines.Count - 1 do | |
| 34 | + begin | |
| 35 | + Line := FileLines[I]; | |
| 36 | + TagPos := Pos(Tag, Line); | |
| 37 | + if TagPos > 0 then | |
| 38 | + begin | |
| 39 | + | |
| 40 | + Valor := Copy(Line, TagPos + Length(Tag)+3, MaxInt); | |
| 41 | + StringChangeEx(Valor, ',', '', True); | |
| 42 | + | |
| 43 | + Result := Copy(Valor,0,Length(Valor)-1); | |
| 44 | + | |
| 45 | + Break; | |
| 46 | + end; | |
| 47 | + end; | |
| 48 | + FileLines.Free; | |
| 49 | +end; | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | +function jsonVersionReplaceValue(TagName, TagValue: string): boolean; | |
| 55 | + | |
| 56 | +var | |
| 57 | + TmpStringLines: string; | |
| 58 | + FileLines: TStringList; | |
| 59 | + I: Integer; | |
| 60 | + Tag: string; | |
| 61 | + Line: string; | |
| 62 | + TagPos: Integer; | |
| 63 | + Valor: string; | |
| 64 | + linesText: string; | |
| 65 | + jsonPath: string; | |
| 66 | + | |
| 67 | + | |
| 68 | +begin | |
| 69 | + FileLines := TStringList.Create; | |
| 70 | + | |
| 71 | + jsonPath:= ExpandConstant('{sd}\VLibras\version.json'); | |
| 72 | + if LoadStringFromfile(jsonPath, TmpStringLines) then begin | |
| 73 | + | |
| 74 | + FileLines.Text:= TmpStringLines; | |
| 75 | + end; | |
| 76 | + | |
| 77 | + Result := True; | |
| 78 | + Tag := '"' + TagName + '"'; | |
| 79 | + | |
| 80 | + for I := 0 to FileLines.Count - 1 do | |
| 81 | + begin | |
| 82 | + Line := FileLines[I]; | |
| 83 | + TagPos := Pos(Tag, Line); | |
| 84 | + if TagPos > 0 then | |
| 85 | + begin | |
| 86 | + | |
| 87 | + Delete(Line, TagPos + Length(Tag), MaxInt); | |
| 88 | + | |
| 89 | + Line := Line + ': "' + TagValue + '"'; | |
| 90 | + FileLines[I] := Line; | |
| 91 | + linesText := FileLines.Text; | |
| 92 | + FileLines.Free; | |
| 93 | + if not SaveStringToFile(ExpandConstant('{sd}\VLibras\version.json'), linesText, False) then | |
| 94 | + Result := False; | |
| 95 | + Break; | |
| 96 | + end; | |
| 97 | + end; | |
| 98 | +end; | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | ... | ... |
update/vlibrasPlayerInstall.cpp
| ... | ... | @@ -1,61 +0,0 @@ |
| 1 | - | |
| 2 | - | |
| 3 | -#include <windows.h> //include all the basics | |
| 4 | - //string and other mapping macros | |
| 5 | - | |
| 6 | - | |
| 7 | -int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, | |
| 8 | - LPSTR lpCmdLine, int nShowCmd) | |
| 9 | -{ | |
| 10 | - | |
| 11 | - STARTUPINFO StartupInfo; | |
| 12 | - PROCESS_INFORMATION ProcessInfo; | |
| 13 | - char Args[4096]; | |
| 14 | - char *pEnvCMD = NULL; | |
| 15 | - char *pDefaultCMD = "CMD.EXE"; | |
| 16 | - ULONG rc; | |
| 17 | - | |
| 18 | - memset(&StartupInfo, 0, sizeof(StartupInfo)); | |
| 19 | - StartupInfo.cb = sizeof(STARTUPINFO); | |
| 20 | - StartupInfo.dwFlags = STARTF_USESHOWWINDOW; | |
| 21 | - StartupInfo.wShowWindow = SW_HIDE; | |
| 22 | - | |
| 23 | - Args[0] = 0; | |
| 24 | - | |
| 25 | - pEnvCMD = getenv("COMSPEC"); | |
| 26 | - | |
| 27 | - if(pEnvCMD){ | |
| 28 | - | |
| 29 | - strcpy(Args, pEnvCMD); | |
| 30 | - } | |
| 31 | - else{ | |
| 32 | - strcpy(Args, pDefaultCMD); | |
| 33 | - } | |
| 34 | - | |
| 35 | - // "/c" option - Do the command then terminate the command window | |
| 36 | - strcat(Args, " /c "); | |
| 37 | - //the application you would like to run from the command window | |
| 38 | - strcat(Args, "python"); | |
| 39 | - strcat(Args, " "); | |
| 40 | - //the parameters passed to the application being run from the command window. | |
| 41 | - strcat(Args, "py\\update.pyc"); | |
| 42 | - | |
| 43 | - if (!CreateProcess( NULL, Args, NULL, NULL, FALSE, | |
| 44 | - CREATE_NEW_CONSOLE, | |
| 45 | - NULL, | |
| 46 | - NULL, | |
| 47 | - &StartupInfo, | |
| 48 | - &ProcessInfo)) | |
| 49 | - { | |
| 50 | - return GetLastError(); | |
| 51 | - } | |
| 52 | - | |
| 53 | - WaitForSingleObject(ProcessInfo.hProcess, INFINITE); | |
| 54 | - if(!GetExitCodeProcess(ProcessInfo.hProcess, &rc)) | |
| 55 | - rc = 0; | |
| 56 | - | |
| 57 | - CloseHandle(ProcessInfo.hThread); | |
| 58 | - CloseHandle(ProcessInfo.hProcess); | |
| 59 | - | |
| 60 | - return 0; | |
| 61 | -} | |
| 62 | 0 | \ No newline at end of file |
update/writeSucessInstall.cpp
| ... | ... | @@ -1,61 +0,0 @@ |
| 1 | - | |
| 2 | - | |
| 3 | -#include <windows.h> //include all the basics | |
| 4 | - //string and other mapping macros | |
| 5 | - | |
| 6 | - | |
| 7 | -int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, | |
| 8 | - LPSTR lpCmdLine, int nShowCmd) | |
| 9 | -{ | |
| 10 | - | |
| 11 | - STARTUPINFO StartupInfo; | |
| 12 | - PROCESS_INFORMATION ProcessInfo; | |
| 13 | - char Args[4096]; | |
| 14 | - char *pEnvCMD = NULL; | |
| 15 | - char *pDefaultCMD = "CMD.EXE"; | |
| 16 | - ULONG rc; | |
| 17 | - | |
| 18 | - memset(&StartupInfo, 0, sizeof(StartupInfo)); | |
| 19 | - StartupInfo.cb = sizeof(STARTUPINFO); | |
| 20 | - StartupInfo.dwFlags = STARTF_USESHOWWINDOW; | |
| 21 | - StartupInfo.wShowWindow = SW_HIDE; | |
| 22 | - | |
| 23 | - Args[0] = 0; | |
| 24 | - | |
| 25 | - pEnvCMD = getenv("COMSPEC"); | |
| 26 | - | |
| 27 | - if(pEnvCMD){ | |
| 28 | - | |
| 29 | - strcpy(Args, pEnvCMD); | |
| 30 | - } | |
| 31 | - else{ | |
| 32 | - strcpy(Args, pDefaultCMD); | |
| 33 | - } | |
| 34 | - | |
| 35 | - // "/c" option - Do the command then terminate the command window | |
| 36 | - strcat(Args, " /c "); | |
| 37 | - //the application you would like to run from the command window | |
| 38 | - strcat(Args, "c:\\Python27\\python.exe"); | |
| 39 | - strcat(Args, " "); | |
| 40 | - //the parameters passed to the application being run from the command window. | |
| 41 | - strcat(Args, "..\\py\\writeSucessInstall.pyc"); | |
| 42 | - | |
| 43 | - if (!CreateProcess( NULL, Args, NULL, NULL, FALSE, | |
| 44 | - CREATE_NEW_CONSOLE, | |
| 45 | - NULL, | |
| 46 | - NULL, | |
| 47 | - &StartupInfo, | |
| 48 | - &ProcessInfo)) | |
| 49 | - { | |
| 50 | - return GetLastError(); | |
| 51 | - } | |
| 52 | - | |
| 53 | - WaitForSingleObject(ProcessInfo.hProcess, INFINITE); | |
| 54 | - if(!GetExitCodeProcess(ProcessInfo.hProcess, &rc)) | |
| 55 | - rc = 0; | |
| 56 | - | |
| 57 | - CloseHandle(ProcessInfo.hThread); | |
| 58 | - CloseHandle(ProcessInfo.hProcess); | |
| 59 | - | |
| 60 | - return 0; | |
| 61 | -} | |
| 62 | 0 | \ No newline at end of file |