Commit 774397cd authored by Felipe Damiao Barcelos Villela de Andrade's avatar Felipe Damiao Barcelos Villela de Andrade
Browse files

Add project files.

parent 86466c2e
No related merge requests found
Showing with 199 additions and 0 deletions
+199 -0

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29609.76
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZipExtractTest", "ZipExtractTest\ZipExtractTest.csproj", "{111CD412-8566-457C-B795-27BDA83474A5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{111CD412-8566-457C-B795-27BDA83474A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{111CD412-8566-457C-B795-27BDA83474A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{111CD412-8566-457C-B795-27BDA83474A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{111CD412-8566-457C-B795-27BDA83474A5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3408DC7B-67AF-401F-AB66-DEDE91B2C062}
EndGlobalSection
EndGlobal
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace ZipExtractTest
{
class Program
{
private static readonly string AtualizacaoTempNexusPath = AppDomain.CurrentDomain.BaseDirectory + "AtualizacaoTempNexus";
private static readonly string ZipFilePath = AppDomain.CurrentDomain.BaseDirectory + "atualizacaoTempNexus.zip";
private static readonly string UriDownloadNexus = "https://repo.tecgraf.puc-rio.br/repository/fenix/fenix/fenix/2019.34.2/fenix-2019.34.2-fenix.zip";
static void Main(string[] args)
{
var encodings = new List<Encoding>
{
Encoding.GetEncoding(1252),
Encoding.GetEncoding("iso-8859-2"),
Encoding.GetEncoding("iso-8859-1"),
new UTF8Encoding(false),
new UTF8Encoding(true),
Encoding.GetEncoding("iso-8859-15"),
Encoding.GetEncoding("iso-8859-9"),
};
Console.Write("Downloading zip...");
BaixarArtefatoParaAtualizacaoTempNexusZip().Wait();
Console.WriteLine("done!");
Console.WriteLine($"Extracting with encodings: {string.Join(",", encodings.Select(x => x.WebName))}" +
$"{Environment.NewLine}");
foreach (var encoding in encodings)
{
Console.Write($"Extracting with {encoding.WebName}... ");
var destPath = Path.Combine(AtualizacaoTempNexusPath, encoding.WebName);
if (Directory.Exists(destPath))
{
Directory.Delete(destPath, true);
}
ZipFile.ExtractToDirectory(ZipFilePath, destPath, encoding);
Console.WriteLine($"done!");
}
Console.WriteLine($"{Environment.NewLine} Finished all encodings");
Console.ReadKey();
}
private static async Task BaixarArtefatoParaAtualizacaoTempNexusZip()
{
try
{
//var cancellationToken = new CancellationToken();
//TODO: precisa adicionar uma barra de load já que este carregamento pesado está sendo feito antes do atualizador
using (var httpClient = new HttpClient { Timeout = TimeSpan.FromMinutes(20) })
using (var httpResponseMessage = await httpClient.GetAsync(UriDownloadNexus).ConfigureAwait(false))
using (var fileStream = new FileStream(ZipFilePath, FileMode.Create)) //vai sobreescrever se já existir
{
//await httpClient.DownloadAsync(_uriDownloadNexus, fileStream, progress, cancellationToken);
await httpResponseMessage.Content.CopyToAsync(fileStream).ConfigureAwait(false);
}
}
catch (Exception ex)
{
//_log.Error(
// $"[Fênix: Erro em {nameof(AtualizadorService)}{nameof(BaixarArtefatoParaAtualizacaoTempNexusZip)} - Nexus] :{ex.Message} | [Source]: {ex.Source} | [StackTrace]: {ex.StackTrace}");
throw new Exception("Não foi possível acessar o servidor de atualizações Nexus", ex);
}
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ZipExtractTest")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ZipExtractTest")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("111cd412-8566-457c-b795-27bda83474a5")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{111CD412-8566-457C-B795-27BDA83474A5}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>ZipExtractTest</RootNamespace>
<AssemblyName>ZipExtractTest</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment