Commit 40849d9f981c448865fe48635909828017100ce6

Authored by CaioMoraes
1 parent 646b7578
Exists in Au-ghub/master

Adicionei download e extração de sinais.

Baixa os sinais 1.zip, 2.zip... atualizados ou ausentes na máquina do
usuário e os extrai uma pasta antes da pasta da versão.  Ainda precisa
atualizar o endereço da pasta dos sinais remotos e adicionar o NVDA.
Showing 2 changed files with 554 additions and 0 deletions   Show diff stats
AU.csproj 0 → 100644
... ... @@ -0,0 +1,175 @@
  1 +<?xml version="1.0" encoding="Windows-1252"?>
  2 +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  3 + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  4 + <PropertyGroup>
  5 + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
  6 + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
  7 + <ProjectGuid>{6EB1FB18-7A1B-46E0-9991-A18B3AA32E5C}</ProjectGuid>
  8 + <OutputType>Exe</OutputType>
  9 + <AppDesignerFolder>Properties</AppDesignerFolder>
  10 + <RootNamespace>VLIBRAS_II</RootNamespace>
  11 + <AssemblyName>VLIBRAS_II</AssemblyName>
  12 + <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
  13 + <FileAlignment>512</FileAlignment>
  14 + <IsWebBootstrapper>true</IsWebBootstrapper>
  15 + <PublishUrl>C:\Users\Caio Moraes\Documents\AU\release\</PublishUrl>
  16 + <Install>true</Install>
  17 + <InstallFrom>Web</InstallFrom>
  18 + <UpdateEnabled>true</UpdateEnabled>
  19 + <UpdateMode>Foreground</UpdateMode>
  20 + <UpdateInterval>7</UpdateInterval>
  21 + <UpdateIntervalUnits>Days</UpdateIntervalUnits>
  22 + <UpdatePeriodically>false</UpdatePeriodically>
  23 + <UpdateRequired>true</UpdateRequired>
  24 + <MapFileExtensions>false</MapFileExtensions>
  25 + <InstallUrl>http://150.165.205.137:8080/</InstallUrl>
  26 + <UpdateUrl>http://150.165.205.137:8080/</UpdateUrl>
  27 + <ProductName>VLIBRAS</ProductName>
  28 + <PublisherName>LAVID-UFPB</PublisherName>
  29 + <MinimumRequiredVersion>1.0.0.67</MinimumRequiredVersion>
  30 + <OpenBrowserOnPublish>false</OpenBrowserOnPublish>
  31 + <ApplicationRevision>77</ApplicationRevision>
  32 + <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
  33 + <UseApplicationTrust>true</UseApplicationTrust>
  34 + <CreateDesktopShortcut>true</CreateDesktopShortcut>
  35 + <PublishWizardCompleted>true</PublishWizardCompleted>
  36 + <BootstrapperEnabled>true</BootstrapperEnabled>
  37 + </PropertyGroup>
  38 + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
  39 + <PlatformTarget>AnyCPU</PlatformTarget>
  40 + <DebugSymbols>true</DebugSymbols>
  41 + <DebugType>full</DebugType>
  42 + <Optimize>false</Optimize>
  43 + <OutputPath>bin\Debug\</OutputPath>
  44 + <DefineConstants>DEBUG;TRACE</DefineConstants>
  45 + <ErrorReport>prompt</ErrorReport>
  46 + <WarningLevel>4</WarningLevel>
  47 + </PropertyGroup>
  48 + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
  49 + <PlatformTarget>AnyCPU</PlatformTarget>
  50 + <DebugType>pdbonly</DebugType>
  51 + <Optimize>true</Optimize>
  52 + <OutputPath>bin\Release\</OutputPath>
  53 + <DefineConstants>TRACE</DefineConstants>
  54 + <ErrorReport>prompt</ErrorReport>
  55 + <WarningLevel>4</WarningLevel>
  56 + </PropertyGroup>
  57 + <PropertyGroup>
  58 + <TargetZone>LocalIntranet</TargetZone>
  59 + </PropertyGroup>
  60 + <PropertyGroup>
  61 + <GenerateManifests>true</GenerateManifests>
  62 + </PropertyGroup>
  63 + <PropertyGroup>
  64 + <ApplicationManifest>Properties\app.manifest</ApplicationManifest>
  65 + </PropertyGroup>
  66 + <PropertyGroup>
  67 + <SignManifests>true</SignManifests>
  68 + </PropertyGroup>
  69 + <PropertyGroup>
  70 + <ManifestCertificateThumbprint>2811720AF50392C2792C67C4DEBCB1D40662604A</ManifestCertificateThumbprint>
  71 + </PropertyGroup>
  72 + <PropertyGroup>
  73 + <ManifestKeyFile>AU_5_TemporaryKey.pfx</ManifestKeyFile>
  74 + </PropertyGroup>
  75 + <PropertyGroup>
  76 + <ManifestTimestampUrl>http://timestamp.verisign.com/scripts/timstamp.dll</ManifestTimestampUrl>
  77 + </PropertyGroup>
  78 + <PropertyGroup>
  79 + <ApplicationIcon>icon_vlibras.ico</ApplicationIcon>
  80 + </PropertyGroup>
  81 + <PropertyGroup>
  82 + <StartupObject />
  83 + </PropertyGroup>
  84 + <ItemGroup>
  85 + <Reference Include="System" />
  86 + <Reference Include="System.Core" />
  87 + <Reference Include="System.IO.Compression" />
  88 + <Reference Include="System.IO.Compression.FileSystem" />
  89 + <Reference Include="System.Xml.Linq" />
  90 + <Reference Include="System.Data.DataSetExtensions" />
  91 + <Reference Include="Microsoft.CSharp" />
  92 + <Reference Include="System.Data" />
  93 + <Reference Include="System.Deployment" />
  94 + <Reference Include="System.Drawing" />
  95 + <Reference Include="System.Windows.Forms" />
  96 + <Reference Include="System.Xml" />
  97 + </ItemGroup>
  98 + <ItemGroup>
  99 + <Compile Include="Form1.cs">
  100 + <SubType>Form</SubType>
  101 + </Compile>
  102 + <Compile Include="Form1.Designer.cs">
  103 + <DependentUpon>Form1.cs</DependentUpon>
  104 + </Compile>
  105 + <Compile Include="Program.cs" />
  106 + <Compile Include="Properties\AssemblyInfo.cs" />
  107 + <EmbeddedResource Include="Form1.resx">
  108 + <DependentUpon>Form1.cs</DependentUpon>
  109 + </EmbeddedResource>
  110 + <EmbeddedResource Include="Properties\Resources.resx">
  111 + <Generator>ResXFileCodeGenerator</Generator>
  112 + <LastGenOutput>Resources.Designer.cs</LastGenOutput>
  113 + <SubType>Designer</SubType>
  114 + </EmbeddedResource>
  115 + <Compile Include="Properties\Resources.Designer.cs">
  116 + <AutoGen>True</AutoGen>
  117 + <DependentUpon>Resources.resx</DependentUpon>
  118 + <DesignTime>True</DesignTime>
  119 + </Compile>
  120 + <!-- <None Include="AU_5_TemporaryKey.pfx" /> -->
  121 + <None Include="Properties\app.manifest">
  122 + <SubType>Designer</SubType>
  123 + </None>
  124 + <None Include="Properties\Settings.settings">
  125 + <Generator>SettingsSingleFileGenerator</Generator>
  126 + <LastGenOutput>Settings.Designer.cs</LastGenOutput>
  127 + </None>
  128 + <Compile Include="Properties\Settings.Designer.cs">
  129 + <AutoGen>True</AutoGen>
  130 + <DependentUpon>Settings.settings</DependentUpon>
  131 + <DesignTimeSharedInput>True</DesignTimeSharedInput>
  132 + </Compile>
  133 + </ItemGroup>
  134 + <ItemGroup>
  135 + <None Include="App.config" />
  136 + </ItemGroup>
  137 + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  138 + <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
  139 + Other similar extension points exist, see Microsoft.Common.targets.
  140 + <Target Name="AfterBuild">
  141 + </Target>
  142 + -->
  143 + <!-- <Target Name="BeforeBuild">
  144 + <Exec Command="&quot;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin\signtool.exe&quot; sign /f &quot;$(ProjectDir)AU_1_TemporaryKey.pfx&quot; /v &quot;$(ProjectDir)bin\$(ConfigurationName)\$(TargetFileName)&quot;" />
  145 + </Target> -->
  146 + <!-- <Exec Command="&quot;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin\signtool.exe&quot; sign /f &quot;$(ProjectDir)AU_1_TemporaryKey.pfx&quot; /p nightbird /v &quot;$(ProjectDir)obj\x86\$(ConfigurationName)\$(TargetFileName)&quot;" /> -->
  147 + <ItemGroup>
  148 + <Content Include="$(SolutionDir)enviar\**\*">
  149 + <Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
  150 + <Visible>false</Visible>
  151 + </Content>
  152 + <Content Include="$(SolutionDir)requisitos\**\*">
  153 + <Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
  154 + <Visible>false</Visible>
  155 + </Content>
  156 + <Content Include="icon_vlibras.ico" />
  157 + </ItemGroup>
  158 + <ItemGroup>
  159 + <BootstrapperPackage Include=".NETFramework,Version=v4.5">
  160 + <Visible>False</Visible>
  161 + <ProductName>Microsoft .NET Framework 4.5 %28x86 and x64%29</ProductName>
  162 + <Install>true</Install>
  163 + </BootstrapperPackage>
  164 + <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
  165 + <Visible>False</Visible>
  166 + <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
  167 + <Install>false</Install>
  168 + </BootstrapperPackage>
  169 + <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
  170 + <Visible>False</Visible>
  171 + <ProductName>.NET Framework 3.5 SP1</ProductName>
  172 + <Install>false</Install>
  173 + </BootstrapperPackage>
  174 + </ItemGroup>
  175 +</Project>
0 176 \ No newline at end of file
... ...
Program.cs 0 → 100644
... ... @@ -0,0 +1,379 @@
  1 +using System;
  2 +using System.Collections.Generic;
  3 +using System.Linq;
  4 +using System.Threading.Tasks;
  5 +using System.Windows.Forms;
  6 +using System.Diagnostics;
  7 +using System.Security.Permissions;
  8 +using Microsoft.Win32;
  9 +using System.Net;
  10 +using System.Collections;
  11 +using System.IO;
  12 +using System.IO.Compression;
  13 +
  14 +namespace AU
  15 +{
  16 + static class Program
  17 + {
  18 + public static bool RemoteFileExists(string url){
  19 + try{
  20 + //Creating the HttpWebRequest
  21 + HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
  22 + //Setting the Request method HEAD
  23 + request.Method = "HEAD";
  24 + //Getting the Web Response.
  25 + HttpWebResponse response = request.GetResponse() as HttpWebResponse;
  26 + //Returns TURE if the Status code == 200
  27 + return (response.StatusCode == HttpStatusCode.OK);
  28 + }
  29 + catch{
  30 + //Any exception will returns false.
  31 + return false;
  32 + }
  33 + }
  34 +
  35 + //File.Exists(path);
  36 +
  37 + public static bool RemoteIsNewerThanLocal(string url, string path){
  38 + FileInfo sourceFile = new FileInfo(path);
  39 + var request = (HttpWebRequest)WebRequest.Create(url);
  40 + request.Method = "HEAD";
  41 + var response = (HttpWebResponse)request.GetResponse();
  42 + //Console.WriteLine("response.LastModified: "+response.LastModified);
  43 + //Console.WriteLine("sourceFile.LastWriteTime: "+sourceFile.LastWriteTime);
  44 + if(response.LastModified > sourceFile.LastWriteTime){
  45 + return true;
  46 + }else{
  47 + return false;
  48 + }
  49 + }
  50 +
  51 + public static void DownloadFileToPath(string site, string path){
  52 + try{
  53 + WebClient webClient = new WebClient();
  54 + webClient.DownloadFile(site, path);
  55 + }catch(Exception e){
  56 + Console.WriteLine("Erro: {0}", e);
  57 + }
  58 + }
  59 + static void ResetEnvVar(){
  60 + string vLibrasAtual = Environment.GetEnvironmentVariable("PATH_VLIBRAS",EnvironmentVariableTarget.Machine);
  61 + string vLibrasNovo = Directory.GetCurrentDirectory();
  62 +
  63 + if(!vLibrasNovo.Equals(vLibrasAtual)){
  64 + Console.WriteLine("O VLibras foi atualizado ou não estava instalado, é necessário atualizar algumas informações.");
  65 + Console.WriteLine("Por favor, confirme a reconfiguração das variáveis de ambiente do VLibras.");
  66 + string[] buscaReset = Directory.GetFiles(Directory.GetCurrentDirectory(), "ResetEnvVar.exe", SearchOption.AllDirectories);
  67 + string resetPath = buscaReset[0];
  68 +
  69 + System.Diagnostics.ProcessStartInfo resetProcInfo = new System.Diagnostics.ProcessStartInfo();
  70 + resetProcInfo.FileName = resetPath;
  71 + resetProcInfo.Verb = "runas"; //ADM
  72 + //resetProcInfo.Arguments = comandoUnins;
  73 +
  74 + System.Diagnostics.Process resetProc = new System.Diagnostics.Process();
  75 + resetProc.StartInfo = resetProcInfo;
  76 + resetProc.Start();
  77 + resetProc.WaitForExit();
  78 + }
  79 + }
  80 +
  81 + static void desinstalarVLibras(RegistryKey reg){
  82 + //Variáveis para desinstalação
  83 + System.Diagnostics.Process uninsProc = new System.Diagnostics.Process();
  84 + System.Diagnostics.ProcessStartInfo uninsProcInfo = new System.Diagnostics.ProcessStartInfo();
  85 + //uninsProcInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
  86 + uninsProcInfo.FileName = "cmd.exe";
  87 + string comandoUnins;
  88 + comandoUnins = "/C" + reg.GetValue("QuietUninstallString").ToString().Replace("\"", "");
  89 + uninsProcInfo.Arguments = comandoUnins;
  90 + uninsProc.StartInfo = uninsProcInfo;
  91 + uninsProc.Start();
  92 + uninsProc.WaitForExit();
  93 + }
  94 +
  95 + static void instalarPython(int opSys){
  96 + //Console.WriteLine("Por favor, confirme a instalação do Python 2.7.9");
  97 + string[] buscaPython;
  98 + if(opSys == 64){
  99 + buscaPython = Directory.GetFiles(Directory.GetCurrentDirectory(), "python-2.7.9.amd64.msi", SearchOption.AllDirectories);
  100 + }else{
  101 + buscaPython = Directory.GetFiles(Directory.GetCurrentDirectory(), "python-2.7.9.msi", SearchOption.AllDirectories);
  102 + }
  103 + string pythonPath = buscaPython[0];
  104 + string comandoIns = "/C" + pythonPath;
  105 +
  106 + System.Diagnostics.ProcessStartInfo insProcInfo = new System.Diagnostics.ProcessStartInfo();
  107 + System.Diagnostics.Process insProc = new System.Diagnostics.Process();
  108 +
  109 + insProcInfo.FileName = "cmd.exe";
  110 + insProcInfo.Arguments = comandoIns;
  111 + //insProcInfo.Verb = "runas"; //ADM
  112 +
  113 + insProc.StartInfo = insProcInfo;
  114 + insProc.Start();
  115 + insProc.WaitForExit();
  116 +
  117 + }
  118 +
  119 + [STAThread]
  120 + static void Main()
  121 + {
  122 +
  123 + //VERFICAÇÃO E DESINSTALAÇÃO DO VLIBRAS DESCONTINUADO
  124 + //Variáveis para verificar se há instalação no registro
  125 + var lm64 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
  126 + var lm32 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32);
  127 + RegistryKey reg;
  128 + RegistryKey reg2;
  129 + RegistryKey reg3;
  130 + RegistryKey reg4;
  131 +
  132 + bool tentouX64 = false;
  133 + Console.WriteLine("Verificação se há versões descontinuadas do VLibras.");
  134 + //x64
  135 + try{
  136 + reg = lm64.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{84B73167-EF7F-42BB-9CCD-E1A8E2C53659-vlibras}_is1");
  137 + if(reg == null){
  138 + Console.WriteLine("Chave do 64 é nula.");
  139 + Console.WriteLine("UninstallString 64: nenhum.");
  140 + Console.WriteLine("QuietUninstallString 64: nenhum.");
  141 + }else{
  142 + tentouX64 = true;
  143 + Console.WriteLine("Chave: "+reg.ToString());
  144 + Console.WriteLine("UninstallString 64: "+reg.GetValue("UninstallString").ToString().Replace("\"", ""));
  145 + Console.WriteLine("QuietUninstallString 64: "+reg.GetValue("QuietUninstallString").ToString().Replace("\"", ""));
  146 + //desinstalação da versão x64
  147 + Console.WriteLine("Desinstalando a versão descontinuada do VLibras x64. Por favor, aguarde.");
  148 + desinstalarVLibras(reg);
  149 + //Console.WriteLine("Desinstalou a versão descontinuada do VLibras x64.");
  150 + }
  151 + }catch(Exception e){
  152 + Console.WriteLine("Erro x64: {0}",e);
  153 + }
  154 +
  155 + Console.WriteLine("");
  156 +
  157 + //x86
  158 + if(!tentouX64){
  159 + try{
  160 + reg = lm32.OpenSubKey(@"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{84B73167-EF7F-42BB-9CCD-E1A8E2C53659-vlibras}_is1");
  161 + if(reg == null){
  162 + Console.WriteLine("Chave do 32 é nula.");
  163 + Console.WriteLine("UninstallString 32: nenhum.");
  164 + Console.WriteLine("QuietUninstallString 32: nenhum.");
  165 + }else{
  166 + Console.WriteLine("Chave: "+reg.ToString());
  167 + Console.WriteLine("UninstallString 32: "+reg.GetValue("UninstallString").ToString().Replace("\"", ""));
  168 + Console.WriteLine("QuietUninstallString 32: "+reg.GetValue("QuietUninstallString").ToString().Replace("\"", ""));
  169 + //desinstalação da versão x86
  170 + Console.WriteLine("Desinstalando a versão descontinuada do VLibras x86. Por favor, aguarde.");
  171 + desinstalarVLibras(reg);
  172 + //Console.WriteLine("Desinstalou a versão descontinuada do VLibras x86.");
  173 + }
  174 + }catch(Exception e){
  175 + Console.WriteLine("Erro x86: {0}",e);
  176 + }
  177 + }
  178 +
  179 + Console.WriteLine("");
  180 + Console.WriteLine("Verificando se o Python 2.7.9 está instalado");
  181 +
  182 + //VERIFICAÇÃO DO INTERPRETADOR PYTHON
  183 + //x64
  184 + try{
  185 + reg = lm64.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{79F081BF-7454-43DB-BD8F-9EE596813232}");
  186 + reg2 = lm64.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{79F081BF-7454-43DB-BD8F-9EE596813233}");
  187 + reg3 = lm32.OpenSubKey(@"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{79F081BF-7454-43DB-BD8F-9EE596813232}");
  188 + reg4 = lm32.OpenSubKey(@"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{79F081BF-7454-43DB-BD8F-9EE596813233}");
  189 + if(reg == null && reg2 == null && reg3 == null && reg4 == null){
  190 + Console.WriteLine("O python 2.7.9 não se encontra instalado. Por confirme a instalação.");
  191 + if(Environment.Is64BitOperatingSystem){
  192 + instalarPython(64);
  193 + }else{
  194 + instalarPython(86);
  195 + }
  196 + }
  197 + }catch(Exception e){
  198 + Console.WriteLine("Erro python: {0}",e);
  199 + }
  200 +
  201 + Console.WriteLine("");
  202 + Console.WriteLine("Checando as variáveis de ambiente.");
  203 +
  204 + //CONFIGURAÇÃO DAS VARIÁVEIS DE AMBIENTE
  205 + try{
  206 + ResetEnvVar();
  207 + }catch(Exception e){
  208 + Console.WriteLine("Erro Var Env: {0}", e);
  209 + }
  210 +
  211 +
  212 + Console.WriteLine("");
  213 + //DOWNLOAD DOS SINAIS
  214 + //BAIXA OS ZIPS DOS SINAIS
  215 + string url = @"http://127.0.0.1:8080/";
  216 + string path = @"..\";
  217 + string extractPath = @"..\Bundles\";
  218 + string ext = @".zip";
  219 + int i = 1;
  220 + string remote;
  221 + string local;
  222 + //baixa apenas se for mais recente ou se usuário não possuir cópia
  223 + while(true){
  224 + remote = url+i.ToString()+ext;
  225 + local = path+i.ToString()+ext;
  226 + if(!RemoteFileExists(remote)){
  227 + //NECESSÁRIO PARA EVITAR IndexOutOfRange
  228 + i--;
  229 + break;
  230 + }else{
  231 + if(!File.Exists(local)){
  232 + DownloadFileToPath(remote, local);
  233 + }else{
  234 + if(RemoteIsNewerThanLocal(remote, local)){
  235 + DownloadFileToPath(remote, local);
  236 + //DELETA ARQUIVO DE VERIFICAÇÃO PARA QUE HAJA NOVA EXTRAÇÃO
  237 + File.Delete(extractPath + i);
  238 + }
  239 + }
  240 + }
  241 + i++;
  242 + }
  243 +
  244 +
  245 + //EXTRAÇÃO:
  246 + //EXTRAI APENAS SE NÃO TIVER O ARQUIVO HOMÔNIMO SEM EXTENSÃO NA PASTA SINAIS
  247 + //SE O CAMINHO DE EXTRAÇÃO NÃO EXISTE, ELE SERÁ CRIADO
  248 + bool exists = System.IO.Directory.Exists(extractPath);
  249 + if(!exists){
  250 + System.IO.Directory.CreateDirectory(extractPath);
  251 + }
  252 +
  253 + while(i > 0){
  254 + if(!File.Exists(extractPath+i.ToString())){
  255 + string zip = path+i.ToString()+ext;
  256 + using (ZipArchive archive = ZipFile.Open(zip, ZipArchiveMode.Read, System.Text.Encoding.GetEncoding(System.Globalization.CultureInfo.CurrentCulture.TextInfo.OEMCodePage))){
  257 + foreach (ZipArchiveEntry entry in archive.Entries){
  258 + //POSSO FILTRAR E EXTRAIR APENAS ARQUIVOS QUE TERMINEM COM O VALOR DA STRING
  259 + if (entry.FullName.EndsWith("", StringComparison.OrdinalIgnoreCase))
  260 + {
  261 + entry.ExtractToFile(Path.Combine(extractPath, entry.FullName), true);
  262 + }
  263 + }
  264 + }
  265 + //CRIA UM ARQUIVO 1(SEM EXTENSÃO), 2, 3... NA PASTA BUNDLES PARA VERIFICAÇÃO DE EXTRAÇÃO PRÉVIA
  266 + //SÓ É CRIADO APÓS EXTRAÇÃO DE TODOS OS ARQUIVOS DE CADA ZIP
  267 + File.Create(extractPath+i).Close();
  268 + }
  269 + i--;
  270 + }
  271 +
  272 + //EXTRAI OS BUNDLES
  273 + /*//VERSÃO QUE EXTRAIA TODOS ZIPS NA PASTA SINAIS
  274 + try{
  275 + //ARRAY COM PATHS DOS ZIPS: "C:\...\blabla.zip"
  276 + string[] zipPaths = Directory.GetFiles(Directory.GetCurrentDirectory()+@"\Sinais\", "*.zip", SearchOption.AllDirectories);
  277 +
  278 + //ARRAY COM NOMES DOS ZIPS: "blabla"
  279 + string[] nomeZips = new string[zipPaths.Length];
  280 + for(int i = 0; i < zipPaths.Length; i++){
  281 + int slashIdx = zipPaths[i].LastIndexOf(@"\");
  282 + int extIdx = zipPaths[i].LastIndexOf(@".");
  283 + //Console.WriteLine("path>> "+zipPath);
  284 + //Console.WriteLine("removido a extensão>> "+zipPath.Remove(extIdx, 4));
  285 + //Console.WriteLine("nome do arquivo com extensão>> "+zipPath.Remove(0, slashIdx + 1));
  286 + Console.WriteLine("nome do arquivo sem extensão>> "+zipPaths[i].Remove(extIdx, 4).Remove(0, slashIdx + 1));
  287 + nomeZips[i] = zipPaths[i].Remove(extIdx, 4).Remove(0, slashIdx + 1);
  288 + //Console.WriteLine("nomeZips["+i+"]>> "+ nomeZips[i]);
  289 + }
  290 +
  291 + //EXTRAI UM ARQUIVO: "C:\...\pastaComZip\zipado.zip"
  292 + //EM: "C:\...\pastaComZip\zipado\arquivoQueEstavaEmZipado"
  293 + for(int i = 0; i < nomeZips.Length; i++){
  294 + string extractPath = zipPaths[i]+@"\..\..\..\Bundles\"; //volta duas e cria lá
  295 +
  296 + //SE O CAMINHO DE EXTRAÇÃO NÃO EXISTE, ELE SERÁ CRIADO
  297 + bool exists = System.IO.Directory.Exists(extractPath);
  298 + if(!exists){
  299 + System.IO.Directory.CreateDirectory(extractPath);
  300 + }
  301 + //EXTRAÇÃO DOS ARQUIVOS
  302 + using (ZipArchive archive = ZipFile.Open(zipPaths[i], ZipArchiveMode.Read, System.Text.Encoding.GetEncoding(System.Globalization.CultureInfo.CurrentCulture.TextInfo.OEMCodePage)))
  303 + {
  304 + foreach (ZipArchiveEntry entry in archive.Entries)
  305 + {
  306 + //POSSO FILTRAR E EXTRAIR APENAS ARQUIVOS QUE TERMINEM COM O VALOR DA STRING
  307 + if (entry.FullName.EndsWith("", StringComparison.OrdinalIgnoreCase))
  308 + {
  309 + entry.ExtractToFile(Path.Combine(extractPath, entry.FullName), true);
  310 + }
  311 + }
  312 + }
  313 + }
  314 + //DELETA O ZIP NO FINAL
  315 + for(int i = 0; i < zipPaths.Length; i++){
  316 + if(File.Exists(zipPaths[i])){
  317 + File.Delete(zipPaths[i]);
  318 + }
  319 + }
  320 + }catch(Exception e){
  321 + Console.WriteLine("ERRO ZipFile: {0}", e);
  322 + }
  323 + */
  324 + /*//VERSÃO QUE CHECAVA UM ARQUIVO DICTIONARY_VERSION.TXT
  325 + try{
  326 + //string dictVer = System.IO.File.ReadAllText(@"dictionary_version.txt");
  327 + string[] dictVer = Directory.GetFiles(Directory.GetCurrentDirectory(), "dictVer.txt", SearchOption.AllDirectories);
  328 + if(dictVer.Length == 0){
  329 + Console.WriteLine("Path de DictVer.txt: null path");
  330 + }else{
  331 + Console.WriteLine("Path de DictVer.txt: " + dictVer[0]);
  332 + }
  333 + if(dictVer.Length == 0){
  334 + string[] buscaBundles = Directory.GetFiles(Directory.GetCurrentDirectory(), "Bundles.zip", SearchOption.AllDirectories);
  335 + string zipPath = buscaBundles[0];
  336 + string extractPath = buscaBundles[0] + @"\..\Bundles\";
  337 +
  338 + using (ZipArchive archive = ZipFile.Open(zipPath, ZipArchiveMode.Read, System.Text.Encoding.GetEncoding(System.Globalization.CultureInfo.CurrentCulture.TextInfo.OEMCodePage)))
  339 + {
  340 + foreach (ZipArchiveEntry entry in archive.Entries)
  341 + {
  342 + if (entry.FullName.EndsWith("", StringComparison.OrdinalIgnoreCase))
  343 + {
  344 + entry.ExtractToFile(Path.Combine(extractPath, entry.FullName), true);
  345 + }
  346 + }
  347 + }
  348 + }
  349 + }catch(Exception e){
  350 + Console.WriteLine("ERRO ZipFile: {0}", e);
  351 + }
  352 + */
  353 +
  354 + Console.WriteLine("Pré-requisitos verificados.");
  355 + //Console.ReadKey();
  356 +
  357 +
  358 +
  359 + //RODA O VLIBRAS
  360 + try{
  361 + Process playerProc = new Process();
  362 + string[] buscaPlayer = Directory.GetFiles(Directory.GetCurrentDirectory(), "vlibrasPlayer.exe", SearchOption.AllDirectories);
  363 + string player = buscaPlayer[0];
  364 + playerProc.StartInfo.FileName = player;
  365 + playerProc.EnableRaisingEvents = true;
  366 + playerProc.Start();
  367 + //playerProc.WaitForExit();
  368 + }catch(Exception e){
  369 + Console.WriteLine("Erro: {0}", e);
  370 + }
  371 +
  372 + /*
  373 + Application.EnableVisualStyles();
  374 + Application.SetCompatibleTextRenderingDefault(false);
  375 + Application.Run(new Form1());
  376 + */
  377 + }
  378 + }
  379 +}
... ...